bitcoinlib.db_cache module¶
-
class
bitcoinlib.db_cache.
DbCacheAddress
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
Address Cache Table
Stores transactions and unspent outputs (UTXO’s) per address
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
-
address
¶ Address string base32 or base58 encoded
-
balance
¶ Total balance of UTXO’s linked to this key
-
last_block
¶ Number of last updated block
-
last_txid
¶ Transaction ID of latest transaction in cache
-
n_txs
¶ Total number of transactions for this address
-
n_utxos
¶ Total number of UTXO’s for this address
-
network_name
¶ Blockchain network name of this transaction
-
-
class
bitcoinlib.db_cache.
DbCacheBlock
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
Block Cache Table
Stores block headers
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
-
bits
¶ Encoding for proof-of-work, used to determine target and difficulty
-
block_hash
¶ Hash of this block
-
height
¶ Height or sequence number for this block
-
merkle_root
¶ Merkle root used to validate transaction in block
-
network_name
¶ Blockchain network name
-
nonce
¶ Nonce (number used only once or n-once) is used to create different block hashes
-
prev_block
¶ Block hash of previous block
-
time
¶ Timestamp to indicated when block was created
-
tx_count
¶ Number of transactions included in this block
-
version
¶ Block version to specify which features are used (hex)
-
-
class
bitcoinlib.db_cache.
DbCacheTransaction
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
Transaction Cache Table
Database which stores transactions received from service providers as cache
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
-
block_hash
¶ Hash of block this transaction is included in
-
block_height
¶ Height of block this transaction is included in
-
confirmations
¶ Number of confirmation when this transaction is included in a block. Default is 0: unconfirmed
-
date
¶ Date when transaction was confirmed and included in a block. Or when it was created when transaction is not send or confirmed
-
fee
¶ Transaction fee
-
network_name
¶ Blockchain network name of this transaction
-
nodes
¶ List of all inputs and outputs as DbCacheTransactionNode objects
-
order_n
¶ Order of transaction in block
-
raw
¶ Raw transaction hexadecimal string. Transaction is included in raw format on the blockchain
-
txid
¶ Hexadecimal representation of transaction hash or transaction ID
-
-
class
bitcoinlib.db_cache.
DbCacheTransactionNode
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
Link table for cache transactions and addresses
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
-
address
¶ Address string base32 or base58 encoded
-
is_input
¶ True if input, False if output
-
output_n
¶ Output_n of previous transaction output that is spent in this input
-
spending_index_n
¶ Index number of transaction input which spends this output
-
spending_txid
¶ Transaction hash of input which spends this output
-
spent
¶ Is output spent?
-
transaction
¶ Related transaction object
-
txid
¶
-
value
¶ Value of transaction input
-
-
class
bitcoinlib.db_cache.
DbCacheVars
(**kwargs)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
Table to store various blockchain related variables
A simple constructor that allows initialization from kwargs.
Sets attributes on the constructed instance using the names and values in
kwargs
.Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.
-
expires
¶ Datetime value when variable expires
-
network_name
¶ Blockchain network name of this transaction
-
type
¶ Type of variable: int, string or float
-
value
¶ Value of variable
-
varname
¶ Variable unique name
-