java.lang.Object
com.hedera.hashgraph.sdk.EthereumTransactionData
- Direct Known Subclasses:
EthereumTransactionDataEip1559,EthereumTransactionDataEip2930,EthereumTransactionDataLegacy
This class represents the data of an Ethereum transaction.
It may be of subclass EthereumTransactionDataLegacy, EthereumTransactionDataEip2930 or
EthereumTransactionDataEip1559.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final classThe result of signing a transaction: therandssignature components and the recovery id. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static boolean(package private) static EthereumTransactionDatafromBytes(byte[] bytes) abstract byte[]sign(PrivateKey privateKey) 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.(package private) static EthereumTransactionData.SignatureDatasignMessage(byte[] message, PrivateKey privateKey) Sign a raw message (already keccak256-able) with an ECDSA key and extract the r/s/recoveryId components.(package private) static EthereumTransactionData.SignatureDatasignTypedTransaction(byte[] unsignedListRlp, int typePrefix, PrivateKey privateKey) Sign a typed (non-legacy) Ethereum transaction.abstract byte[]toBytes()Serialize the ethereum transaction data into bytes using RLPabstract StringtoString()Serialize the ethereum transaction data into a string
-
Field Details
-
callData
public byte[] callDataThe raw call data.
-
-
Constructor Details
-
EthereumTransactionData
EthereumTransactionData(byte[] callData)
-
-
Method Details
-
fromBytes
-
toBytes
public abstract byte[] toBytes()Serialize the ethereum transaction data into bytes using RLP- Returns:
- the serialized transaction as a byte array
-
sign
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.- Parameters:
privateKey- the ECDSA secp256k1 key to sign with- Returns:
- the signed RLP-encoded transaction
-
toString
Serialize the ethereum transaction data into a string -
signTypedTransaction
static EthereumTransactionData.SignatureData signTypedTransaction(byte[] unsignedListRlp, int typePrefix, PrivateKey privateKey) Sign a typed (non-legacy) Ethereum transaction. The message that is signed is the type prefix byte concatenated with the RLP-encoded unsigned payload list.PrivateKeyECDSA.sign(byte[])applies keccak256 internally, so the raw message is passed without pre-hashing.- Parameters:
unsignedListRlp- the RLP encoding of the unsigned payload list (without the type prefix)typePrefix- the EIP transaction type prefix byteprivateKey- the ECDSA key- Returns:
- the r/s/recoveryId signature components
-
signMessage
Sign a raw message (already keccak256-able) with an ECDSA key and extract the r/s/recoveryId components.- Parameters:
message- the message to signprivateKey- the ECDSA key- Returns:
- the r/s/recoveryId signature components
-
ethereumBodyIsSigned
- Parameters:
body- an ethereum transaction body- Returns:
- whether the body carries a non-empty signature (both r and s present)
-