diff --git a/network5445/contracts/0x0fa811ac6643a29ad9c17acbed34918a4875f63c/abi b/network5445/contracts/0x0fa811ac6643a29ad9c17acbed34918a4875f63c/abi new file mode 100644 index 0000000000000000000000000000000000000000..c03a9f40b0274c944e4014825675d183140fec07 --- /dev/null +++ b/network5445/contracts/0x0fa811ac6643a29ad9c17acbed34918a4875f63c/abi @@ -0,0 +1 @@ +[{"constant":true,"inputs":[{"name":"hash","type":"bytes32"}],"name":"get","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"hash","type":"bytes32"}],"name":"put","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] diff --git a/network5445/contracts/TimeStampAuthority b/network5445/contracts/TimeStampAuthority new file mode 120000 index 0000000000000000000000000000000000000000..9e920f677b0b36e75c176a4c26c664b372dec1d2 --- /dev/null +++ b/network5445/contracts/TimeStampAuthority @@ -0,0 +1 @@ +0x0fa811ac6643a29ad9c17acbed34918a4875f63c \ No newline at end of file diff --git a/src/contract.TimeStampAuthority.sol b/src/contract.TimeStampAuthority.sol new file mode 100644 index 0000000000000000000000000000000000000000..8b4c4e6cdfaecc65604371f769749c50be53a1ed --- /dev/null +++ b/src/contract.TimeStampAuthority.sol @@ -0,0 +1,21 @@ +// 20180718 Robert Martin-Legene <robert@nic.ar> +// Time stamp authority + +pragma solidity ^0.4.24; + +contract TimeStampAuthority { + // This mapping is almost an "associative array" + mapping (bytes32 => uint) private hashes; + + // Stores the hash of the document in the mapping + function put( bytes32 hash ) public { + require( hashes[hash] == 0, "That checksum has already been stored." ); + hashes[hash] = block.number; + } + + // Returns the block number in which the hash was first seen + function get( bytes32 hash ) public view returns (uint) { + require( hashes[hash] != 0, "That checksum has never been stored." ); + return hashes[hash]; + } +}