[ 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.4.25+commit.59dbf8f1
Optimization Enabled: No
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity ^0.4.23;

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

    string constant public contract_version = "0.3._";

    // 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[] 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
608060405234801561001057600080fd5b50610424806100206000396000f300608060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806312ad8bfc14610067578063b32c65c8146100b0578063bbe8a9b614610140578063c1f62946146101be575b600080fd5b34801561007357600080fd5b506100966004803603810190808035600019169060200190929190505050610203565b604051808215151515815260200191505060405180910390f35b3480156100bc57600080fd5b506100c5610342565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101055780820151818401526020810190506100ea565b50505050905090810190601f1680156101325780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561014c57600080fd5b506101a46004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929050505061037b565b604051808215151515815260200191505060405180910390f35b3480156101ca57600080fd5b506101ed60048036038101908080356000191690602001909291905050506103d4565b6040518082815260200191505060405180910390f35b600080826040516020018082600019166000191681526020019150506040516020818303038152906040526040518082805190602001908083835b602083101515610263578051825260208201915060208101905060208303925061023e565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390209050600060010260001916836000191614806102c657506000806000836000191660001916815260200190815260200160002054115b156102d4576000915061033c565b4360008083600019166000191681526020019081526020016000208190555080600019167fc8ee7ba45d0c5351df845eda156d523bd6865844a5f2c69df35b757e2f794fa18460405180826000191660001916815260200191505060405180910390a2600191505b50919050565b6040805190810160405280600581526020017f302e332e5f00000000000000000000000000000000000000000000000000000081525081565b600080600060019150600090505b83518110156103ca576103b284828151811015156103a357fe5b90602001906020020151610203565b15156103bd57600091505b8080600101915050610389565b8192505050919050565b600080600083600019166000191681526020019081526020016000205490509190505600a165627a7a72305820da0d83c72f511f05b68616ffcdc2f6a65aed0ae9407c54225669d80a3ef0e43d0029

   Swarm Source:
bzzr://da0d83c72f511f05b68616ffcdc2f6a65aed0ae9407c54225669d80a3ef0e43d

 

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