Skip to main content

Transaction Structure

Definition​

Transaction is the main way of interaction between a user and a blockchain. Transaction contains:

  • Signer account ID
  • Receiver account ID
  • Actions

SignedTransactionView​

Transaction might be unsigned but from the indexer perspective when we think about Transaction we think about signed one

pub struct SignedTransactionView {
pub signer_id: AccountId,
pub public_key: PublicKey,
pub nonce: Nonce,
pub receiver_id: AccountId,
pub actions: Vec<ActionView>,
pub signature: Signature,
pub hash: CryptoHash,
}

ActionView​

ActionView is an Enum with possible actions along with parameters. This structure is used in Transactions and in Receipts

pub enum ActionView {
CreateAccount,
DeployContract {
code: String,
},
FunctionCall {
method_name: String,
args: String,
gas: Gas,
#[serde(with = "u128_dec_format")]
deposit: Balance,
},
Transfer {
#[serde(with = "u128_dec_format")]
deposit: Balance,
},
Stake {
#[serde(with = "u128_dec_format")]
stake: Balance,
public_key: PublicKey,
},
AddKey {
public_key: PublicKey,
access_key: AccessKeyView,
},
DeleteKey {
public_key: PublicKey,
},
DeleteAccount {
beneficiary_id: AccountId,
},
}
Was this page helpful?