Bitcoin.jl Documentation

Bitcoin.jl Documentation

A Bitcoin library for Julia

Functions

Address

Vector{UInt8} -> String

Returns a String representing a Bitcoin address

Missing docstring.

Missing docstring for address. Check Documenter's build log for details.

Bitcoin.wifFunction.
wif(kp::KeyPair, compressed::Bool=true, testnet::Bool=false) -> String

Returns a KeyPair in Wallet Import Format Compressed is set to true if not provided. Testnet is set to false by default.

Transaction

Missing docstring.

Missing docstring for Bitcoin.txfetch. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Bitcoin.txparse. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Bitcoin.txserialize. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Bitcoin.txhash. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Bitcoin.txid. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Bitcoin.txfee. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Bitcoin.txsighash256. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Bitcoin.txsighash. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Bitcoin.txinputverify. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Bitcoin.txverify. Check Documenter's build log for details.

Bitcoin.txsigninputFunction.

Signs the input using the private key

Append Signature to the Script Pubkey of TxIn at index

Bitcoin.iscoinbaseFunction.

Returns whether this transaction is a coinbase transaction or not

Returns the height of the block this coinbase transaction is in Returns nothing if this transaction is not a coinbase transaction

Inbound Transaction

Missing docstring.

Missing docstring for Bitcoin.txinparse. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Bitcoin.txinserialize. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Bitcoin.txinvalue. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Bitcoin.txin_scriptpubkey. Check Documenter's build log for details.

Outband Transaction

Bitcoin.txoutparseMethod.
 txoutparse(s::IOBuffer) -> TxOut

Takes a byte stream and parses the tx_output at the start return a TxOut object

Missing docstring.

Missing docstring for Bitcoin.txoutserialize(tx::TxOut). Check Documenter's build log for details.

Script

Bitcoin.scriptparseFunction.
scriptparse(::GenericIOBuffer) -> Script

Returns a Script object from an IOBuffer

Missing docstring.

Missing docstring for Bitcoin.scriptevaluate. Check Documenter's build log for details.

Bitcoin.p2pkh_scriptFunction.

Takes a hash160 && returns the p2pkh scriptPubKey

Bitcoin.p2sh_scriptFunction.

Takes a hash160 && returns the p2sh scriptPubKey

Bitcoin.is_p2pkhFunction.

Returns whether this follows the OPDUP OPHASH160 <20 byte hash> OPEQUALVERIFY OPCHECKSIG pattern.

Bitcoin.is_p2shFunction.

Returns whether this follows the OPHASH160 <20 byte hash> OPEQUAL pattern.

Returns the address corresponding to the script

OP

Bitcoin.op_ripemd160Function.

Return RIPEMD160 hash of top item

Bitcoin.op_sha1Function.

Return SHA1 hash of top item

Bitcoin.op_sha256Function.

Return SHA256 hash of top item

Bitcoin.op_hash160Function.

Return RIPEMD160(SHA256(x)) hash of top item

Bitcoin.op_hash256Function.

Return SHA256(SHA256(x)) hash of top item

Bitcoin.op_checksigFunction.

Pop a public key and signature and validate the signature for the transaction's hashed data, return TRUE if matching

Same as CHECKSIG, then OP_VERIFY to halt if not TRUE

Run CHECKSIG for each pair of signature and public key provided. All must match. Bug in implementation pops an extra value, prefix with OP_NOP as workaround

Same as CHECKMULTISIG, then OP_VERIFY to halt if not TRUE

Marks transaction as invalid if the top stack item is greater than the transaction's nLockTime field, otherwise script eveluation continues as though an OP_NOP was executed. Transaction is also invalid if 1. the stack is empty; or 2. the top stack item is negative; or 3. the top stack item is greater than or equal to 500000000 while the transaction's nLockTime field is less than 500000000, or vice versa; or 4. the input's nSequence field is equal to 0xffffffff. The precise semantics are described in BIP-65

Marks transaction as invalid if the relative lock time of the input (enforced by BIP-68 with nSequence) is not equal to or longer than the value of the top stack item. The precise semantics are described in BIP-112

Block

Missing docstring.

Missing docstring for Bitcoin.blockparse. Check Documenter's build log for details.

Secp256k1.serializeFunction.
serialize(P::Point; compressed::Bool) -> Vector{UInt8}

Serialize a Point to its SEC format

  • compressed=true by default
serialize(x::Signature) -> Vector{UInt8}

Serialize a Signature to DER format

serialize(n::CompactSizeUInt) -> Vector{UInt8}

Returns the bytes serialization of a CompactSizeUInt

serialize(tx::TxIn) -> Vector{UInt8}

Returns the byte serialization of the transaction input

serialize(tx::TxOut) -> Vector{UInt8}

Returns the byte serialization of the transaction output

serialize(tx::Tx) -> Vector{UInt8}

Returns the byte serialization of the transaction

Returns the 80 byte block header

Returns the byte serialization of the entire network message

Peer -> Vector{UInt8}

Returns the serialization of a Peer

serialize(version::VersionMessage) -> Vector{UInt8}

Serialize this message to send over the network

Serialize this message to send over the network protocol version is 4 bytes little-endian number of hashes is a varint start block is in little-endian end block is also in little-endian

Base.hashFunction.
hash(x[, h::UInt])

Compute an integer hash code such that isequal(x,y) implies hash(x)==hash(y). The optional second argument h is a hash code to be mixed with the result.

New types should implement the 2-argument form, typically by calling the 2-argument hash method recursively in order to mix hashes of the contents with each other (and with h). Typically, any type that implements hash should also implement its own == (hence isequal) to guarantee the property mentioned above. Types supporting subtraction (operator -) should also implement widen, which is required to hash values inside heterogeneous arrays.

source

Binary hash of the legacy serialization

Returns the hash256 interpreted little endian of the block

Bitcoin.idFunction.
id(tx::Tx) -> String

Returns an hexadecimal string of the transaction hash

Human-readable hexadecimal of the block hash

Bitcoin.bip9Function.

Returns whether this block is signaling readiness for BIP9

BIP9 is signalled if the top 3 bits are 001
remember version is 32 bytes so right shift 29 (>> 29) and see if
that is 001
Bitcoin.bip91Function.

Returns whether this block is signaling readiness for BIP91

BIP91 is signalled if the 5th bit from the right is 1
shift 4 bits to the right and see if the last bit is 1
Bitcoin.bip141Function.

Returns whether this block is signaling readiness for BIP141

BIP91 is signalled if the 2nd bit from the right is 1
shift 1 bit to the right and see if the last bit is 1
Bitcoin.targetFunction.

Returns the proof-of-work target based on the bits

last byte is exponent
the first three bytes are the coefficient in little endian
the formula is: coefficient * 256**(exponent-3)
Bitcoin.difficultyFunction.

Returns the block difficulty based on the bits

difficulty is (target of lowest difficulty) / (block's target)
lowest difficulty has bits that equal 0xffff001d
Bitcoin.check_powFunction.

Returns whether this block satisfies proof of work

get the hash256 of the serialization of this block
interpret this hash as a little-endian number
return whether this integer is less than the target

Buy me a cup of coffee

Donate Bitcoin

Index