Used to check for browser translation.
用于检测浏览器翻译。
ブラウザの翻訳を検出する

Transaction Types and Usage


Transactions are the fundamental operations that alter the state of the ArcBlock blockchain. Every action, from creating an account to transferring an NFT, is executed as a transaction. This section provides a comprehensive guide to the various transaction types available, their structure, and how to utilize them effectively with the @arcblock/graphql-client.

Before proceeding, it's recommended to have a basic understanding of Core Blockchain Concepts, particularly Wallets and Accounts, as they are integral to creating and signing transactions.

The Anatomy of a Transaction#

To ensure flexibility and extensibility, ArcBlock transactions adopt a mail-like structure, separating the container from the content.

  • Envelope: The outer transaction, which contains fields required for all transactions, such as the sender's address, public key, and signature.
  • Letter: The inner transaction (itx), which holds the actual content and logic for a specific operation, like a DeclareTx or TransferV2Tx.

This layered design allows for a consistent handling process while supporting a wide variety of operations.

Inner Transaction Examples

can be a

or a

or any other type

Transaction (Envelope)

from: string

pk: string

nonce: number

signature: string

itx: Any (Letter)

DeclareTx

TransferV2Tx

...


The outer transaction structure is consistent across all types:

type Transaction = {
from: string; // Sender's address
pk: string; // Sender's public key
nonce: number;
chainId: string; // Must match the target chain
signature: string; // Sender's signature
signatures: Array<Multisig>; // For multi-party scenarios
itx: Any; // The inner transaction
};

The inner transaction (itx) varies depending on its type. The Any type is used to encapsulate different data structures within a single field, providing a high degree of flexibility.

Transaction Lifecycle#

From creation to confirmation, a transaction follows a clear, verifiable path. The @arcblock/graphql-client simplifies this process, but understanding the steps is key to building robust applications.

Blockchain Node@arcblock/graphql-clientWalletYour ApplicationBlockchain Node@arcblock/graphql-clientWalletYour ApplicationPrepare transaction data (e.g., recipient, amount)Request signature for encoded transactionReturn signatureSend signed transactionDecode and Verify SignatureExecute Transaction LogicAppend to LedgerReturn transaction hashConfirm transaction sent

Common Transaction Characteristics#

While each transaction type serves a unique purpose, they share several common characteristics regarding fees, size, and signatures.

Transaction Fees#

Fees are a mechanism to prevent network abuse and fund certain operations. Three types of fees may be charged:

Fee Type

Description

Service Fee

Charged for moving tokens across an ArcBridge using DepositTokenV2Tx and WithdrawTokenV2Tx. The rate can vary between bridges.

Protocol Fee

Charged for protocol-level operations like CreateAssetTx, CreateFactoryTx, CreateTokenTx, and CreateRollupTx.

Gas Fee

A standard fee for computational resources. It is not currently enabled on the main or beta chains.

Transaction Size Limit#

To protect the chain from abuse, each transaction type has a hard size limit, measured in bytes after encoding. Transactions exceeding their limit will be rejected during verification. The specific limits for each transaction type are detailed in their respective documentation sections.

Transaction Signatures#

Signatures are cryptographic proof that a transaction is authentic and has not been tampered with.

  • Sender Signature: Every transaction must be signed by the sender. The network verifies this signature using the sender's public key, which is stored on-chain with their account.
  • Multi-party Signature: Some operations require consent from multiple parties. ArcBlock has native support for multi-party signatures in transactions like TransferV3Tx and AcquireAssetV3Tx (when there are multiple payers) and in most ArcBridge-related transactions, which require signatures from all validators.

Exploring Transaction Types#

Transactions are grouped by their function. The following sections provide detailed guides and code examples for each category. Choose a category to learn more about its specific transactions and how to use the client's helper methods to implement them.


Now that you have an overview of how transactions work, a great place to start is with Account Transactions, as declaring an account is often the first step in any blockchain application.