Skip to main content

Data outputs

Use cases may need to use blockchain technology to add traceability to certain business operations and assets. When using data outputs in transactions, the Hathor network creates a token representing an operation/asset, and the related metadata is recorded either on IPFS (in this case the blockchain stores the link to it) or directly on the blockchain (e.g. a data hash). This token is unitary as it solely works for grouping transactions. Hence, all transactions for the token can be browsed and the whole information history accessed. As with an NFT transaction creation, the data key is added to an output by spending 0.01 HTR.

The following is a sequence of requests that creates a traceable chain of transactions, with an initial token creation and data output and two subsequent transactions to store more data.

(1) This first transaction (i) creates a custom token (Traceable Data Token - TDT) and (ii) already stores some data in the blockchain.

This transaction follows the same model as an NFT creation transaction. However, business specific data is stored on the blockchain, not images or videos as in the case of traditional NFTs.

Transaction details can be accessed through Hathor Explorer.

curl -X POST -H "X-Wallet-Id: gitbook-wallet" -H "Content-type: application/json" \
--data '{"name": "Traceable Data Token", "symbol": "TDT", "amount": 1, "data": "some-data-to-store"}' \

(2) A new request to transfer the previously created token is sent. Note that the transaction sends the TDT token (a common UTXO) and stores a string in the blockchain as data output, so two outputs were used.

An amount of 0.01 HTR is spent by this transaction and a third UTXO is generated to hold the change amount (2.97 HTR). By accessing Hathor Explorer, details of these three outputs can be viewed.

curl -X POST -H "X-Wallet-Id: gitbook-wallet" -H "Content-type: application/json" \
--data '{"outputs": [{"type": "data", "data": "some-data-to-store-2"}, {"address": "WPNa6XYZmRrPvgMGY7y6G2NCW89oBubpnv", "value": 1, "token": "009e85be452ff4a2ac4fac81388ca3a7b888428f6179e82a31b25b3704085cba"}]}' \

(3) Finally, a third request is sent. It also sends the custom token from the preceding transaction and stores another string as a data output. Hathor explorer shows transaction details.

curl -X POST -H "X-Wallet-Id: gitbook-wallet" -H "Content-type: application/json" \
--data '{"outputs": [{"type": "data", "data": "some-data-to-store-3"}, {"address": "WPNa6XYZmRrPvgMGY7y6G2NCW89oBubpnv", "value": 1, "token": "009e85be452ff4a2ac4fac81388ca3a7b888428f6179e82a31b25b3704085cba"}]}' \

The token details page of the Hathor Explorer shows the token transaction history, with all three transactions. This is the benefit of using a token for grouping these operations: all the history can be easily consulted in a single place. It would be possible to simply write the data to the blockchain, without using the TDT token. However, data would be "scattered" in the blockchain, without an easy way to group it.