Skip to main content

Transactions

Transactions is a library with utilities to encode, decode and sign Ethereum transactions.

Functions​

encodeRLP​

Encode a EIP-155 transaction in RLP.

Input:

  • txStruct (EIP155): Is the transaction structure.

Output:

  • output (bytes): The encoded RLP bytes.

encodeRLP​

Encode a EIP-1559 request transaction in RLP.

Input:

Output:

  • output (bytes): The encoded RLP bytes.

encodeRLP​

Encode a EIP-1559 transaction in RLP.

Input:

  • txStruct (EIP1559): Is the transaction structure.

Output:

  • output (bytes): The encoded RLP bytes.

encodeRLP​

Encode a EIP-1559 request transaction in RLP.

Input:

Output:

  • output (bytes): The encoded RLP bytes.

decodeRLP_EIP155​

Decode a EIP-155 transaction from RLP.

Input:

  • rlp (bytes): Is the encoded RLP bytes.

Output:

  • txStruct (EIP155): The transaction structure.

decodeRLP_EIP155Request​

Decode a EIP-155 request transaction from RLP.

Input:

  • rlp (bytes): Is the encoded RLP bytes.

Output:

decodeRLP_EIP1559​

Decode a EIP-1559 transaction from RLP.

Input:

  • rlp (bytes): Is the encoded RLP bytes.

Output:

  • txStruct (EIP1559): The transaction structure.

decodeRLP_EIP1559Request​

Decode a EIP-1559 request transaction from RLP.

Input:

  • rlp (bytes): Is the encoded RLP bytes.

Output:

signTxn​

Sign a EIP-155 transaction request.

Input:

  • request (EIP1559Request): Is the transaction request.

  • signingKey (string): Is the private key to sign the transaction.

Output:

  • response (EIP1559): The signed transaction.

signTxn​

Sign a EIP-155 transaction request.

Input:

  • request (EIP155Request): Is the transaction request.

  • signingKey (string): Is the private key to sign the transaction.

Output:

  • response (EIP155): The signed transaction.

Structs​

EIP155​

EIP-155 transaction structure.

  • to (address): Is the target address.
  • gas (uint256): Is the gas limit.
  • gasPrice (uint256): Is the gas price.
  • value (uint256): Is the transfer value in gwei.
  • nonce (uint256): Is the latest nonce of the sender.
  • data (bytes): Is the transaction data.
  • chainId (uint256): Is the id of the chain where the transaction will be executed.
  • r (bytes32): Is the 'r' signature value.
  • s (bytes32): Is the 's' signature value.
  • v (uint256): Is the 'v' signature value.

EIP155Request​

EIP-155 transaction request structure.

  • to (address): Is the target address.
  • gas (uint256): Is the gas limit.
  • gasPrice (uint256): Is the gas price.
  • value (uint256): Is the transfer value in gwei.
  • nonce (uint256): Is the latest nonce of the sender.
  • data (bytes): Is the transaction data.
  • chainId (uint256): Is the id of the chain where the transaction will be executed.

EIP1559​

EIP-1559 transaction structure.

  • to (address): Is the target address.
  • gas (uint256): Is the gas limit.
  • maxFeePerGas (uint256): Is the maximum fee per gas.
  • maxPriorityFeePerGas (uint256): Is the maximum priority fee per gas.
  • value (uint256): Is the transfer value in gwei.
  • nonce (uint256): Is the latest nonce of the sender.
  • data (bytes): Is the transaction data.
  • chainId (uint256): Is the id of the chain where the transaction will be executed.
  • accessList (bytes): Is the access list.
  • r (bytes32): Is the 'r' signature value.
  • s (bytes32): Is the 's' signature value.
  • v (uint256): Is the 'v' signature value.

EIP1559Request​

EIP-1559 transaction request structure.

  • to (address): Is the target address.
  • gas (uint256): Is the gas limit.
  • maxFeePerGas (uint256): Is the maximum fee per gas.
  • maxPriorityFeePerGas (uint256): Is the maximum priority fee per gas.
  • value (uint256): Is the transfer value in gwei.
  • nonce (uint256): Is the latest nonce of the sender.
  • data (bytes): Is the transaction data.
  • chainId (uint256): Is the id of the chain where the transaction will be executed.
  • accessList (bytes): Is the access list.