60 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); }
63 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); }
66 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) {}
69 TransactionBase(
u256 const& _value,
u256 const& _gasPrice,
u256 const& _gas,
bytes const& _data,
u256 const& _nonce = 0): m_type(ContractCreation), m_nonce(_nonce), m_value(_value), m_gasPrice(_gasPrice), m_gas(_gas), m_data(_data) {}
85 Address const& safeSender()
const noexcept;
90 void checkLowS()
const;
95 void checkChainId(
int chainId = -4)
const;
98 explicit operator bool()
const {
return m_type != NullTransaction; }
101 bool isCreation()
const {
return m_type == ContractCreation; }
188 _out <<
"/" << _t.
data().size() <<
"$" << _t.
value() <<
"+" << _t.
gas() <<
"@" << _t.
gasPrice();
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Address from() const
Synonym for safeSender().
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.
TransactionBase(u256 const &_value, u256 const &_gasPrice, u256 const &_gas, bytes const &_data, u256 const &_nonce=0)
Constructs an unsigned contract-creation transaction.
std::vector< TransactionBase > TransactionBases
Nice name for vector of Transaction.
void setNonce(u256 const &_n)
Sets the nonce to the given value. Clears any signature.
std::ostream & operator<<(std::ostream &_out, BlockHeader const &_bi)
bytes const & out() const
Read the byte stream.
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.
SecureFixedHash< 32 > Secret
Transaction to create contracts - receiveAddress() is ignored.
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.
bool operator==(const ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs)
SignatureStruct const & signature() const
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.
bytes rlp(IncludeSignature _sig=WithSignature) const
Do not include a signature.
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...
u256 m_nonce
The transaction-count of the sender.
Address to() const
Synonym for receiveAddress().
std::vector< byte > bytes
Fixed-size raw-byte array container type, with an API optimised for storing hashes.
Address m_receiveAddress
The receiving address of the transaction.
bytes const & data() const
h256 sha3(IncludeSignature _sig=WithSignature) const
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u256
bool operator==(TransactionBase const &_c) const
Checks equality of transactions.
Address const & safeSender() const noexcept
Like sender() but will never throw.
Signature sign(Secret const &_k, h256 const &_hash)
Returns siganture of message hash.
bool sha3(bytesConstRef _input, bytesRef o_output)
Calculate SHA3-256 hash of the given input and load it into the given output.
void forceSender(Address const &_a)
Force the sender to a particular value. This will result in an invalid transaction RLP...
std::string abridged() const
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=0)
Constructs an unsigned message-call transaction.
void clearSignature()
Clears the signature.
Class for writing to an RLP bytestream.
TransactionBase(bytes const &_rlp, CheckTransaction _checkSig)
Constructs a transaction from the given RLP.
bool operator!=(TransactionBase const &_c) const
Checks inequality of transactions.
Encodes a transaction, ready to be exported to or freshly imported from RLP.
Address m_sender
Cached sender, determined from signature.
Address receiveAddress() const
Type m_type
Is this a contract-creation transaction or a message-call transaction?