Summary

Members Descriptions
namespacebitprim

namespace bitprim

Summary

Members Descriptions
public defencode_hash(hash) Converts a bytearray into a readable format (hex string)
public defdecode_hash(hash_str) Converts a string into a workable format (byte array)
classbitprim::Binary Represents a binary filter.
classbitprim::Block Represent a full Bitcoin blockchain block.
classbitprim::Chain Represents the Bitcoin blockchain.
classbitprim::Executor Controls the execution of the Bitprim bitcoin node.
classbitprim::Header Represents a Bitcoin block's header.
classbitprim::History Output points, values, and spends for a payment address.
classbitprim::Input Represents one of the inputs of a Transaction.
classbitprim::MerkleBlock Merkle tree representation of a transaction block.
classbitprim::Output Represents one of the outputs of a Transaction.
classbitprim::OutputPoint Transaction hash and index pair representing one of the transaction outputs.
classbitprim::PaymentAddress Represents a Bitcoin wallet address.
classbitprim::Point Represents one of the tx inputs.
classbitprim::Script Represents a transaction script.
classbitprim::Stealth Stealth payment related data.
classbitprim::StealthCompact Compressed representation of Stealth payment related data.
classbitprim::Transaction Represents a Bitcoin Transaction.
classbitprim::Wallet Wallet handling utilities.

Members

public defencode_hash(hash)

Converts a bytearray into a readable format (hex string)

Parameters

  • hash (bytearray): Hash bytes

Returns

(str) Hex string Example: "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"

public defdecode_hash(hash_str)

Converts a string into a workable format (byte array)

Parameters

  • hash_str (str): hash hex string

Returns

(bytearray): Byte array representing hash. Example "00 00 00 00 00 19 D6 68 ... E2 6F"

class bitprim::Binary

Represents a binary filter.

Summary

Members Descriptions
public defconstruct() Create an empty binary object.
public defconstruct_string(string_filter) Creates a binary filter from a binary string.
public defconstruct_blocks(size,blocks) Creates a binary filter from an int array.
public defblocks() Filter representation as uint array.
public defencoded() Filter representation as binary string.

Members

public defconstruct()

Create an empty binary object.

Returns

(Binary) New instance

public defconstruct_string(string_filter)

Creates a binary filter from a binary string.

Parameters

  • string_filter Binary string. Example: '10111010101011011111000000001101'

Returns

(Binary) Instance representing the given filter string

public defconstruct_blocks(size,blocks)

Creates a binary filter from an int array.

Parameters

  • size (int) Filter length

  • blocks (int array) Filter representation. Example: '[186,173,240,13]'

Returns

(Binary) Instance representing the given filter

public defblocks()

Filter representation as uint array.

Returns

(uint array)

public defencoded()

Filter representation as binary string.

Returns

(str)

class bitprim::Block

Represent a full Bitcoin blockchain block.

Summary

Members Descriptions
public defheight() The block's height in the chain.
public defheader() The block's header.
public deftransaction_count() The total amount of transactions that the block contains.
public defhash() The block's hash as a 32 byte array.
public defserialized_size() Block size in bytes.
public deffees() Miner fees included in the block's coinbase transaction.
public defclaim() Sum of coinbase outputs.
public defreward(height) Reward = Subsidy + Fees, for the block at the given height.
public defgenerate_merkle_root() The block's Merkle root, as a 32 byte array.
public defis_valid() Return 1 if and only if the block has transactions and a valid header, 0 otherwise.
public deftransaction_nth(n) Given a position in the block, returns the corresponding transaction.
public defsignature_operations() Amount of signature operations in the block.
public defsignature_operations_bip16_active(bip16_active) Amount of signature operations in the block.
public deftotal_inputs(with_coinbase) Total amount of inputs in the block (consider all transactions).
public defis_extra_coinbases() Tell whether there is more than one coinbase transaction in the block.
public defis_final(height,block_time) Tell whether every transaction in the block is final or not.
public defis_distinct_transaction_set() Tell whether all transactions in the block have a unique hash (i.e.
public defis_valid_coinbase_claim(height) Given a block height, tell if its coinbase claim is not higher than the deserved reward.
public defis_valid_coinbase_script(height) Returns 1 if and only if the coinbase script is valid.
public defis_valid_merkle_root() Tell if the generated Merkle root equals the header's Merkle root.

Members

public defheight()

The block's height in the chain.

It identifies it univocally

Returns

(int)

public defheader()

The block's header.

Returns

(Header)

public deftransaction_count()

The total amount of transactions that the block contains.

Returns

(unsigned int)

public defhash()

The block's hash as a 32 byte array.

Returns

(bytearray)

public defserialized_size()

Block size in bytes.

Returns

(int)

public deffees()

Miner fees included in the block's coinbase transaction.

Returns

(unsigned int)

public defclaim()

Sum of coinbase outputs.

Returns

(unsigned int)

public defreward(height)

Reward = Subsidy + Fees, for the block at the given height.

Parameters

  • height (unsigned int) Block height in the chain. Identifies it univocally

Returns

(unsigned int)

public defgenerate_merkle_root()

The block's Merkle root, as a 32 byte array.

Returns

(byte array)

public defis_valid()

Return 1 if and only if the block has transactions and a valid header, 0 otherwise.

Returns

(int) TODO Why not a bool?

public deftransaction_nth(n)

Given a position in the block, returns the corresponding transaction.

Parameters

  • n (unsigned int): Transaction index inside the block (starting at zero)

Returns

(Transaction)

public defsignature_operations()

Amount of signature operations in the block.

Returns max_int in case of overflow.

Returns

(unsigned int)

public defsignature_operations_bip16_active(bip16_active)

Amount of signature operations in the block.

Returns max_int in case of overflow.

Parameters

  • bip16_active (int): should be '1' if and only if bip16 is activated at this point.

public deftotal_inputs(with_coinbase)

Total amount of inputs in the block (consider all transactions).

Parameters

  • with_coinbase (int): should be '1' if and only if the block contains a coinbase transaction, '0' otherwise.

Returns

(unsigned int)

public defis_extra_coinbases()

Tell whether there is more than one coinbase transaction in the block.

Returns

(int) 1 if and only if there is another coinbase other than the first transaction, 0 otherwise.

public defis_final(height,block_time)

Tell whether every transaction in the block is final or not.

Parameters

  • height (unsigned int): Block height in the chain. Identifies it univocally.

Returns

(int) 1 if every transaction in the block is final, 0 otherwise.

public defis_distinct_transaction_set()

Tell whether all transactions in the block have a unique hash (i.e.

no duplicates)

Returns

(int): 1 if there are no two transactions with the same hash in the block, 0 otherwise

public defis_valid_coinbase_claim(height)

Given a block height, tell if its coinbase claim is not higher than the deserved reward.

Parameters

  • height (unsigned int): Block height in the chain. Identifies it univocally.

Returns

(int) 1 if coinbase claim is not higher than the deserved reward.

public defis_valid_coinbase_script(height)

Returns 1 if and only if the coinbase script is valid.

Returns

(int)

public defis_valid_merkle_root()

Tell if the generated Merkle root equals the header's Merkle root.

Returns

(int) 1 if and only if the generated Merkle root is equal to the Header's Merkle root

class bitprim::Chain

Represents the Bitcoin blockchain.

Summary

Members Descriptions
publichistory_fetch_handler_ Internal callback which is called by the native fetch_history function and marshalls parameters to the managed callback.
publicfetch_block_header_handler_ Internal callback which is called by the native fetch_block_header function and marshalls parameters to the managed callback.
public deffetch_last_height(handler) Gets the height of the highest block in the local copy of the blockchain.
public deffetch_history(address,limit,from_height,handler) Get a list of output points, values, and spends for a given payment address.
public deffetch_stealth(binary_filter_str,from_height,handler) Get metadata on potential payment transactions by stealth filter.
public deffetch_block_height(hash,handler) Given a block hash, it queries the chain for the block height.
public deffetch_block_header_by_height(height,handler) Get the block header from the specified height in the chain.
public deffetch_block_header_by_hash(hash,handler) Get the block header from the specified block hash.
public deffetch_block_by_height(height,handler) Gets a block from the specified height in the chain.
public deffetch_block_by_hash(hash,handler) Gets a block from the specified hash.
public deffetch_merkle_block_by_height(height,handler) Given a block height in the chain, it retrieves the block's associated Merkle block.
public deffetch_merkle_block_by_hash(hash,handler) Given a block hash, it retrieves the block's associated Merkle block.
public deffetch_transaction(hashn,require_confirmed,handler) Get a transaction by its hash.
public deffetch_transaction_position(hashn,require_confirmed,handler) Given a transaction hash, it fetches the height and position inside the block.
public defvalidate_tx(transaction,handler) Determine if a transaction is valid for submission to the blockchain.
public deffetch_spend(output_point,handler) Fetch the transaction input which spends the indicated output.

Members

publichistory_fetch_handler_

Internal callback which is called by the native fetch_history function and marshalls parameters to the managed callback.

publicfetch_block_header_handler_

Internal callback which is called by the native fetch_block_header function and marshalls parameters to the managed callback.

public deffetch_last_height(handler)

Gets the height of the highest block in the local copy of the blockchain.

This number will grow as the node synchronizes with the blockchain. This is an asynchronous method; a callback must be provided to receive the result

Args: handler (Callable (error, block_height)): Will be executed when the chain is queried.

  • error (int): Error code. 0 if and only if successful.

  • block_height (unsigned int): Height of the highest block in the chain.

public deffetch_history(address,limit,from_height,handler)

Get a list of output points, values, and spends for a given payment address.

This is an asynchronous method; a callback must be provided to receive the result

Args: address (PaymentAddress): Wallet to search. limit (unsigned int): Max amount of results to fetch. from_height (unsigned int): Starting height to search for transactions. handler (Callable (error, list)): Will be executed when the chain is queried.

  • error (int): Error code. 0 if and only if successful.

  • list (HistoryList): A list with every element found.

public deffetch_stealth(binary_filter_str,from_height,handler)

Get metadata on potential payment transactions by stealth filter.

Given a filter and a height in the chain, it queries the chain for transactions matching the given filter. Args: binary_filter_str (string): Must be at least 8 bits in length. example "10101010" from_height (unsigned int): Starting height in the chain to search for transactions. handler (Callable (error, list)): Will be executed when the chain is queried.

  • error (int): Error code. 0 if and only if successful.

  • list (StealthList): list with every transaction matching the given filter.

public deffetch_block_height(hash,handler)

Given a block hash, it queries the chain for the block height.

Args: hash (bytearray): 32 bytes of the block hash. handler (Callable (error, block_height)): Will be executed after the chain is cued.

  • error (int): Error code. 0 if and only if successful.

  • block_height (unsigned int): height of the block in the chain.

public deffetch_block_header_by_height(height,handler)

Get the block header from the specified height in the chain.

Args: height (unsigned int): Block height in the chain. handler (Callable (error, block_header)): Will be executed after the chain is queried.

  • error (int): Error code. 0 if successful.

  • block_header (Header): The found block's header.

public deffetch_block_header_by_hash(hash,handler)

Get the block header from the specified block hash.

Args: hash (bytearray): 32 bytes of the block hash. handler (Callable (error, block_header)): Will be executed after the chain is queried.

  • error (int): Error code. 0 if successful.

  • block_header (Header): The found block's header.

public deffetch_block_by_height(height,handler)

Gets a block from the specified height in the chain.

Args: height (unsigned int): Block height in the chain. handler (Callable (error, block)): Will be executed after the chain is queried.

  • error (int): Error code. 0 if successful.

  • block (Block): Block at the given height in the chain.

public deffetch_block_by_hash(hash,handler)

Gets a block from the specified hash.

Args: hash (bytearray): 32 bytes of the block hash. handler (Callable (error, block)): Will be executed after the chain is queried.

  • error (int): Error code. 0 if successful.

  • block (Block): Block found with the specified hash.

public deffetch_merkle_block_by_height(height,handler)

Given a block height in the chain, it retrieves the block's associated Merkle block.

Args: height (unsigned int): Block height in the chain. handler (Callable (error, merkle_block, block_height)): Will be executed when the chain is queried.

  • error (int): Error code. 0 if successful.

  • merkle_block (MerkleBlock): The requested block's Merkle block.

  • block_height (unsigned int): The block's height in the chain.

public deffetch_merkle_block_by_hash(hash,handler)

Given a block hash, it retrieves the block's associated Merkle block.

Args: hash (bytearray): 32 bytes of the block hash. handler (Callable (error, merkle_block, block_height)): Will be executed when the chain is queried.

  • error (int): Error code. 0 if successful.

  • merkle_block (MerkleBlock): The requested block's Merkle block.

  • block_height (unsigned int): The block's height in the chain.

public deffetch_transaction(hashn,require_confirmed,handler)

Get a transaction by its hash.

Args: hashn (bytearray): 32 bytes of the transaction hash. require_confirmed (int): If transaction should be in a block. 0 if not. handler (Callable (error, transaction, block_height, tx_index)): Will be executed when the chain is queried.

  • error (int): Error code. 0 if successful.

  • transaction (Transaction): Transaction found.

  • block_height (unsigned int): height in the chain of the block containing the transaction.

  • tx_index (unsigned int): index of the transaction inside the block (starting at zero).

public deffetch_transaction_position(hashn,require_confirmed,handler)

Given a transaction hash, it fetches the height and position inside the block.

Args: hash (bytearray): 32 bytes of the transaction hash. require_confirmed (int): 1 if and only if transaction should be in a block, 0 otherwise. handler (Callable (error, block_height, tx_index)): Will be executed after the chain is queried.

  • error (int): Error code. 0 if successful.

  • block_height (unsigned int): Height of the block containing the transaction.

  • tx_index (unsigned int): Transaction index inside the block (starting at zero).

public defvalidate_tx(transaction,handler)

Determine if a transaction is valid for submission to the blockchain.

Args: transaction (Transaction): transaction to be checked. handler (Callable (error, message)): Will be executed after the chain is queried.

  • error (int): error code. 0 if successful.

  • message (str): string describing the result of the query. Example: 'The transaction is valid'

public deffetch_spend(output_point,handler)

Fetch the transaction input which spends the indicated output.

The fetch_spend_handler callback will be executed after querying the chain. Args: output_point (OutputPoint): tx hash and index pair. handler (Callable (error, input_point)): Will be executed when the chain is queried.

  • error (int): Error code. 0 if successful.

  • input_point (Point): Tx hash and index pair where the output was spent.

class bitprim::Executor

Controls the execution of the Bitprim bitcoin node.

Summary

Members Descriptions
public def__init__(path,sout,serr) Node executor constructor.
public definit_chain() Initializes blockchain local copy.
public defrun() Starts running the node; blockchain starts synchronizing (downloading).
public defrun_wait() Starts running the node; blockchain start synchronizing (downloading).
public defstop() Stops the node; that includes all activies, such as synchronization and networking precondition: self._running.
public defchain() Return the chain object representation.
public def__enter__() Implements acquisition part of the RAII idiom (acquires the executor object)
public def__exit__(exc_type,exc_value,traceback) Implements the release part of the RAII idiom (releases the executor object)

Members

public def__init__(path,sout,serr)

Node executor constructor.

Parameters

  • path (string): Absolute path to node configuration file.

  • sout (file handle): File handle for redirecting standard output. If None, output goes to the a log file in the current directory.

  • serr (file handle): File handle for redirecting standard error output. If None, output goes to log file in the current directory.

public definit_chain()

Initializes blockchain local copy.

Returns

(bool) true if and only if successful.

public defrun()

Starts running the node; blockchain starts synchronizing (downloading).

Returns right away (doesn't wait for init process to end)

Returns

(bool) true if and only if successful.

public defrun_wait()

Starts running the node; blockchain start synchronizing (downloading).

Call blocks until init process is completed or fails.

Returns

(bool) true if and only if successful.

public defstop()

Stops the node; that includes all activies, such as synchronization and networking precondition: self._running.

Returns

(bool) true if and only if successful

public defchain()

Return the chain object representation.

Returns

(Chain)

public def__enter__()

Implements acquisition part of the RAII idiom (acquires the executor object)

Returns

(Executor) a newly acquired instance ready to use

public def__exit__(exc_type,exc_value,traceback)

Implements the release part of the RAII idiom (releases the executor object)

Parameters

  • exc_type Ignored

  • exc_value Ignored

  • traceback Ignored

class bitprim::Header

Represents a Bitcoin block's header.

Summary

Members Descriptions
public defheight() Block height in the chain.
public defversion() Header protocol version.
public defset_version(version) Set version.
public defprevious_block_hash() 32 bytes hash of the previous block in the chain.
public defmerkle() Merkle root in 32 byte array format.
public defhash() Block hash in 32 byte array format.
public deftimestamp() Block timestamp in UNIX Epoch (seconds since January 1st 1970) Assume UTC 0.
public defset_timestamp(timestamp) Set header timestamp.
public defbits() Difficulty threshold.
public defset_bits(bits) Set header bits.
public defnonce() The nonce that allowed this block to be added to the blockchain.
public defset_nonce(nonce) Set header nonce.

Members

public defheight()

Block height in the chain.

Returns

(unsigned int)

public defversion()

Header protocol version.

Returns

(unsigned int)

public defset_version(version)

Set version.

Parameters

  • version New version value

public defprevious_block_hash()

32 bytes hash of the previous block in the chain.

Returns

(bytearray)

public defmerkle()

Merkle root in 32 byte array format.

Returns

(bytearray)

public defhash()

Block hash in 32 byte array format.

Returns

(bytearray

public deftimestamp()

Block timestamp in UNIX Epoch (seconds since January 1st 1970) Assume UTC 0.

Returns

(unsigned int)

public defset_timestamp(timestamp)

Set header timestamp.

Parameters

  • timestamp New header timestamp value

public defbits()

Difficulty threshold.

Returns

(unsigned int)

public defset_bits(bits)

Set header bits.

Parameters

  • bits New header bits value

public defnonce()

The nonce that allowed this block to be added to the blockchain.

Returns

(unsigned int)

public defset_nonce(nonce)

Set header nonce.

Parameters

  • nonce New header nonce value

class bitprim::History

Output points, values, and spends for a payment address.

Summary

Members Descriptions
public defpoint_kind() Used for differentiation.
public defpoint() The point that identifies the History instance.
public defheight() Height of the block containing the Point.
public defvalue_or_previous_checksum() Varies depending of point_kind.

Members

public defpoint_kind()

Used for differentiation.

'0' output '1' spend

Returns

(unsigned int)

public defpoint()

The point that identifies the History instance.

Returns

(Point)

public defheight()

Height of the block containing the Point.

Returns

(unsigned int)

public defvalue_or_previous_checksum()

Varies depending of point_kind.

value: if output, then satoshi value of output. previous_checksum: if spend, then checksum hash of previous output_point.

Returns

(unsigned int)

class bitprim::Input

Represents one of the inputs of a Transaction.

Summary

Members Descriptions
public defis_valid() Returns 0 if and only if previous outputs or script are invalid.
public defis_final() Returns 1 if and only if sequence is equal to max_sequence.
public defserialized_size() Size in bytes.
public defsequence() Sequence number of inputs.
public defsignature_operations(bip16_active) Total amount of sigops in the script.
public defscript() The input's script.
public defprevious_output() Returns the previous output, with its transaction hash and index.

Members

public defis_valid()

Returns 0 if and only if previous outputs or script are invalid.

Returns

(int)

public defis_final()

Returns 1 if and only if sequence is equal to max_sequence.

Returns

int

public defserialized_size()

Size in bytes.

Returns

(unsigned int)

public defsequence()

Sequence number of inputs.

If it equals max_sequence, txs is final

Returns

(unsigned int)

public defsignature_operations(bip16_active)

Total amount of sigops in the script.

Parameters

  • bip16_active (int): 1 if and only if bip 16 is active. 0 if not.

Returns

(unsigned int)

public defscript()

The input's script.

Returns

(Script)

public defprevious_output()

Returns the previous output, with its transaction hash and index.

Returns

(OutputPoint)

class bitprim::MerkleBlock

Merkle tree representation of a transaction block.

Summary

Members Descriptions
public defheight() Height of the block in the chain.
public defheader() The block's header.
public defis_valid() Returns true if and only if it the block contains txs hashes, and header is valid.
public defhash_count() Transaction hashes list element count.
public defserialized_size(version) Block size in bytes.
public deftotal_transaction_count() Amount of transactions inside the block.
public defreset() Delete all the data inside the block.

Members

public defheight()

Height of the block in the chain.

Returns

(unsigned int)

public defheader()

The block's header.

Returns

(Header)

public defis_valid()

Returns true if and only if it the block contains txs hashes, and header is valid.

Returns

(int)

public defhash_count()

Transaction hashes list element count.

Returns

(unsigned int)

public defserialized_size(version)

Block size in bytes.

Parameters

  • version (unsigned int): block protocol version.

Returns

(unsigned int)

public deftotal_transaction_count()

Amount of transactions inside the block.

Returns

(unsigned int)

public defreset()

Delete all the data inside the block.

class bitprim::Output

Represents one of the outputs of a Transaction.

Summary

Members Descriptions
public defis_valid() Returns 0 if and only if output is not found.
public defserialized_size(wire) Block size in bytes.
public defvalue() Output value in Satoshis.
public defsignature_operations() Amount of signature operations in script.
public defscript() Script: returns the output script.

Members

public defis_valid()

Returns 0 if and only if output is not found.

Returns

(int)

public defserialized_size(wire)

Block size in bytes.

Parameters

  • wire (bool): if true, size will include size of 'uint32' for storing spender height

Returns

(unsigned int)

public defvalue()

Output value in Satoshis.

Returns

(unsigned int)

public defsignature_operations()

Amount of signature operations in script.

Returns

(unsigned int)

public defscript()

Script: returns the output script.

"""

class bitprim::OutputPoint

Transaction hash and index pair representing one of the transaction outputs.

Summary

Members Descriptions
public defhash() Transaction hash in 32 byte array format.
public defindex() Position of the output in the transaction (starting at zero)
public defconstruct() Creates an empty output point.
public defconstruct_from_hash_index(hashn,index) Creates an OutputPoint from a transaction hash and index pair.

Members

public defhash()

Transaction hash in 32 byte array format.

Returns

(bytearray)

public defindex()

Position of the output in the transaction (starting at zero)

Returns

(unsigned int)

public defconstruct()

Creates an empty output point.

Returns

(OutputPoint)

public defconstruct_from_hash_index(hashn,index)

Creates an OutputPoint from a transaction hash and index pair.

Parameters

  • hashn (bytearray): Transaction hash in 32 byte array format

  • index (unsigned int): position of the output in the transaction.

Returns

(Outputpoint)

class bitprim::PaymentAddress

Represents a Bitcoin wallet address.

Summary

Members Descriptions
public defencoded() Address in readable format (hex string)
public defversion() Address version.
public defconstruct_from_string(address) Creates the Payment Address based on the received string.

Members

public defencoded()

Address in readable format (hex string)

Returns

(str)

public defversion()

Address version.

Returns

(unsigned int)

public defconstruct_from_string(address)

Creates the Payment Address based on the received string.

Parameters

  • address (str) A base58 address. Example: '1MLVpZC2CTFHheox8SCEnAbW5NBdewRTdR'

class bitprim::Point

Represents one of the tx inputs.

It's a transaction hash and index pair.

Summary

Members Descriptions
public defhash() Transaction hash in 32 byte array format.
public defis_valid() returns true if its not null.
public defindex() Input position in the transaction (starting at zero)
public defchecksum() This is used with output_point identification within a set of history rows of the same address.

Members

public defhash()

Transaction hash in 32 byte array format.

Returns

(byte array)

public defis_valid()

returns true if its not null.

Returns: bool

public defindex()

Input position in the transaction (starting at zero)

Returns

(unsigned int)

public defchecksum()

This is used with output_point identification within a set of history rows of the same address.

Collision will result in miscorrelation of points by client callers. This is NOT a bitcoin checksum.

Returns

(unsigned int)

class bitprim::Script

Represents a transaction script.

Summary

Members Descriptions
public defis_valid() All script bytes are valid under some circumstance (e.g.
public defis_valid_operations() Script validity is independent of individual operation validity.
public defsatoshi_content_size() Size in bytes.
public defserialized_size(prefix) Size in bytes.
public defto_string(active_forks) Translate operations in the script to string.
public defsigops(embedded) Amount of signature operations in the script.
public defembedded_sigops(prevout_script) Count the sigops in the embedded script using BIP16 rules.

Members

public defis_valid()

All script bytes are valid under some circumstance (e.g.

coinbase).

Returns

(int) 0 if and only if prefix and byte count do not match.

public defis_valid_operations()

Script validity is independent of individual operation validity.

Ops are considered invalid if there is a trailing invalid/default op or if a push op has a size mismatch

Returns

(int)

public defsatoshi_content_size()

Size in bytes.

Returns

(unsigned int)

public defserialized_size(prefix)

Size in bytes.

If prefix is 1 size, includes a var int size

Parameters

  • prefix (int): include prefix size in the final result

Returns

(unsigned int)

public defto_string(active_forks)

Translate operations in the script to string.

Parameters

  • active_forks (unsigned int): Tells which rule is active

Returns

(str)

public defsigops(embedded)

Amount of signature operations in the script.

Parameters

  • embedded (bool): Tells whether this is an embedded script

Returns

(unsigned int)

public defembedded_sigops(prevout_script)

Count the sigops in the embedded script using BIP16 rules.

Returns

(unsigned int)

class bitprim::Stealth

Stealth payment related data.

Summary

Members Descriptions
public defephemeral_public_key_hash() 33 bytes.
public deftransaction_hash() Transaction hash in 32 bytes format.
public defpublic_key_hash() Public key hash in 20 byte array format.

Members

public defephemeral_public_key_hash()

33 bytes.

Includes the sign byte (0x02)

Returns

(bytearray)

public deftransaction_hash()

Transaction hash in 32 bytes format.

Returns

(bytearray)

public defpublic_key_hash()

Public key hash in 20 byte array format.

Returns

(bytearray)

class bitprim::StealthCompact

Compressed representation of Stealth payment related data.

Summary

Members Descriptions
public defephemeral_public_key_hash() Ephemeral public key hash in 32 byte array format.
public deftransaction_hash() Transaction hash in 32 byte array format.
public defpublic_key_hash() Public key hash in 20 byte array format.

Members

public defephemeral_public_key_hash()

Ephemeral public key hash in 32 byte array format.

Does not include the sign byte (0x02)

Returns

(byte array)

public deftransaction_hash()

Transaction hash in 32 byte array format.

Returns

(byte array)

public defpublic_key_hash()

Public key hash in 20 byte array format.

Returns

(byte array)

class bitprim::Transaction

Represents a Bitcoin Transaction.

Summary

Members Descriptions
public defversion() Transaction protocol version.
public defset_version(version) Set new transaction version value.
public defhash() bytearray: 32 bytes transaction hash.
public defhash_sighash_type(sighash_type) 32 bytes transaction hash + 4 bytes signature hash type
public deflocktime() Transaction locktime.
public defserialized_size(wire) Transaction size in bytes.
public deffees() Fees to pay to the winning miner.
public defsignature_operations() Amount of signature operations in the transaction.
public defsignature_operations_bip16_active(bip16_active) Amount of signature operations in the transaction.
public deftotal_input_value() Sum of every input value in the transaction.
public deftotal_output_value() Sum of every output value in the transaction.
public defis_coinbase() Return 1 if and only if transaction is coinbase, 0 otherwise.
public defis_null_non_coinbase() Return 1 if and only if the transaction is not coinbase and has a null previous output, 0 otherwise.
public defis_oversized_coinbase() Returns 1 if the transaction is coinbase and has an invalid script size on its first input.
public defis_mature(target_height) Returns 1 if and only if at least one of the inputs is not mature, 0 otherwise.
public defis_overspent() Returns 1 if transaction is not a coinbase, and the sum of its outputs is higher than the sum of its inputs, 0 otherwise.
public defis_double_spend(include_unconfirmed) Returns 1 if at least one of the previous outputs was already spent, 0 otherwise.
public defis_missing_previous_outputs() Returns 1 if and only if at least one of the previous outputs is invalid, 0 otherwise.
public defis_final(block_height,block_time) Returns 1 if and only if the transaction is final, 0 otherwise.
public defis_locktime_conflict() Returns 1 if and only if the transaction is locked and every input is final, 0 otherwise.
public defoutputs() Returns a list with all of this transaction's outputs.
public definputs() Returns a list with all of this transaction's inputs.

Members

public defversion()

Transaction protocol version.

Returns

(unsigned int)

public defset_version(version)

Set new transaction version value.

Parameters

  • version New transaction version value

public defhash()

bytearray: 32 bytes transaction hash.

public defhash_sighash_type(sighash_type)

32 bytes transaction hash + 4 bytes signature hash type

Parameters

  • sighash_type (unsigned int): signature hash type

Returns

(byte array)

public deflocktime()

Transaction locktime.

Returns

(unsigned int)

public defserialized_size(wire)

Transaction size in bytes.

Parameters

  • wire (bool): if true, size will include size of 'uint32' for storing spender output height

Returns

(unsigned int)

public deffees()

Fees to pay to the winning miner.

Difference between sum of inputs and outputs

Returns

(unsigned int)

public defsignature_operations()

Amount of signature operations in the transaction.

Returns

(unsigned int) max_int in case of overflow

public defsignature_operations_bip16_active(bip16_active)

Amount of signature operations in the transaction.

Parameters

  • bip16_active (int): 1 if and only if bip 16 is active, 0 otherwise

Returns

(unsigned int) max_int in case of overflow.

public deftotal_input_value()

Sum of every input value in the transaction.

Returns

(unsigned int) max_int in case of overflow

public deftotal_output_value()

Sum of every output value in the transaction.

Returns

(unsigned int) max_int in case of overflow

public defis_coinbase()

Return 1 if and only if transaction is coinbase, 0 otherwise.

Returns

(int)

public defis_null_non_coinbase()

Return 1 if and only if the transaction is not coinbase and has a null previous output, 0 otherwise.

Returns

(int)

public defis_oversized_coinbase()

Returns 1 if the transaction is coinbase and has an invalid script size on its first input.

Returns

(int)

public defis_mature(target_height)

Returns 1 if and only if at least one of the inputs is not mature, 0 otherwise.

Returns

(int)

public defis_overspent()

Returns 1 if transaction is not a coinbase, and the sum of its outputs is higher than the sum of its inputs, 0 otherwise.

Returns

(int)

public defis_double_spend(include_unconfirmed)

Returns 1 if at least one of the previous outputs was already spent, 0 otherwise.

Returns

(int)

public defis_missing_previous_outputs()

Returns 1 if and only if at least one of the previous outputs is invalid, 0 otherwise.

Returns

(int)

public defis_final(block_height,block_time)

Returns 1 if and only if the transaction is final, 0 otherwise.

Returns

(int)

public defis_locktime_conflict()

Returns 1 if and only if the transaction is locked and every input is final, 0 otherwise.

Returns

(int)

public defoutputs()

Returns a list with all of this transaction's outputs.

Returns

(OutputList)

public definputs()

Returns a list with all of this transaction's inputs.

Returns

(InputList)

class bitprim::Wallet

Wallet handling utilities.

Summary

Members Descriptions
public defmnemonics_to_seed(cls,mnemonics) Convert mnemonics to a seed.

Members

public defmnemonics_to_seed(cls,mnemonics)

Convert mnemonics to a seed.

Parameters

  • mnemonics A list of strings representing the mnemonics

Returns

A new seed

Generated by Moxygen

results matching ""

    No results matching ""