Module com.hedera.hashgraph.sdk
Package com.hedera.hashgraph.sdk
Class EthereumTransactionDataLegacy
java.lang.Object
com.hedera.hashgraph.sdk.EthereumTransactionData
com.hedera.hashgraph.sdk.EthereumTransactionDataLegacy
The ethereum transaction data, in the legacy format
-
Nested Class Summary
Nested classes/interfaces inherited from class com.hedera.hashgraph.sdk.EthereumTransactionData
EthereumTransactionData.SignatureData -
Field Summary
FieldsModifier and TypeFieldDescriptionbyte[]ID of the chainbyte[]The amount of gas available for the transactionbyte[]The price for 1 gasbyte[]Transaction's noncebyte[]The R value of the signatureintrecovery parameter used to ease the signature verificationbyte[]The S value of the signaturebyte[]The receiver of the transactionbyte[]The V value of the signaturebyte[]The transaction valueFields inherited from class com.hedera.hashgraph.sdk.EthereumTransactionData
callData -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for building an unsigned legacy transaction.EthereumTransactionDataLegacy(byte[] nonce, byte[] gasPrice, byte[] gasLimit, byte[] to, byte[] value, byte[] callData, byte[] v, byte[] r, byte[] s) -
Method Summary
Modifier and TypeMethodDescription(package private) byte[]RLP-encode the full signed transaction: the unsigned payload plusv, r, s(no type prefix).fromBytes(byte[] bytes) Convert a byte array to an ethereum transaction data.byte[]longbyte[]longbyte[]longgetNonce()byte[]byte[]getR()byte[]getS()byte[]getTo()longgetV()getValue()byte[]byte[]setCallData(byte[] callData) setGasLimit(long gasLimit) setGasLimitBytes(byte[] gasLimit) setGasPrice(long gasPrice) setGasPriceBytes(byte[] gasPrice) setNonce(long nonce) setNonceBytes(byte[] nonce) setR(byte[] r) setS(byte[] s) setTo(byte[] to) setV(long v) setValue(BigInteger value) setValueBytes(byte[] value) setVBytes(byte[] v) 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.byte[]toBytes()Serialize the ethereum transaction data into bytes using RLPtoString()Serialize the ethereum transaction data into a string(package private) byte[]RLP-encode the unsigned payload:[nonce, gasPrice, gasLimit, to, value, callData].Methods inherited from class com.hedera.hashgraph.sdk.EthereumTransactionData
ethereumBodyIsSigned, signMessage, signTypedTransaction
-
Field Details
-
chainId
public byte[] chainIdID of the chain -
nonce
public byte[] nonceTransaction's nonce -
gasPrice
public byte[] gasPriceThe price for 1 gas -
gasLimit
public byte[] gasLimitThe amount of gas available for the transaction -
to
public byte[] toThe receiver of the transaction -
value
public byte[] valueThe transaction value -
v
public byte[] vThe V value of the signature -
recoveryId
public int recoveryIdrecovery parameter used to ease the signature verification -
r
public byte[] rThe R value of the signature -
s
public byte[] sThe 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
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 plusv, r, s(no type prefix). -
toBytes
public byte[] toBytes()Description copied from class:EthereumTransactionDataSerialize the ethereum transaction data into bytes using RLP- Specified by:
toBytesin classEthereumTransactionData- Returns:
- the serialized transaction as a byte array
-
sign
Description copied from class:EthereumTransactionDataSign 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:
signin classEthereumTransactionData- 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
- Parameters:
nonce- the nonce as a number- Returns:
this
-
getNonceBytes
public byte[] getNonceBytes()- Returns:
- the raw nonce bytes
-
setNonceBytes
- Parameters:
nonce- the raw nonce bytes- Returns:
this
-
getGasPrice
public long getGasPrice()- Returns:
- the gas price as a number
-
setGasPrice
- Parameters:
gasPrice- the gas price as a number- Returns:
this
-
getGasPriceBytes
public byte[] getGasPriceBytes()- Returns:
- the raw gas price bytes
-
setGasPriceBytes
- Parameters:
gasPrice- the raw gas price bytes- Returns:
this
-
getGasLimit
public long getGasLimit()- Returns:
- the gas limit as a number
-
setGasLimit
- Parameters:
gasLimit- the gas limit as a number- Returns:
this
-
getGasLimitBytes
public byte[] getGasLimitBytes()- Returns:
- the raw gas limit bytes
-
setGasLimitBytes
- Parameters:
gasLimit- the raw gas limit bytes- Returns:
this
-
getTo
public byte[] getTo()- Returns:
- the receiver address
-
setTo
- Parameters:
to- the receiver address- Returns:
this
-
getValue
- Returns:
- the transaction value as a number
-
setValue
- Parameters:
value- the transaction value as a number- Returns:
this
-
getValueBytes
public byte[] getValueBytes()- Returns:
- the raw transaction value bytes
-
setValueBytes
- Parameters:
value- the raw transaction value bytes- Returns:
this
-
getCallData
public byte[] getCallData()- Returns:
- the call data
-
setCallData
- Parameters:
callData- the call data- Returns:
this
-
getV
public long getV()- Returns:
- the V value of the signature as a number
-
setV
- 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
- Parameters:
v- the raw V bytes of the signature- Returns:
this
-
getR
public byte[] getR()- Returns:
- the R value of the signature
-
setR
- Parameters:
r- the R value of the signature- Returns:
this
-
getS
public byte[] getS()- Returns:
- the S value of the signature
-
setS
- Parameters:
s- the S value of the signature- Returns:
this
-
toString
Description copied from class:EthereumTransactionDataSerialize the ethereum transaction data into a string- Specified by:
toStringin classEthereumTransactionData- Returns:
- the serialized transaction as a string
-