 |
Ethereum
PoC-8
The C++ Implementation of Ethereum
|
Go to the documentation of this file.
34 m_type(_ts.creation ? ContractCreation : MessageCall),
37 m_receiveAddress(_ts.to),
38 m_gasPrice(_ts.gasPrice),
53 BOOST_THROW_EXCEPTION(InvalidTransactionFormat() <<
errinfo_comment(
"transaction RLP must be a list"));
63 BOOST_THROW_EXCEPTION(InvalidTransactionFormat() <<
errinfo_comment(
"transaction data RLP must be an array"));
67 int const v =
rlp[6].toInt<
int>();
80 else if (v == 27 || v == 28)
94 if (
rlp.itemCount() > 9)
95 BOOST_THROW_EXCEPTION(InvalidTransactionFormat() <<
errinfo_comment(
"too many fields in the transaction RLP"));
125 BOOST_THROW_EXCEPTION(TransactionIsUnsigned());
139 BOOST_THROW_EXCEPTION(TransactionIsUnsigned());
157 _s.
appendList((_sig || _forEip155hash ? 3 : 0) + 6);
168 BOOST_THROW_EXCEPTION(TransactionIsUnsigned());
175 _s << (
m_vrs->v + vOffset);
179 else if (_forEip155hash)
183 static const u256 c_secp256k1n(
"115792089237316195423570985008687907852837564279074904382605163141518161494337");
188 BOOST_THROW_EXCEPTION(TransactionIsUnsigned());
190 if (
m_vrs->s > c_secp256k1n / 2)
Address const MaxAddress
The last address.
@ WithoutSignature
Do not include a signature.
u256 m_gasPrice
The base fee and thus the implied exchange rate of ETH to GAS.
bytes rlp(IncludeSignature _sig=WithSignature) const
bool sha3(bytesConstRef _input, bytesRef o_output) noexcept
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...
unsigned txDataNonZeroGas
TransactionBase()
Constructs a null transaction.
bytes const & out() const
Read the byte stream.
static bool isZeroSignature(u256 const &_r, u256 const &_s)
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.
std::string toString(std::chrono::time_point< T > const &_e, std::string const &_format="%F %T")
bool isValid() const noexcept
h160 right160(h256 const &_t)
Convert the given value into h160 (160-bit unsigned integer) using the right 20 bytes.
Address const ZeroAddress
The zero address.
boost::error_info< struct tag_field, std::string > errinfo_name
Base class for all exceptions.
IncludeSignature
Named-boolean type to encode whether a signature be included in the serialisation process.
u256 m_nonce
The transaction-count of the sender.
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.
Public recover(Signature const &_sig, h256 const &_hash)
Recovers Public key from signed message hash.
bool hasZeroSignature() const
Address const & safeSender() const noexcept
Like sender() but will never throw.
vector_ref< byte const > bytesConstRef
@ NullTransaction
Null transaction.
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
void sign(Secret const &_priv)
Sign the transaction.
Class for writing to an RLP bytestream.
void checkChainId(int chainId=-4) const
Signature sign(Secret const &_k, h256 const &_hash)
Returns siganture of message hash.
Address const & sender() const
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void > > u256
Address m_receiveAddress
The receiving address of the transaction.
std::string toHex(Iterator _it, Iterator _end, std::string const &_prefix)
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?
RLPStream & appendList(size_t _items)
Appends a list.
boost::error_info< struct tag_comment, std::string > errinfo_comment
@ ContractCreation
Transaction to create contracts - receiveAddress() is ignored.
SignatureStruct const & signature() const