πŸ’ΎTransactions

A transaction captures details of an activity that has taken place on a blockchain.

In the Ethereum blockchain and Ethereum-compatible blockchains there are three types of transaction that can take place:

  1. The transfer of cryptocurrency from one account to another

  2. Deployment of a smart contract

  3. Transacting with a smart contract

The specifics of blockchain accounts and smart contracts will be discussed in subsequent sections, but it's important to understand that there are only three types of transactions that can take place.

The different types of transactions are labelled by type in Chainlens.

The most common types of transactions are those associated with tokens on a blockchain network. These are managed by smart contracts which have been deployed to that network. Transferring a token takes place as a transaction within a smart contract on Ethereum, hence having some awareness of the information contained within transactions is important for deciphering this.

Transactions have the following key attributes:

  • Index

  • Transaction hash

  • Sender address

  • Recipient address

  • Amount

  • Fee

  • Data

  • Events

There are other fields associated with transactions, for instance, the creation of a transaction involves submitting a cryptographically signed transaction to the network and then processing a response message if successful, however, such protocol details are technical content we will not be covering here.

Transactions do not have a timestamp associated with them, as they are only considered to have taken place once the block they are contained within is produced. Transactions are however ordered in blocks by their index.

Transactions, like blocks, have a hash associated with them. As with block hashes, transaction hashes uniquely identify the contents of the transaction.

The sender address is the wallet that initiated the transaction.

The recipient address is the destination address for the transaction. This can be a wallet to receive cryptocurrency funds into, the address of a smart contract to transact with or empty if we are deploying a new smart contract.

The amount is the amount in the cryptocurrency of the network (for instance Ether) to be sent in the transaction.

The fee is the amount the sender is willing to pay for the transaction to take place in the native cryptocurrency of the network. This is defined by two attributes β€” the gas price and the gas limit which are the amount per unit of computation you are willing to pay and the total amount of gas you are willing to spend (this is covered in more detail in a subsequent section).

The data field contains binary information relevant to the transaction. When sending cryptocurrency it could be a message for the receiver, if deploying a smart contract it is the code of the contract, and when transacting with a smart contract it is details of the function invoked on the contract.

The events field provides information about any data output by the smart contract in the transaction.

The data and events fields are crucial sources of information, as it is from this that information such as token ownership is defined.

We will be expanding further upon tokens and smart contracts shortly.

Summary

A transaction represents an action taking place on a blockchain network. There are three types of transactions on Ethereum networks β€” the transfer of cryptocurrency from one account to another, the deployment of a smart contract and interacting with a smart contract.

There are a number of fields that are contained within a transaction, two of the key fields for interpreting activities that have taken place on the blockchain are the data and events fields.

Last updated