[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
View All
ParentTxHash Block Age From To Value
Contract Source Code Verified (Exact Match)
Contract Name: SecretRegistry
Compiler Version: v0.5.2+commit.1df8f40c
Optimization Enabled: No
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity ^0.5.2;

/// @title SecretRegistry
/// @notice SecretRegistry contract for registering secrets from Raiden Network
/// clients.
contract SecretRegistry {

    string constant public contract_version = "0.6.0";

    // keccak256(secret) => block number at which the secret was revealed
    mapping(bytes32 => uint256) private secrethash_to_block;

    event SecretRevealed(bytes32 indexed secrethash, bytes32 secret);

    /// @notice Registers a hash time lock secret and saves the block number.
    /// This allows the lock to be unlocked after the expiration block.
    /// @param secret The secret used to lock the hash time lock.
    /// @return true if secret was registered, false if the secret was already
    /// registered.
    function registerSecret(bytes32 secret) public returns (bool) {
        bytes32 secrethash = keccak256(abi.encodePacked(secret));
        if (secret == bytes32(0x0) || secrethash_to_block[secrethash] > 0) {
            return false;
        }
        secrethash_to_block[secrethash] = block.number;
        emit SecretRevealed(secrethash, secret);
        return true;
    }

    /// @notice Registers multiple hash time lock secrets and saves the block
    /// number.
    /// @param secrets The array of secrets to be registered.
    /// @return true if all secrets could be registered, false otherwise.
    function registerSecretBatch(bytes32[] memory secrets) public returns (bool) {
        bool completeSuccess = true;
        for(uint i = 0; i < secrets.length; i++) {
            if(!registerSecret(secrets[i])) {
                completeSuccess = false;
            }
        }
        return completeSuccess;
    }

    /// @notice Get the stored block number at which the secret was revealed.
    /// @param secrethash The hash of the registered secret `keccak256(secret)`.
    /// @return The block number at which the secret was revealed.
    function getSecretRevealBlockHeight(bytes32 secrethash) public view returns (uint256) {
        return secrethash_to_block[secrethash];
    }
}

    Contract ABI  
[{"constant":false,"inputs":[{"name":"secret","type":"bytes32"}],"name":"registerSecret","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"contract_version","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"secrets","type":"bytes32[]"}],"name":"registerSecretBatch","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"secrethash","type":"bytes32"}],"name":"getSecretRevealBlockHeight","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"secrethash","type":"bytes32"},{"indexed":false,"name":"secret","type":"bytes32"}],"name":"SecretRevealed","type":"event"}]

  Contract Creation Code Switch To Opcodes View
608060405234801561001057600080fd5b506103db806100206000396000f3fe608060405234801561001057600080fd5b5060043610610069576000357c01000000000000000000000000000000000000000000000000000000009004806312ad8bfc1461006e578063b32c65c8146100b4578063bbe8a9b614610137578063c1f6294614610207575b600080fd5b61009a6004803603602081101561008457600080fd5b8101908080359060200190929190505050610249565b604051808215151515815260200191505060405180910390f35b6100bc610302565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100fc5780820151818401526020810190506100e1565b50505050905090810190601f1680156101295780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101ed6004803603602081101561014d57600080fd5b810190808035906020019064010000000081111561016a57600080fd5b82018360208201111561017c57600080fd5b8035906020019184602083028401116401000000008311171561019e57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929050505061033b565b604051808215151515815260200191505060405180910390f35b6102336004803603602081101561021d57600080fd5b8101908080359060200190929190505050610393565b6040518082815260200191505060405180910390f35b600080826040516020018082815260200191505060405160208183030381529060405280519060200120905060006001028314806102995750600080600083815260200190815260200160002054115b156102a85760009150506102fd565b4360008083815260200190815260200160002081905550807fc8ee7ba45d0c5351df845eda156d523bd6865844a5f2c69df35b757e2f794fa1846040518082815260200191505060405180910390a260019150505b919050565b6040805190810160405280600581526020017f302e362e3000000000000000000000000000000000000000000000000000000081525081565b6000806001905060008090505b835181101561038957610371848281518110151561036257fe5b90602001906020020151610249565b151561037c57600091505b8080600101915050610348565b5080915050919050565b600080600083815260200190815260200160002054905091905056fea165627a7a72305820a70c5c8727560fcaa87d392d23e598712eaa4e3af6c8b20d4137b915ac83329c0029

   Swarm Source:
bzzr://a70c5c8727560fcaa87d392d23e598712eaa4e3af6c8b20d4137b915ac83329c

 

View All
Block Age transaction Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward