Class EthereumTransactionDataLegacy

java.lang.Object
com.hedera.hashgraph.sdk.EthereumTransactionData
com.hedera.hashgraph.sdk.EthereumTransactionDataLegacy

public class EthereumTransactionDataLegacy extends EthereumTransactionData
The ethereum transaction data, in the legacy format
  • Field Details

    • chainId

      public byte[] chainId
      ID of the chain
    • nonce

      public byte[] nonce
      Transaction's nonce
    • gasPrice

      public byte[] gasPrice
      The price for 1 gas
    • gasLimit

      public byte[] gasLimit
      The amount of gas available for the transaction
    • to

      public byte[] to
      The receiver of the transaction
    • value

      public byte[] value
      The transaction value
    • v

      public byte[] v
      The V value of the signature
    • recoveryId

      public int recoveryId
      recovery parameter used to ease the signature verification
    • r

      public byte[] r
      The R value of the signature
    • s

      public byte[] s
      The S value of the signature
  • Constructor Details

    • EthereumTransactionDataLegacy

      public EthereumTransactionDataLegacy()
      Constructor for building an unsigned legacy transaction. All fields are initialized to empty byte arrays and should be populated via the setters before signing.
    • EthereumTransactionDataLegacy

      EthereumTransactionDataLegacy(byte[] nonce, byte[] gasPrice, byte[] gasLimit, byte[] to, byte[] value, byte[] callData, byte[] v, byte[] r, byte[] s)
  • Method Details

    • fromBytes

      public static EthereumTransactionDataLegacy fromBytes(byte[] bytes)
      Convert a byte array to an ethereum transaction data.
      Parameters:
      bytes - the byte array
      Returns:
      the ethereum transaction data
    • toUnsignedRlp

      byte[] toUnsignedRlp()
      RLP-encode the unsigned payload: [nonce, gasPrice, gasLimit, to, value, callData].
    • encodeWithSignature

      byte[] encodeWithSignature()
      RLP-encode the full signed transaction: the unsigned payload plus v, r, s (no type prefix).
    • toBytes

      public byte[] toBytes()
      Description copied from class: EthereumTransactionData
      Serialize the ethereum transaction data into bytes using RLP
      Specified by:
      toBytes in class EthereumTransactionData
      Returns:
      the serialized transaction as a byte array
    • sign

      public byte[] sign(PrivateKey privateKey)
      Description copied from class: EthereumTransactionData
      Sign this transaction body with the given ECDSA private key, populating the signature fields (r, s and the recovery id / v), and return the resulting signed RLP encoding.
      Specified by:
      sign in class EthereumTransactionData
      Parameters:
      privateKey - the ECDSA secp256k1 key to sign with
      Returns:
      the signed RLP-encoded transaction
    • getNonce

      public long getNonce()
      Returns:
      the nonce as a number
    • setNonce

      public EthereumTransactionDataLegacy setNonce(long nonce)
      Parameters:
      nonce - the nonce as a number
      Returns:
      this
    • getNonceBytes

      public byte[] getNonceBytes()
      Returns:
      the raw nonce bytes
    • setNonceBytes

      public EthereumTransactionDataLegacy setNonceBytes(byte[] nonce)
      Parameters:
      nonce - the raw nonce bytes
      Returns:
      this
    • getGasPrice

      public long getGasPrice()
      Returns:
      the gas price as a number
    • setGasPrice

      public EthereumTransactionDataLegacy setGasPrice(long gasPrice)
      Parameters:
      gasPrice - the gas price as a number
      Returns:
      this
    • getGasPriceBytes

      public byte[] getGasPriceBytes()
      Returns:
      the raw gas price bytes
    • setGasPriceBytes

      public EthereumTransactionDataLegacy setGasPriceBytes(byte[] gasPrice)
      Parameters:
      gasPrice - the raw gas price bytes
      Returns:
      this
    • getGasLimit

      public long getGasLimit()
      Returns:
      the gas limit as a number
    • setGasLimit

      public EthereumTransactionDataLegacy setGasLimit(long gasLimit)
      Parameters:
      gasLimit - the gas limit as a number
      Returns:
      this
    • getGasLimitBytes

      public byte[] getGasLimitBytes()
      Returns:
      the raw gas limit bytes
    • setGasLimitBytes

      public EthereumTransactionDataLegacy setGasLimitBytes(byte[] gasLimit)
      Parameters:
      gasLimit - the raw gas limit bytes
      Returns:
      this
    • getTo

      public byte[] getTo()
      Returns:
      the receiver address
    • setTo

      public EthereumTransactionDataLegacy setTo(byte[] to)
      Parameters:
      to - the receiver address
      Returns:
      this
    • getValue

      public BigInteger getValue()
      Returns:
      the transaction value as a number
    • setValue

      public EthereumTransactionDataLegacy setValue(BigInteger value)
      Parameters:
      value - the transaction value as a number
      Returns:
      this
    • getValueBytes

      public byte[] getValueBytes()
      Returns:
      the raw transaction value bytes
    • setValueBytes

      public EthereumTransactionDataLegacy setValueBytes(byte[] value)
      Parameters:
      value - the raw transaction value bytes
      Returns:
      this
    • getCallData

      public byte[] getCallData()
      Returns:
      the call data
    • setCallData

      public EthereumTransactionDataLegacy setCallData(byte[] callData)
      Parameters:
      callData - the call data
      Returns:
      this
    • getV

      public long getV()
      Returns:
      the V value of the signature as a number
    • setV

      public EthereumTransactionDataLegacy setV(long v)
      Parameters:
      v - the V value of the signature as a number
      Returns:
      this
    • getVBytes

      public byte[] getVBytes()
      Returns:
      the raw V bytes of the signature
    • setVBytes

      public EthereumTransactionDataLegacy setVBytes(byte[] v)
      Parameters:
      v - the raw V bytes of the signature
      Returns:
      this
    • getR

      public byte[] getR()
      Returns:
      the R value of the signature
    • setR

      public EthereumTransactionDataLegacy setR(byte[] r)
      Parameters:
      r - the R value of the signature
      Returns:
      this
    • getS

      public byte[] getS()
      Returns:
      the S value of the signature
    • setS

      public EthereumTransactionDataLegacy setS(byte[] s)
      Parameters:
      s - the S value of the signature
      Returns:
      this
    • toString

      public String toString()
      Description copied from class: EthereumTransactionData
      Serialize the ethereum transaction data into a string
      Specified by:
      toString in class EthereumTransactionData
      Returns:
      the serialized transaction as a string