How to read transactions in Cardano

imagen

I will explain how to read the Cardano blockchain ledger.

You will understand how transactions are accounted for, both those sending ADA and those creating delegation keys.

In order to read the information recorded in the network, you must first understand the structure of the blockchain ledger.

Each wallet has two types of addresses:

-Spending address: the one we usually use for value transfers.

-Staking address: where the rewards paid by the protocol are hosted. From this address it is not possible to send funds to other accounts, only to the expense (claim) address.

With Shelley, a new format was introduced in the addresses, the BECH32, to be able to delegate and vote.

Morphology

Spending address (103 lowercase alphanumeric characters): addr1q9xz02yynlfyuq2n64fvxsxsxerwu6qhgwkct9yn1rgl9rr6j4kjnefp9t8xdhuskpm2vszvm2y3vk32vq3r6vze3hs9jq07tkmf

Delegating staking address (103 lowercase alphanumeric characters): 55b4a7948484ab399b7e42c1da999901336a245968a9808888f4c166578155

Bech32 staking address: (word stake + 54 lowercase alphanumeric characters): stake1u92mffu5sj4nnxm7gtqa4xgpxd4zgkjg4xqg3axpvcmczeq57gxkz

Wallets with a balance greater than zero have at least one address with money received, but can have more addresses that add up to the wallet total, because Cardano has hierarchical deterministic wallets (HD).

HD wallets are used for privacy, where the new address you create has zero balance, so that whoever sends money to your wallet does not see the balance of your wallet. Once you have used a wallet address to receive funds, a new one will be generated for you to use optionally. These addresses, (public keys) are also governed by a single key pair (the same private key), this means that the previous addresses you have used can still be used and you will not lose control of them.

UTXO model

The accounting system used in Cardano (as in Bitcoin and other blockchains) is Unspent Transaction Output (UTXO).

With this method, instead of removing from the address only the amount of cryptocurrencies to be transferred, the total of that address is subtracted, leaving it at zero, the portion of money is transferred to the destination address and the balance is deposited in a new address created by the protocol for the holder who made the expenditure.

For example, if you have 1000 ADAs in address #1 of your wallet and you want to spend 100 ADAs, the ledger (blockchain register) will register the sending of the 100 ADAs to the destination address and the balance of the 900 ADAs will be sent to a new address of your wallet, say #2, leaving address #1 empty but able to be used again, although it is not advisable because it unveils the entire transaction history (the HD addresses explained above make sense there).

Blockchain explorers

In order to read network transactions, a browser must be used. There is one designed by IOHK for Cardano, but also others. I copy the links of the most common ones:

https://explorer.cardano.org/en.html

https://adaex.org/

For the explanation I will use CardanoScan, which, in my opinion, is the clearest in its accounting exposition, although all of them register the same information structure.

A clarification, both the IOHK scanner and ADAex show as error those addresses that have not yet registered operations in the network, and it is not that they are invalid, nor that they must be registered first to then be operated, but simply as it searches the network and does not find it (it had no transactions) then the error message appears. Public addresses have integrity from their cryptographic structure and not by their registration in the network. An address that does not have integrity will not be accepted in the validation of transactions or incorporated into the blockchain.

The transactions that are exhibited in the following examples are randomly taken from the network, and I do not know the holders.

The transactions can be read from:

  • the sending address,
  • the receiving address or
  • the transaction hash (the hash that records the operation between the source and destination address).

Let’s start by reading from the transaction hash.

For example for Hash: 3947f8216288467c7d448479b20cf1c8dc38b45b7c3bdd8ab5623454dfe19140

The details of the operation are shown:
imagen
It shows the block in which the transaction was recorded, the number of confirmations (low with less than 5, then medium and high with more than 10), the slot in which the designated pool validated, the UTC time, the total network rate, and the total outgoing. The certificate refers to the staking key, showing 2 in this case since both the sender of the money and the receiver are delegating.

It then displays the movements involving the transaction addresses, in this case only two, one sending and one receiving, but they can also be more addresses because of the UTXO structure of the addresses involved (it may be that the sending wallet needs several addresses to total the amount).
imagen
From the sending address, a transaction is executed for 1,641.266481 Adas, with a fee of 0.175137 ADAs arriving at the (lower) net fee amount.

If we look at the transaction from the address that sent the money, it looks like this:

imagen
imagen

We see that the transaction we are analyzing has an OUT for the net amount and rate on 03/03/2021.

Minutes before it had a cash inflow (IN).

In another example, if we consult in the explorer this hash: bae50f7845a33a3b6628bc1a39d98a1ca1ca1e8b03d6ab204115d6555867898d723 , we will see that there are several addresses that send money, since by the amount involved they need several of them that compose the wallet. This fractionation, as I explained, is because of the UTXO structure.

Finally, the network structure for registering delegation keys is similar to those mentioned for registering transactions but the difference is that they have in addition to the network fee, the deposit of 2 ADAs of guarantee and the creation of the certificate.

5 Likes

Hello! Thanks for the education.

Is there a way to get the address programmatically from the transaction hash?

What I’m trying to do: given a utxo, get the address of the user who sent it. Is that possible via API?

1 Like

if you get the hash id you can check the sending address and the receiving one.
And if you get the address (sending or receving one) you can get the traceability of both.

Can you do that via an API or cardano-cli?

I guess so

Did you figure out how to get the address using cli?

Sorry, I’m not dev.

Oh, okay! no worries