Module com.hedera.hashgraph.sdk
Package com.hedera.hashgraph.sdk
Class EthereumTransactionDataEip2930
java.lang.Object
com.hedera.hashgraph.sdk.EthereumTransactionData
com.hedera.hashgraph.sdk.EthereumTransactionDataEip2930
The ethereum transaction data, in the format defined in EIP-2930 (access list transactions).
-
Nested Class Summary
Nested classes/interfaces inherited from class com.hedera.hashgraph.sdk.EthereumTransactionData
EthereumTransactionData.SignatureData -
Field Summary
FieldsModifier and TypeFieldDescriptionbyte[]specifies an array of addresses and storage keys that the transaction plans to accessbyte[]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 signaturebyte[]recovery parameter used to ease the signature verificationbyte[]The S value of the signaturebyte[]The receiver of the transaction(package private) static final intThe EIP-2718 transaction type prefix.byte[]The transaction valueFields inherited from class com.hedera.hashgraph.sdk.EthereumTransactionData
callData -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for building an unsigned EIP-2930 transaction.EthereumTransactionDataEip2930(byte[] chainId, byte[] nonce, byte[] gasPrice, byte[] gasLimit, byte[] to, byte[] value, byte[] callData, byte[] accessList, byte[] recoveryId, byte[] r, byte[] s) -
Method Summary
Modifier and TypeMethodDescriptionaddAccessListItem(AccessListItem accessListItem) Append a single access list item.fromBytes(byte[] bytes) Convert a byte array to an ethereum transaction data.byte[]longbyte[]longbyte[]longbyte[]longgetNonce()byte[]byte[]getR()longbyte[]byte[]getS()byte[]getTo()getValue()byte[]setAccessListItems(List<AccessListItem> accessListItems) setCallData(byte[] callData) setChainId(long chainId) setChainIdBytes(byte[] chainId) setGasLimit(long gasLimit) setGasLimitBytes(byte[] gasLimit) setGasPrice(long gasPrice) setGasPriceBytes(byte[] gasPrice) setNonce(long nonce) setNonceBytes(byte[] nonce) setR(byte[] r) setRecoveryId(long recoveryId) setRecoveryIdBytes(byte[] recoveryId) setS(byte[] s) setTo(byte[] to) setValue(BigInteger value) setValueBytes(byte[] value) 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 (8 fields through the access list).Methods inherited from class com.hedera.hashgraph.sdk.EthereumTransactionData
ethereumBodyIsSigned, signMessage, signTypedTransaction
-
Field Details
-
TYPE_BYTE
static final int TYPE_BYTEThe EIP-2718 transaction type prefix.- See Also:
-
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 -
accessList
public byte[] accessListspecifies an array of addresses and storage keys that the transaction plans to access -
recoveryId
public byte[] 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
-
EthereumTransactionDataEip2930
public EthereumTransactionDataEip2930()Constructor for building an unsigned EIP-2930 transaction. All fields are initialized to empty byte arrays and should be populated via the setters before signing. -
EthereumTransactionDataEip2930
EthereumTransactionDataEip2930(byte[] chainId, byte[] nonce, byte[] gasPrice, byte[] gasLimit, byte[] to, byte[] value, byte[] callData, byte[] accessList, byte[] recoveryId, 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 (8 fields through the access list). -
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
-
getChainId
public long getChainId()- Returns:
- the chain id as a number
-
setChainId
- Parameters:
chainId- the chain id as a number- Returns:
this
-
getChainIdBytes
public byte[] getChainIdBytes()- Returns:
- the raw chain id bytes
-
setChainIdBytes
- Parameters:
chainId- the raw chain id bytes- Returns:
this
-
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
-
getAccessListItems
- Returns:
- the access list items
-
setAccessListItems
- Parameters:
accessListItems- the access list items (encoded into theaccessListbytes)- Returns:
this
-
addAccessListItem
Append a single access list item.- Parameters:
accessListItem- the item to add- Returns:
this
-
getRecoveryId
public long getRecoveryId()- Returns:
- the recovery id as a number
-
setRecoveryId
- Parameters:
recoveryId- the recovery id as a number- Returns:
this
-
getRecoveryIdBytes
public byte[] getRecoveryIdBytes()- Returns:
- the raw recovery id bytes
-
setRecoveryIdBytes
- Parameters:
recoveryId- the raw recovery id bytes- 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
-