Ergo Notary Command-Line Tool

Folks from " Sininen Taivas" have developed a simple notary command-line script for Ergo. It is available at I kindly asked them to do some documentation. But, simply, takes a file as input, calculates its SHA-256 hash value and writes this value into a register of an unspendable box.

This would be useful for proofs of authorship, notarization of documents etc.

An example on how to call it to write hash of “mytext.txt” file contents on the Ergo blockchain:

python3 mytext.txt --mainnet --server --api-key 7yaASMijGEGTbttYHg1MrXnWB8EbzjJnFLSWvmNoHrXV

In case of success, the script creates “mytext.txt.nt.json” file with contents like:

{"boxId": "6cec418777b0ea0aa82be56e5eb03a3f8889fccdc0496133b6f73bb70ee2b5ec", "transactionId": "ec78378c4c1f6e6b0118124f36231f7077ea916921567a08a190b971187084aa", "updated": 1567779147.703096}

(time format looks strange, Python standard? will make an issue about that)

Then there is another script, , which is checking whether transaction is confirmed (got into the blockchain). Example:

python3 --server

In case of the transaction being confirmed, the mytext.txt.nt.json file being updated with confirmation time, e.g.

{'boxId': '6cec418777b0ea0aa82be56e5eb03a3f8889fccdc0496133b6f73bb70ee2b5ec', 'transactionId': 'ec78378c4c1f6e6b0118124f36231f7077ea916921567a08a190b971187084aa', 'updated': 1567779410.799707, 'confirmed': 1567779410.799699}

Transaction in the explorer:

Please note that one of the outputs of the transaction is locked by “4MQyMKvMbnCJG3aJ” script, which is P2S (Pay-to-Script) representation of “false” condition, i.e. the box is unspendable. Hash is written into R4 register of the box, in the explorer it looks like “0e2047ee2cbd52be01e0876c3e0b989a0d4d5f8955200b1fab0e6eeb2b182555c2fb”, where “0e” is type descriptor (byte array), “20” is bytestring length (0x20 in hex = 32), “47ee2cbd52be01e0876c3e0b989a0d4d5f8955200b1fab0e6eeb2b182555c2fb” is the hash of the file.

Locked amount is .001 Erg, according to current storage fee the box will live for ~4 years only.


It’s nice how the storage fee model sets a time limit for these types of boxes. You could easily set a higher fee if you wanted the notarisation to live for a much longer period.