35 m_type(_ts.creation ? ContractCreation : MessageCall),
38 m_receiveAddress(_ts.to),
39 m_gasPrice(_ts.gasPrice),
55 BOOST_THROW_EXCEPTION(InvalidTransactionFormat() <<
errinfo_comment(
"transaction RLP must be a list"));
64 if (!rlp[field = 5].isData())
65 BOOST_THROW_EXCEPTION(InvalidTransactionFormat() <<
errinfo_comment(
"transaction data RLP must be an array"));
75 else if (v == 27 || v == 28)
83 BOOST_THROW_EXCEPTION(InvalidTransactionFormat() <<
errinfo_comment(
"to many fields in the transaction RLP"));
135 _s.
appendList((_sig || _forEip155hash ? 3 : 0) + 6);
148 else if (_forEip155hash)
152 static const u256 c_secp256k1n(
"115792089237316195423570985008687907852837564279074904382605163141518161494337");
156 if (
m_vrs.
s > c_secp256k1n / 2)
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
std::string toHex(T const &_data, int _w=2, HexPrefix _prefix=HexPrefix::DontAdd)
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.
u256 m_gasPrice
The base fee and thus the implied exchange rate of ETH to GAS.
boost::error_info< struct tag_field, std::string > errinfo_name
bool isList() const
List value.
h160 right160(h256 const &_t)
Convert the given value into h160 (160-bit unsigned integer) using the right 20 bytes.
bytesConstRef data() const
The bare data of the RLP.
bytes const & out() const
Read the byte stream.
h160 Address
An Ethereum address: 20 bytes.
Address const & sender() const
std::hash for asio::adress
Transaction to create contracts - receiveAddress() is ignored.
unsigned txDataNonZeroGas
std::string toString(string32 const &_s)
Make normal string from fixed-length string.
int64_t baseGasRequired(EVMSchedule const &_es) const
IncludeSignature
Named-boolean type to encode whether a signature be included in the serialisation process...
h256 m_hashWith
Cached hash of transaction with signature.
bytes rlp(IncludeSignature _sig=WithSignature) const
Do not include a signature.
_N toHash(int _flags=Strict) const
Base class for all exceptions.
bytes m_data
The data associated with the transaction, or the initialiser if it's a creation transaction.
u256 m_value
The amount of ETH to be transferred by this transaction. Called 'endowment' for contract-creation tra...
int m_chainId
EIP155 value for calculating transaction hash https://github.com/ethereum/EIPs/issues/155.
Address ZeroAddress
The zero address.
u256 m_nonce
The transaction-count of the sender.
Public recover(Signature const &_sig, h256 const &_hash)
Recovers Public key from signed message hash.
vector_ref< byte const > bytesConstRef
Fixed-size raw-byte array container type, with an API optimised for storing hashes.
RLPStream & appendList(size_t _items)
Appends a list.
Address m_receiveAddress
The receiving address of the transaction.
ANONYMOUS_NAMESPACE_BEGIN const CryptoPP::GF2_32 field
h256 sha3(IncludeSignature _sig=WithSignature) const
void checkChainId(int chainId=-4) const
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u256
Address const & safeSender() const noexcept
Like sender() but will never throw.
Signature sign(Secret const &_k, h256 const &_hash)
Returns siganture of message hash.
boost::error_info< struct tag_comment, std::string > errinfo_comment
bool sha3(bytesConstRef _input, bytesRef o_output)
Calculate SHA3-256 hash of the given input and load it into the given output.
SignatureStruct m_vrs
The signature of the transaction. Encodes the sender.
void streamRLP(RLPStream &_s, IncludeSignature _sig=WithSignature, bool _forEip155hash=false) const
Serialises this transaction to an RLPStream.
bool isEmpty() const
Contains a zero-length string or zero-length list.
_T toInt(int _flags=Strict) const
Converts to int of type given; if isString(), decodes as big-endian bytestream.
Class for writing to an RLP bytestream.
Class for interpreting Recursive Linear-Prefix Data.
Transaction to invoke a message call - receiveAddress() is used.
void sign(Secret const &_priv)
Sign the transaction.
bool isValid() const noexcept
bytes toBytes(int _flags=LaissezFaire) const
Converts to bytearray.
Address m_sender
Cached sender, determined from signature.
Type m_type
Is this a contract-creation transaction or a message-call transaction?