Creates a new transaction object.
Parameters
data
Buffer or Array or Object a transaction can be initiailized with either a buffer containing the RLP serialized transaction or an array of buffers relating to each of the tx Properties, listed in order below in the exmple.Or lastly an Object containing the Properties of the transaction like in the Usage example.For Object and Arrays each of the elements can either be a Buffer, a hex-prefixed (0x) String , Number, or an object with a toBuffer method such as Bignumdata.chainId
Number EIP 155 chainId - mainnet: 1, ropsten: 3data.gasLimit
Buffer transaction gas limitdata.gasPrice
Buffer transaction gas pricedata.to
Buffer to the to addressdata.nonce
Buffer nonce numberdata.data
Buffer this will contain the data of the message or the init of a contractdata.v
Buffer EC recovery IDdata.r
Buffer EC signature parameterdata.s
Buffer EC signature parameterdata.value
Buffer the amount of vapor sent
Properties
raw
Buffer The raw rlp encoded transaction
Examples
var rawTx = {
nonce: '00',
gasPrice: '09184e72a000',
gasLimit: '2710',
to: '0000000000000000000000000000000000000000',
value: '00',
data: '7f7465737432000000000000000000000000000000000000000000000000000000600057',
v: '1c',
r: '5e1d3a76fbf824220eafc8c79ad578ad2b67d01b0c2425eb1f1347e8f50882ab',
s: '5bd428537f05f9830e93792f90ea6a3e2d1ee84952dd96edbae9f658f831ab13'
};
var tx = new Transaction(rawTx);
the minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee)
Returns BN
returns the public key of the sender
Returns Buffer
The amount of gas paid for the data in this tx
Returns BN
returns the sender's address
Returns Buffer
returns the public key of the sender
Returns Buffer
the up front amount that an account must have for this transaction to be valid
Returns BN
Computes a sha3-256 hash of the serialized tx
Parameters
includeSignature
[Boolean] whether or not to inculde the signature (optional, defaulttrue
)
Returns Buffer
sign a transaction with a given a private key
Parameters
privateKey
Buffer
If the tx's to
is to the creation address
Returns Boolean
validates the signature and checks to see if it has enough gas
Parameters
stringError
[Boolean] whether to return a string with a dscription of why the validation failed or return a Bloolean (optional, defaultfalse
)
Returns Boolean or String
Determines if the signature is valid
Returns Boolean
Properties
from
Buffer (read only) sender address of this transaction, mathematically derived from other parameters.
Returns the rlp encoding of the transaction
Returns Buffer