Interface Transaction


  • public interface Transaction
    A transaction is a single cryptographically-signed instruction constructed by an actor externally to the scope of Ethereum. While it is assumed that the ultimate external actor will be human in nature, software tools will be used in its construction and dissemination.

    There are two types of transactions: those which result in message calls and those which result in the creation of new accounts with associated code (known informally as ‘contract creation’). Message call transactions will have an address present in the getTo() method whereas contract creation transactions will not.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.Optional<java.math.BigInteger> getChainId()
      The chainId, computed from the 'V' portion of the signature.
      java.util.Optional<? extends UnformattedData> getData()
      An unlimited size byte array specifying theinput data of the message call.
      long getGasLimit()
      A scalar value equal to the maximum amount of gas that should be used in executing this transaction.
      Quantity getGasPrice()
      A scalar value equal to the number of Wei to be paid per unit of gas for all computation costs incurred as a result of the execution of this transaction.
      Hash getHash()
      The Keccak 256-bit hash of this transaction.
      java.util.Optional<? extends UnformattedData> getInit()
      An unlimited size byte array specifying the EVM-code for the account // initialisation procedure.
      long getNonce()
      A scalar value equal to the number of transactions sent by the sender.
      UnformattedData getPayload()
      The data payload of this transaction.
      java.math.BigInteger getR()
      Value corresponding to the 'V' component of the signature of the transaction.
      java.math.BigInteger getS()
      Value corresponding to the 'V' component of the signature of the transaction.
      Address getSender()
      The 160-bit address of the account sending the transaction, extracted from the v, r, s parameters.
      java.util.Optional<? extends Address> getTo()
      The 160-bit address of the message call’s recipient.
      java.math.BigInteger getV()
      Value corresponding to the 'V' component of the signature of the transaction.
      Quantity getValue()
      A scalar value equal to the number of Wei to be transferred to the message call’s recipient or, in the case of contract creation, as an endowment to the newly created account
    • Method Detail

      • getHash

        Hash getHash()
        The Keccak 256-bit hash of this transaction.
        Returns:
        The Keccak 256-bit hash of this transaction.
      • getNonce

        long getNonce()
        A scalar value equal to the number of transactions sent by the sender.
        Returns:
        the number of transactions sent by the sender.
      • getGasPrice

        Quantity getGasPrice()
        A scalar value equal to the number of Wei to be paid per unit of gas for all computation costs incurred as a result of the execution of this transaction.
        Returns:
        the quantity of Wei per gas unit paid.
      • getGasLimit

        long getGasLimit()
        A scalar value equal to the maximum amount of gas that should be used in executing this transaction. This is paid up-front, before any computation is done and may not be increased later.
        Returns:
        the maximum amount of gas that should be used in executing this * transaction.
      • getTo

        java.util.Optional<? extends Address> getTo()
        The 160-bit address of the message call’s recipient. For a contract creation transaction this address will not be present.
        Returns:
        address of the recipient
      • getValue

        Quantity getValue()
        A scalar value equal to the number of Wei to be transferred to the message call’s recipient or, in the case of contract creation, as an endowment to the newly created account
        Returns:
        value equal to the number of Wei to be transferred
      • getV

        java.math.BigInteger getV()
        Value corresponding to the 'V' component of the signature of the transaction.
        Returns:
        the 'V' component of the signature
      • getR

        java.math.BigInteger getR()
        Value corresponding to the 'V' component of the signature of the transaction.
        Returns:
        the 'V' component of the signature
      • getS

        java.math.BigInteger getS()
        Value corresponding to the 'V' component of the signature of the transaction.
        Returns:
        the 'V' component of the signature
      • getSender

        Address getSender()
        The 160-bit address of the account sending the transaction, extracted from the v, r, s parameters.
        Returns:
        The address of the account that sent this transaction.
      • getChainId

        java.util.Optional<java.math.BigInteger> getChainId()
        The chainId, computed from the 'V' portion of the signature. Used for replay protection. If replay protection is not enabled this value will not be present.
        Returns:
        The chainId for transaction.
      • getInit

        java.util.Optional<? extends UnformattedData> getInit()
        An unlimited size byte array specifying the EVM-code for the account // initialisation procedure.

        Only present if this is a contract creation transaction, which is only true if getTo() is empty.

        Returns:
        if present, the contract init code.
      • getData

        java.util.Optional<? extends UnformattedData> getData()
        An unlimited size byte array specifying theinput data of the message call.

        Only present if this is a message call transaction, which is only true if getTo() is present.

        Returns:
        if present, the message call data
      • getPayload

        UnformattedData getPayload()
        The data payload of this transaction.

        If this transaction is a message-call to an account (the getTo() field is present), this same value will be exposed by getData(). If instead this is a contract-creation transaction (the getTo() field is absent), the payload is also exposed by getInit().

        Returns:
        the transaction payload