Skip to main content

8.6 Transactions

Transactions are what make the state change from the current state to the next state. In Xiden, we have three types of transactions:

  1. Transactions that transfer value between two EOAs (e.g, change the sender and receiver account balances)

  2. Transactions that send a message call to a contract (e.g, set a value in the smart contract by sending a message call that executes a setter method)

  3. Transactions that deploy a contract (therefore, create an account, the contract account)

These are the fields of a transaction:

  • nonce - Number of transactions sent by the account that created the transaction
  • gasPrice - The value that will be paid per unit of gas for the computation costs of executing this transaction
  • gasLimit - Maximum amount of gas to be used while executing this transaction
  • to
    • If this transaction is transferring Xden, the address of the EOA account that will receive a value transfer
    • If this transaction is sending a message to a contract (e.g, calling a method in the smart contract), this is address of the contract
    • If this transaction is creating a contract, this value is always empty
  • value
    • If this transaction is transferring Xden, the amount that will be transferred to the recipient account
    • If this transaction is sending a message to a contract, the amount payable by the smart contract receiving the message
    • If this transaction is creating a contract, this is the amount that will be added to the balance of the created contract
  • v, r, s - Values used in the cryptographic signature of the transaction used to determine the sender of the transaction
  • data (only for value transfer and sending a message call to a smart contract) -Input data of the message call ( e.g, imagine you are trying to execute a setter method in your smart contract, the data field would contain the identifier of the setter method, and the value that should be passed as a parameter)
  • init (only for contract creation) - The EVM-code utilized for initialization of the contract.