BTCParser.BlockType
Block

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.HeaderType
Header

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.LinkType
Link

The elements of the chain, only for internal representation.

link = chain[0]
Block(link)
Header(link)
double_sha256(link)
BTCParser.TransactionType
Transaction

Data Structure Storing Transactions

To get the hash of a transaction

double_sha256(tx)
BTCParser.UInt256Type
UInt256

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.WitnessType
Witness

Data Structure Storing The Witness for SegWit transactions

BTCParser.double_sha256Method
double_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_chainFunction
make_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.DIRConstant

The path where the bitcoin client saves the blockchain files.

BTCParser.ChainType
Chain

Vector{Link}, data type to represent blockchain.

chain = make_chain()
BTCParser.read_varintMethod
read_varint(io::IO)::UInt64

Read a varint from io, find documentation (here)[https://en.bitcoin.it/wiki/Protocol_documentation]

BTCParser.to_byte_tupleMethod
BTCParser.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_unsignedMethod
BTCParser.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_varintMethod
to_varint(x::T)::Vector{UInt8}

Take an unsigned type and convert it into an varint (here)[https://en.bitcoin.it/wiki/Protocol_documentation]