eSealing dApp#

You can explore the hosted eSealing service or start your own frontend by following the instructions in the README.md file of this repository to get an overview of the dApp flow.

Note

Comprehensive instructions on how to set up the Concordium Wallet for Web, create an account in the Concordium Wallet for Web, get some testnet CCD and run a local frontend can be found in setup a wallet.

The frontend supports the following two flows with the Concordium Wallet for Web (or the Concordium Wallet for Mobile that uses WalletConnect):

  • Compute the file hash of a selected file => register its file hash in the smart contract

  • Compute the file hash of a selected file => retrieve the timestamp and witness (sealer account) that registered the file hash

Note

Select the registration tab to register the file hash and the display tab to look up the timestamp and witness (sealer account) of an already registered file.

Note

A file hash is an algorithmic way to assign a unique string to a file using a cryptographic hash function (e.g., SHA-2) based on the file content. Changing the file’s content would result in a completely new file hash. The eSealing smart contract expects a file hash of length 256-bits as an input parameter because of the used HashSha2256 type.

Register a file#

Select the Registration tab to register the file hash as shown below:

StreamPlayer

View timestamp and witness#

Select the Display tab to look up the timestamp and witness (sealer account) of an already registered file as shown below:

StreamPlayer

Use Concordium Client#

The frontend is connected to a deployed eSealing smart contract on the Concordium testnet with this source code.

You can interact directly with the smart contract using concordium-client and your local node that is running at port 20001 to register a file hash as follows:

$ concordium-client contract update 2481 --entrypoint registerFile --sender <YourAccount> --energy 30000 --parameter-json fileHash.json --grpc-port 20001

Create a fileHash.json file with a file hash as content similar to:

"14fe0aed941aa0a0be1118d7b7dd70bfca475310c531f1b5a179b336c075db65"
../../_images/registerFile.png

Note

Comprehensive instructions on how to set up a local Concordium testnet node on port 20001 (or alternatively link to a remote node via grpc), and download concordium-client can be found in Setup the development environment.

Note

In Unix-like systems you can calculate the sha256 hash of a file with the following command:

$ sha256sum ./yourFile.txt

You can view the timestamp and witness (sealer account) of an already timestamped file as follows:

$ concordium-client contract invoke 2481 --entrypoint getFile --parameter-json fileHash.json --grpc-port 20001
../../_images/displayFile.png

What is the cost of using your account to seal a file?#

The cost is currently approximately 4-5 cents (Euro) to register a file hash in the smart contract on mainnet. Displaying the timestamp and witness (sealer_account) of a file hash is free of charge because you don’t send a transaction, you just look up the values from the chain.

Was this article helpful?