Skip to content
Snippets Groups Projects
Commit 08fe2453 authored by Robert Martin-Legene's avatar Robert Martin-Legene
Browse files

Adding a simpler TSA

parent 227f1320
No related branches found
No related tags found
No related merge requests found
[{"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"}]
0x0fa811ac6643a29ad9c17acbed34918a4875f63c
\ No newline at end of file
// 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];
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment