Blockchain¶
-
class
blocksci.
Blockchain
(loc)¶ Class representing the blockchain. This class is contructed by passing it a string representing a file path to your BlockSci data files generated by blocksci_parser
-
__getitem__
(*args, **kwargs)¶ Overloaded function.
- __getitem__(self: blocksci.blocksci_interface.Blockchain, arg0: int) -> blocksci::Block
Return the block of the given height
- __getitem__(self: blocksci.blocksci_interface.Blockchain, arg0: slice) -> List[blocksci::Block]
Return a list of blocks with their heights in the given range
-
__iter__
(self: blocksci.blocksci_interface.Blockchain) → iterator¶ Allows direct iteration over the blocks in the blockchain
-
__len__
(self: blocksci.blocksci_interface.Blockchain) → int¶ Returns the total number of blocks in the blockchain
-
address_count
(self: blocksci.blocksci_interface.Blockchain, arg0: blocksci.blocksci_interface.address_type) → int¶ Get an upper bound of the number of address of a given type (This reflects the number of type equivlant addresses of that type).
-
address_from_index
(self: blocksci.blocksci_interface.Blockchain, arg0: int, arg1: blocksci.blocksci_interface.address_type) → Union[blocksci.blocksci_interface.NonStandardAddress, blocksci.blocksci_interface.PubkeyAddress, blocksci.blocksci_interface.PubkeyHashAddress, blocksci.blocksci_interface.MultisigPubkey, blocksci.blocksci_interface.PayToScriptHashAddress, blocksci.blocksci_interface.MultisigAddress, blocksci.blocksci_interface.OpReturnAddress, blocksci.blocksci_interface.WitnessPubkeyHashAddress, blocksci.blocksci_interface.PayToWitnessScriptHashAddress]¶ Construct an address object from an address num and type
-
address_from_string
(self: blocksci.blocksci_interface.Blockchain, arg0: str) → Optional[Union[blocksci.blocksci_interface.NonStandardAddress, blocksci.blocksci_interface.PubkeyAddress, blocksci.blocksci_interface.PubkeyHashAddress, blocksci.blocksci_interface.MultisigPubkey, blocksci.blocksci_interface.PayToScriptHashAddress, blocksci.blocksci_interface.MultisigAddress, blocksci.blocksci_interface.OpReturnAddress, blocksci.blocksci_interface.WitnessPubkeyHashAddress, blocksci.blocksci_interface.PayToWitnessScriptHashAddress]]¶ Construct an address object from an address string
-
address_type_txes
(self: blocksci.blocksci_interface.Blockchain, arg0: int, arg1: int, arg2: blocksci.blocksci_interface.address_type) → List[blocksci::Transaction]¶ Returns a list of all transactions that include outputs of the given address type
-
addresses
(self: blocksci.blocksci_interface.Blockchain, arg0: blocksci.blocksci_interface.address_type) → Union[ranges::v3::any_view<blocksci::ScriptAddress<(blocksci::AddressType::Enum)0>, (ranges::v3::category)1, void>, ranges::v3::any_view<blocksci::ScriptAddress<(blocksci::AddressType::Enum)1>, (ranges::v3::category)1, void>, ranges::v3::any_view<blocksci::ScriptAddress<(blocksci::AddressType::Enum)2>, (ranges::v3::category)1, void>, ranges::v3::any_view<blocksci::ScriptAddress<(blocksci::AddressType::Enum)3>, (ranges::v3::category)1, void>, ranges::v3::any_view<blocksci::ScriptAddress<(blocksci::AddressType::Enum)4>, (ranges::v3::category)1, void>, ranges::v3::any_view<blocksci::ScriptAddress<(blocksci::AddressType::Enum)5>, (ranges::v3::category)1, void>, ranges::v3::any_view<blocksci::ScriptAddress<(blocksci::AddressType::Enum)6>, (ranges::v3::category)1, void>, ranges::v3::any_view<blocksci::ScriptAddress<(blocksci::AddressType::Enum)7>, (ranges::v3::category)1, void>, ranges::v3::any_view<blocksci::ScriptAddress<(blocksci::AddressType::Enum)8>, (ranges::v3::category)1, void>]¶
-
addresses_with_prefix
(self: blocksci.blocksci_interface.Blockchain, arg0: str) → list¶ Find all addresses beginning with the given prefix
-
config
¶ Returns the configuration settings for this blockchain
-
filter_blocks
(filterFunc, start=None, end=None, cpu_count=8)¶ Return all blocks in range which match the given criteria
-
filter_txes
(filterFunc, start=None, end=None, cpu_count=8)¶ Return all transactions in range which match the given criteria
-
heights_to_dates
(df)¶
-
map_blocks
(blockFunc, start=None, end=None, cpu_count=8)¶ Runs the given function over each block in range and returns a list of the results
-
mapreduce_block_ranges
(mapFunc, reduceFunc, init, start=None, end=None, cpu_count=8)¶ Initialized multithreaded map reduce function over a stream of block ranges
-
mapreduce_blocks
(mapFunc, reduceFunc, init, start=None, end=None, cpu_count=8)¶ Initialized multithreaded map reduce function over a stream of blocks
-
mapreduce_txes
(mapFunc, reduceFunc, init, start=None, end=None, cpu_count=8)¶ Initialized multithreaded map reduce function over a stream of transactions
-
outputs_unspent
¶ Returns a list of all of the outputs that are unspent
-
range
(start, end=None)¶
-
segment
(self: blocksci.blocksci_interface.Blockchain, arg0: int, arg1: int, arg2: int) → List[List[blocksci::Block]]¶ Divide the blockchain into the given number of chunks with roughly the same number of transactions in each
-
segment_indexes
(self: blocksci.blocksci_interface.Blockchain, arg0: int, arg1: int, arg2: int) → List[Tuple[int, int]]¶ Return a list of [start, end] block height pairs representing chunks with roughly the same number of transactions in each
-
tx_with_hash
(self: blocksci.blocksci_interface.Blockchain, arg0: str) → blocksci::Transaction¶ This functions gets the transaction with given hash.
Parameters: index (string) – The hash of the transation. Returns: Tx
-