Target: Store SHA3 - 512bit (64Byte) on the Ethereum Blockchain.
Context: To be able to proof ownership over data, it is essential to entanglement the data with Account and Time to be able to put Data into Spacetime. This is a MVP which proofs that the owner of the Wallet (Account) wrote a SHA3 Hash of a data structure to the main-chain and with it entangles it with time through the transaction done and witnessed on the Ethereum Blockchain. The SHA3 Hash can be the result of a file or a merkle-tree. With the source data statically stored and preserved it is possible to proof the existence and potential ownership over that digital asset.
- yarn command line tool;
- sha3sum command line tool (-a 512) $FILENAME
- Alchemy API Key or access to an Ethereum node for advanced users;
- Ethereum Wallet e.g. Metamask (Recommended: Metamask);
- Blockchain Explorer e.g. Etherscan.io
- Top up your Ethereum Wallet to be able to pay for transactions by using a Faucet for a test network or by using real Ether for mainnet deployment.
Address: 0x269Ff9a5CB9BD5319bd95b248d2579Aa1e9D78FE (ETH mainnet)
Gas-optimized contract supporting both SHA3-256 and SHA3-512 hashes:
witness(bytes32)- for SHA3-256 (36 bytes calldata, ~23k gas)witness(bytes32,bytes32)- for SHA3-512 (68 bytes calldata, ~23k gas)
Events are fully indexed for efficient log filtering by hash.
Selectors:
witness(bytes32)=0x114ee197witness(bytes32,bytes32)=0x3771f888
Address: 0x45f59310ADD88E6d23ca58A0Fa7A55BEE6d2a611 (ETH mainnet, Sepolia, Holesky)
Old contract using write(bytes32[2]). Still on-chain; old witnesses remain verifiable.
- Generate the SHA3 hash of your file:
sha3sum -a 256 $FILENAMEorsha3sum -a 512 $FILENAME - For SHA3-256: call
witness(bytes32)with the hash directly - For SHA3-512: split the 64-byte hash into two 32-byte halves and call
witness(bytes32,bytes32)
yarn run test
prepare: get a local node with npm run node
deploy: yarn run testWriterDeploy or yarn run testEventWriterDeploy
prepare: replace ALCHEMY_API_KEY and ROPSTEN_PRIVATE_KEY* in hardhat.config.js
*You need to export a Ethereum Wallet Private Key from your Ethereum Wallet and copy it over to your script.
deploy: yarn run goerliWriterDeploy or yarn run goerliEventWriterDeploy
yarn run mainnetWriterDeploy or yarn run mainnetEventWriterDeploy
- configuration is provided to deploy on ropsten and mainnet as well (see
hardhat.config.js) - for a list of all available scripts look at the file
package.json