When using Web3 services such as Avacus, you will often come across the term "transaction (Tx)." This article explains what a transaction is and why it is necessary on a blockchain.
What Is a Transaction (Tx)?
A transaction is a signed piece of data sent to perform an operation on a blockchain. It contains information about "who," "what," and "how" the operation should be performed, such as the recipient, amount, or smart contract function to call. Once the transaction is sent to the network and processed, the state of the blockchain is changed.
A transaction is assigned a value used to identify it. On Ethereum and similar networks, this is called a "Transaction Hash" or "Tx Hash." It can be used to check the status and details of a transaction on a block explorer.
Transactions Are Required for Transfers and Other State-Changing Operations
Operations that actually change assets or the state of a blockchain, such as token transfers, swaps on DEXs, and deposits or borrowing in DeFi, require a transaction. Once a transaction is processed by the network and included in a block, asset balances or smart contract states are updated.
Signing (Sign) Does Not Require Gas Fees
In addition to sending transactions, wallet interfaces may sometimes ask you to "Sign" a message or other data. Both involve using a wallet, but they differ in whether they change the state of the blockchain.
Transactions change the state of the blockchain and therefore normally incur a network fee (gas fee) to process them.
On the other hand, a signature (Sign) only operation is not sent to the blockchain network as a transaction and does not change the state of the blockchain. Therefore, it normally does not require a gas fee. For example, when logging in to a DApp, you may be asked to sign a message using your wallet's private key. The service can then verify the signature to prove that you can control the wallet.
Why Are Transactions Included in Blocks?
Blockchains are generally designed to operate without relying on a single central administrator and are maintained by multiple network participants. Submitted transactions are verified by network participants such as validators and, if valid, are included in a block. When the block is added to the blockchain, the result of the transaction is reflected in the state of the blockchain.
This process helps prevent issues such as double spending (attempting to spend the same assets twice) and keeps the shared record of the blockchain consistent across the network. Immediately after a transaction is submitted to the network, it has not yet been included in a block and is generally shown as "Pending." Once it is included in a block, the result of the transaction is reflected in the blockchain.
Summary
- A transaction (Tx) is signed data sent to perform an operation on a blockchain.
- Transactions are required for operations that change assets or the state of a blockchain, such as transfers and swaps.
- Transactions normally incur a network fee (gas fee), while signature (Sign) operations normally do not require a gas fee.
- Transactions are verified by the network and included in blocks, after which the results are reflected in the state of the blockchain.