Fabcoin Core
0.16.2
P2P Digital Currency
|
Encodes a transaction, ready to be exported to or freshly imported from RLP. More...
#include <Transaction.h>
Public Member Functions | |
TransactionBase () | |
Constructs a null transaction. More... | |
TransactionBase (TransactionSkeleton const &_ts, Secret const &_s=Secret()) | |
Constructs a transaction from a transaction skeleton & optional secret. More... | |
TransactionBase (u256 const &_value, u256 const &_gasPrice, u256 const &_gas, Address const &_dest, bytes const &_data, u256 const &_nonce, Secret const &_secret) | |
Constructs a signed message-call transaction. More... | |
TransactionBase (u256 const &_value, u256 const &_gasPrice, u256 const &_gas, bytes const &_data, u256 const &_nonce, Secret const &_secret) | |
Constructs a signed contract-creation transaction. More... | |
TransactionBase (u256 const &_value, u256 const &_gasPrice, u256 const &_gas, Address const &_dest, bytes const &_data, u256 const &_nonce=0) | |
Constructs an unsigned message-call transaction. More... | |
TransactionBase (u256 const &_value, u256 const &_gasPrice, u256 const &_gas, bytes const &_data, u256 const &_nonce=0) | |
Constructs an unsigned contract-creation transaction. More... | |
TransactionBase (bytesConstRef _rlp, CheckTransaction _checkSig) | |
Constructs a transaction from the given RLP. More... | |
TransactionBase (bytes const &_rlp, CheckTransaction _checkSig) | |
Constructs a transaction from the given RLP. More... | |
bool | operator== (TransactionBase const &_c) const |
Checks equality of transactions. More... | |
bool | operator!= (TransactionBase const &_c) const |
Checks inequality of transactions. More... | |
Address const & | sender () const |
Address const & | safeSender () const noexcept |
Like sender() but will never throw. More... | |
void | forceSender (Address const &_a) |
Force the sender to a particular value. This will result in an invalid transaction RLP. More... | |
void | checkLowS () const |
void | checkChainId (int chainId=-4) const |
operator bool () const | |
bool | isCreation () const |
void | streamRLP (RLPStream &_s, IncludeSignature _sig=WithSignature, bool _forEip155hash=false) const |
Serialises this transaction to an RLPStream. More... | |
bytes | rlp (IncludeSignature _sig=WithSignature) const |
h256 | sha3 (IncludeSignature _sig=WithSignature) const |
u256 | value () const |
u256 | gasPrice () const |
u256 | gas () const |
Address | receiveAddress () const |
Address | to () const |
Synonym for receiveAddress(). More... | |
Address | from () const |
Synonym for safeSender(). More... | |
bytes const & | data () const |
u256 | nonce () const |
void | setNonce (u256 const &_n) |
Sets the nonce to the given value. Clears any signature. More... | |
void | clearSignature () |
Clears the signature. More... | |
SignatureStruct const & | signature () const |
void | sign (Secret const &_priv) |
Sign the transaction. More... | |
int64_t | baseGasRequired (EVMSchedule const &_es) const |
Static Public Member Functions | |
static int64_t | baseGasRequired (bool _contractCreation, bytesConstRef _data, EVMSchedule const &_es) |
Get the fee associated for a transaction with the given data. More... | |
Protected Types | |
enum | Type { NullTransaction, ContractCreation, MessageCall } |
Type of transaction. More... | |
Protected Attributes | |
Type | m_type = NullTransaction |
Is this a contract-creation transaction or a message-call transaction? More... | |
u256 | m_nonce |
The transaction-count of the sender. More... | |
u256 | m_value |
The amount of ETH to be transferred by this transaction. Called 'endowment' for contract-creation transactions. More... | |
Address | m_receiveAddress |
The receiving address of the transaction. More... | |
u256 | m_gasPrice |
The base fee and thus the implied exchange rate of ETH to GAS. More... | |
u256 | m_gas |
The total gas to convert, paid for from sender's account. Any unused gas gets refunded once the contract is ended. More... | |
bytes | m_data |
The data associated with the transaction, or the initialiser if it's a creation transaction. More... | |
SignatureStruct | m_vrs |
The signature of the transaction. Encodes the sender. More... | |
int | m_chainId = -4 |
EIP155 value for calculating transaction hash https://github.com/ethereum/EIPs/issues/155. More... | |
h256 | m_hashWith |
Cached hash of transaction with signature. More... | |
Address | m_sender |
Cached sender, determined from signature. More... | |
Encodes a transaction, ready to be exported to or freshly imported from RLP.
Definition at line 50 of file Transaction.h.
|
protected |
Type of transaction.
Enumerator | |
---|---|
NullTransaction |
Null transaction. |
ContractCreation |
Transaction to create contracts - receiveAddress() is ignored. |
MessageCall |
Transaction to invoke a message call - receiveAddress() is used. |
Definition at line 155 of file Transaction.h.
|
inline |
Constructs a null transaction.
Definition at line 54 of file Transaction.h.
TransactionBase::TransactionBase | ( | TransactionSkeleton const & | _ts, |
Secret const & | _s = Secret() |
||
) |
Constructs a transaction from a transaction skeleton & optional secret.
Definition at line 34 of file Transaction.cpp.
|
inline |
Constructs a signed message-call transaction.
Definition at line 60 of file Transaction.h.
|
inline |
Constructs a signed contract-creation transaction.
Definition at line 63 of file Transaction.h.
|
inline |
Constructs an unsigned message-call transaction.
Definition at line 66 of file Transaction.h.
|
inline |
Constructs an unsigned contract-creation transaction.
Definition at line 69 of file Transaction.h.
|
explicit |
Constructs a transaction from the given RLP.
Definition at line 48 of file Transaction.cpp.
|
inlineexplicit |
Constructs a transaction from the given RLP.
Definition at line 75 of file Transaction.h.
|
inline |
Definition at line 148 of file Transaction.h.
|
static |
Get the fee associated for a transaction with the given data.
Definition at line 166 of file Transaction.cpp.
void TransactionBase::checkChainId | ( | int | chainId = -4 | ) | const |
InvalidSValue | if the chain id is neither -4 nor equal to chainId Note that "-4" is the chain ID of the pre-155 rules, which should also be considered valid after EIP155 |
Definition at line 160 of file Transaction.cpp.
void TransactionBase::checkLowS | ( | ) | const |
InvalidSValue | if the signature has an invalid S value. |
Definition at line 154 of file Transaction.cpp.
|
inline |
Clears the signature.
Definition at line 140 of file Transaction.h.
|
inline |
Definition at line 131 of file Transaction.h.
|
inline |
Force the sender to a particular value. This will result in an invalid transaction RLP.
Definition at line 87 of file Transaction.h.
|
inline |
Synonym for safeSender().
Definition at line 128 of file Transaction.h.
|
inline |
Definition at line 119 of file Transaction.h.
|
inline |
Definition at line 116 of file Transaction.h.
|
inline |
Definition at line 101 of file Transaction.h.
|
inline |
Definition at line 134 of file Transaction.h.
|
inlineexplicit |
Definition at line 98 of file Transaction.h.
|
inline |
Checks inequality of transactions.
Definition at line 80 of file Transaction.h.
|
inline |
Checks equality of transactions.
Definition at line 78 of file Transaction.h.
|
inline |
Definition at line 122 of file Transaction.h.
|
inline |
Definition at line 107 of file Transaction.h.
|
noexcept |
Like sender() but will never throw.
Definition at line 98 of file Transaction.cpp.
Address const & TransactionBase::sender | ( | ) | const |
Definition at line 110 of file Transaction.cpp.
|
inline |
Sets the nonce to the given value. Clears any signature.
Definition at line 137 of file Transaction.h.
h256 TransactionBase::sha3 | ( | IncludeSignature | _sig = WithSignature | ) | const |
Definition at line 178 of file Transaction.cpp.
void TransactionBase::sign | ( | Secret const & | _priv | ) |
Sign the transaction.
Definition at line 122 of file Transaction.cpp.
|
inline |
Definition at line 143 of file Transaction.h.
void TransactionBase::streamRLP | ( | RLPStream & | _s, |
IncludeSignature | _sig = WithSignature , |
||
bool | _forEip155hash = false |
||
) | const |
Serialises this transaction to an RLPStream.
Definition at line 130 of file Transaction.cpp.
|
inline |
Synonym for receiveAddress().
Definition at line 125 of file Transaction.h.
|
inline |
Definition at line 113 of file Transaction.h.
|
protected |
EIP155 value for calculating transaction hash https://github.com/ethereum/EIPs/issues/155.
Definition at line 170 of file Transaction.h.
|
protected |
The data associated with the transaction, or the initialiser if it's a creation transaction.
Definition at line 168 of file Transaction.h.
|
protected |
The total gas to convert, paid for from sender's account. Any unused gas gets refunded once the contract is ended.
Definition at line 167 of file Transaction.h.
|
protected |
The base fee and thus the implied exchange rate of ETH to GAS.
Definition at line 166 of file Transaction.h.
|
mutableprotected |
Cached hash of transaction with signature.
Definition at line 172 of file Transaction.h.
|
protected |
The transaction-count of the sender.
Definition at line 163 of file Transaction.h.
|
protected |
The receiving address of the transaction.
Definition at line 165 of file Transaction.h.
|
mutableprotected |
Cached sender, determined from signature.
Definition at line 173 of file Transaction.h.
|
protected |
Is this a contract-creation transaction or a message-call transaction?
Definition at line 162 of file Transaction.h.
|
protected |
The amount of ETH to be transferred by this transaction. Called 'endowment' for contract-creation transactions.
Definition at line 164 of file Transaction.h.
|
protected |
The signature of the transaction. Encodes the sender.
Definition at line 169 of file Transaction.h.