The StampStorage contract is a simple ethereum contract whose purpose is to record proof of document existence at a given timestamp.
The SHA256 hash of a document is submitted to the contract which will be "stamped" with a datetime represented as seconds since the epoch. Anyone can verify the existence and check the timestamp of these stamps on the public blockchain.
To avoid broadcasting frequent and numerous document stamps - which may be prohibitively expensive - document hashes can be combined into a Merkle Tree and the tree root submitted for stamping. Document hashes submitted to the Stamp API are periodically batched and submitted in this way.
A subset of the tree nodes, which are sufficient to prove a valid document is included in a stamp, may be retrieved after the stamp has been mined. The proof's size is proportianal to log(n), where n is the number of documents submitted in the stamp. Others can independently and trustlessly:
- verify this proof forms a valid merkle tree,
- its root is stored in the StampStorage contract,
- and check the stamp timestamp, t proving the document existed at least since time t.
- generate the go contract code from the solidity contract
- build the stamp server binary
- compile all the solidity contracts
- perform ethereum migrations on geth network
Database migrations are run with rambler.
To apply the next database migration, run rambler -c sql/rambler.json apply
.
To revert to the previous migration, run rambler -c sql/rambler.json reverse
docker-compose up
./build/stamp -config config.json
An example configuration file can be found at config.json
.
- address: the hex address of the contract
- host: geth node hostname
- port: geth node port
- interval: period, in seconds, to submit a new stamp
- privateKey: path to the Keystore File (UTC / JSON)
- password: used to decrypt the keystore file
- geth
- solc
- truffle
- rambler
- Ping
GET /ping
- Get Document
GET /document/{id}
- Create Document
POST /document
- Get Stamp
GET /stamp/{id}