-
Notifications
You must be signed in to change notification settings - Fork 1
3.5 block
gettocat edited this page Aug 25, 2017
·
1 revision
Block is Block info + txlist[] type object. This type contain next fields:
{
header: {
version: 'uint32',
prev_block: 'hash',
merkle_root: 'hash',
timestamp: 'uint32',
bits: 'uint32',
nonce: 'uint32',
txn_count: 'var_int',//for header is every time 0
hash: 'hash'//read only
},
txns: [tx, tx, tx, ....]//one or more tx
}
read from Buffer (or hex string) into object with fields above.
write into Buffer object. Throw error if:
- txns or blockheader is empty
- blockheader error
- tx error
read from stack block value
var script = {
'keyname': ['block']
}
var stack = new bitPony.stackReader(buffer, script)write into stack header value
var script = [
['block', blockheader, txns],
];
var stack = new bitPony.stackWriter(buffer, script);read from stream tx
var stream = new bitPony.reader(b);
var res = stream.header(offset);
//res.resultwrite to stream header value
var stream = new bitPony.writer(b);
stream.block(blockheader, txns, true);
//or
var res = stream.block(blockheader, txns, txn_count);
//res.resultcan not be a vector (for what?)