BTCParser.Block
— TypeBlock
Data Structure representing a Block in the Bitcoin blockchain.
Consists of a block.header::Header
and block.transactions::Vector{Transaction}
.
To get the hash of a Block
double_sha256(block)
BTCParser.Header
— TypeHeader
Data Structure representing the Header of a Block in the Bitcoin blockchain.
The elements of the Header
can be accessed by header.element
.
header.version
header.previous_hash
header.merkle_root
header.timestamp
header.difficulty_target
header.nounce
The hash of the Header
can be retrieved with
double_sha256(header)
BTCParser.Link
— TypeLink
The elements of the chain, only for internal representation.
link = chain[0]
Block(link)
Header(link)
double_sha256(link)
BTCParser.Transaction
— TypeTransaction
Data Structure Storing Transactions
To get the hash of a transaction
double_sha256(tx)
BTCParser.TransactionInput
— TypeTransactionInput
Data Structure Storing Transaction Inputs
BTCParser.TransactionOutput
— TypeTransactionOutput
Data Structure Storing Transaction Outputs
BTCParser.UInt256
— TypeUInt256
256 bit unsigned integer, only a few operations are implemented. Holds the hash value of Block
and Transaction
.
Example
double_sha256(block)
double_sha256(tx)
zero(UInt256)
UInt256("234")
BTCParser.to_unsigned((0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03,
0x00, 0x01, 0x02, 0x03))
BTCParser.Witness
— TypeWitness
Data Structure Storing The Witness for SegWit transactions
BTCParser.double_sha256
— Methoddouble_sha256(x::Block)::UInt256
double_sha256(x::Header)::UInt256
double_sha256(x::Transaction)::UInt256
Hash a Block
, Header
, or Transaction
double_sha256(block)
double_sha256(header)
double_sha256(transaction)
BTCParser.make_chain
— Functionmake_chain(chain::Chain, height::Integer)::Chain
make_chain(chain::Chain)::Chain
make_chain(height::Integer)::Chain
make_chain()::Chain
Read a chain of height
or the entire bockchain, if height
is not specified. If chain
is supplied, update the given chain.
BTCParser.DIR
— ConstantThe path where the bitcoin client saves the blockchain files.
BTCParser.Chain
— TypeChain
Vector{Link}
, data type to represent blockchain.
chain = make_chain()
BTCParser.dump_tx_data!
— Methodmutates data in place, advances idx and returns it.
BTCParser.dump_txin_data!
— Methodmutates data in place, advances idx and returns it.
BTCParser.dump_txout_data!
— Methodmutates data in place, advances idx and returns it.
BTCParser.make_chain_dict
— Functionmake_chain_dict
Alternative implementation of make_chain
.
BTCParser.read_varint
— Methodread_varint(io::IO)::UInt64
Read a varint from io
, find documentation (here)[https://en.bitcoin.it/wiki/Protocol_documentation]
BTCParser.seek_magic_bytes!
— Methodseek_magic_bytes!(io, the_magic)
Advance io
to next the_magic
.
BTCParser.seek_magic_bytes_boyer_moore!
— Methodseek_magic_bytes_boyer_moore!(io, the_magic)
Advance io
to next the_magic
. Alternative implementation to seek_magic_bytes!
BTCParser.to_byte_tuple
— MethodBTCParser.to_byte_tuple(x::Unsigned)::NTuple{N, UInt8}
Convert an Unsigned
(UInt8
, UInt16
, UInt32
, UInt64
, UInt128
, UInt256
) into an NTuple{N, UInt8}
with the identical order of bits.
Results depend on the endianness of your CPU architecture.
BTCParser.to_unsigned
— MethodBTCParser.to_unsigned(x::NTuple{N, UInt8})::Unsigned
Convert a tuple to an unsigned (UInt8
, UInt16
, UInt32
, UInt64
, UInt128
, UInt256
) with the identical order of bits.
Results depend on the endianness of your CPU architecture.
BTCParser.to_varint
— Methodto_varint(x::T)::Vector{UInt8}
Take an unsigned type and convert it into an varint (here)[https://en.bitcoin.it/wiki/Protocol_documentation]