 |
Ethereum
PoC-8
The C++ Implementation of Ethereum
|
Go to the documentation of this file.
25 #include <boost/optional.hpp>
59 TransactionBase(
u256 const& _value,
u256 const& _gasPrice,
u256 const& _gas,
Address const& _dest,
bytes const& _data,
u256 const& _nonce,
Secret const& _secret):
m_type(
MessageCall),
m_nonce(_nonce),
m_value(_value),
m_receiveAddress(_dest),
m_gasPrice(_gasPrice),
m_gas(_gas),
m_data(_data) {
sign(_secret); }
62 TransactionBase(
u256 const& _value,
u256 const& _gasPrice,
u256 const& _gas,
bytes const& _data,
u256 const& _nonce,
Secret const& _secret):
m_type(
ContractCreation),
m_nonce(_nonce),
m_value(_value),
m_gasPrice(_gasPrice),
m_gas(_gas),
m_data(_data) {
sign(_secret); }
65 TransactionBase(
u256 const& _value,
u256 const& _gasPrice,
u256 const& _gas,
Address const& _dest,
bytes const& _data,
u256 const& _nonce = 0):
m_type(
MessageCall),
m_nonce(_nonce),
m_value(_value),
m_receiveAddress(_dest),
m_gasPrice(_gasPrice),
m_gas(_gas),
m_data(_data) {}
183 boost::optional<SignatureStruct>
m_vrs;
202 _out <<
"/" << _t.
data().size() <<
"$" << _t.
value() <<
"+" << _t.
gas() <<
"@" << _t.
gasPrice();
TransactionBase(u256 const &_value, u256 const &_gasPrice, u256 const &_gas, bytes const &_data, u256 const &_nonce=0)
Constructs an unsigned contract-creation transaction.
TransactionBase(bytes const &_rlp, CheckTransaction _checkSig)
Constructs a transaction from the given RLP.
@ WithoutSignature
Do not include a signature.
Address receiveAddress() const
u256 m_gasPrice
The base fee and thus the implied exchange rate of ETH to GAS.
bytes rlp(IncludeSignature _sig=WithSignature) const
int m_chainId
EIP155 value for calculating transaction hash https://github.com/ethereum/EIPs/issues/155.
u256 m_gas
The total gas to convert, paid for from sender's account. Any unused gas gets refunded once the contr...
TransactionBase()
Constructs a null transaction.
Encodes a transaction, ready to be exported to or freshly imported from RLP.
bytes const & out() const
Read the byte stream.
static bool isZeroSignature(u256 const &_r, u256 const &_s)
Address from() const
Synonym for safeSender().
void setNonce(u256 const &_n)
Sets the nonce to the given value. Clears any signature.
boost::optional< Address > m_sender
Cached sender, determined from signature.
bytes m_data
The data associated with the transaction, or the initialiser if it's a creation transaction.
bool isReplayProtected() const
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.
IncludeSignature
Named-boolean type to encode whether a signature be included in the serialisation process.
u256 m_nonce
The transaction-count of the sender.
bool hasSignature() const
h256 m_hashWith
Cached hash of transaction with signature.
@ WithSignature
Do include a signature.
boost::optional< SignatureStruct > m_vrs
The signature of the transaction. Encodes the sender.
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.
bool hasZeroSignature() const
Address const & safeSender() const noexcept
Like sender() but will never throw.
std::vector< byte > bytes
std::string abridged() const
@ NullTransaction
Null transaction.
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.
void clearSignature()
Clears the signature.
h256 sha3(IncludeSignature _sig=WithSignature) const
@ MessageCall
Transaction to invoke a message call - receiveAddress() is used.
u256 m_value
The amount of ETH to be transferred by this transaction. Called 'endowment' for contract-creation tra...
int64_t baseGasRequired(EVMSchedule const &_es) const
bool operator==(TransactionBase const &_c) const
Checks equality of transactions.
void sign(Secret const &_priv)
Sign the transaction.
Class for writing to an RLP bytestream.
std::vector< TransactionBase > TransactionBases
Nice name for vector of Transaction.
void checkChainId(int chainId=-4) const
bool operator!=(TransactionBase const &_c) const
Checks inequality of transactions.
Address to() const
Synonym for receiveAddress().
Address const & sender() const
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > > u256
std::ostream & operator<<(std::ostream &_out, BlockHeader const &_bi)
bytes const & data() const
SecureFixedHash< 32 > Secret
Address m_receiveAddress
The receiving address of the transaction.
void forceSender(Address const &_a)
Force the sender to a particular value. This will result in an invalid transaction RLP.
void streamRLP(RLPStream &_s, IncludeSignature _sig=WithSignature, bool _forEip155hash=false) const
Type m_type
Is this a contract-creation transaction or a message-call transaction?
@ ContractCreation
Transaction to create contracts - receiveAddress() is ignored.
SignatureStruct const & signature() const