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

address_count(address_type: blocksci.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).

Return type:int
address_from_index(index: int, type: blocksci.address_type) → Address

Construct an address object from an address num and type

Return type:Address
address_from_string(address_string: str) → Optional[Address]

Construct an address object from an address string

Return type:Optional[Address]
addresses(address_type: blocksci.address_type) → Union[blocksci.NonstandardAddressRange, blocksci.PubkeyAddressRange, blocksci.PubkeyHashAddressRange, blocksci.MultisigPubkeyRange, blocksci.ScriptHashAddressRange, blocksci.MultisigAddressRange, blocksci.OpReturnRange, blocksci.WitnessPubkeyHashAddressRange, blocksci.WitnessScriptHashAddressRange]

Return a range of all addresses of the given type

addresses_with_prefix(prefix: str) → list

Find all addresses beginning with the given prefix

Return type:list
blocks

Returns a range of all the blocks in the chain

Type:blocksci.BlockRange
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)

Convert a pandas data frame with a block height index into a frame with a block time index

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=(no default), start=None, end=None, cpu_count=8)

Initialized multithreaded map reduce function over a stream of block ranges

mapreduce_blocks(mapFunc, reduceFunc, init=(no default), start=None, end=None, cpu_count=8)

Initialized multithreaded map reduce function over a stream of blocks

mapreduce_txes(mapFunc, reduceFunc, init=(no default), start=None, end=None, cpu_count=8)

Initialized multithreaded map reduce function over a stream of transactions

most_valuable_addresses() → Dict[int, Address]

Get a list of the top 100 most valuable addresses

range(start, end=None) → blocksci.BlockRange

Return the range of blocks mined between the given dates

reload() → None

Reload the blockchain to make new blocks visible (Invalidates current BlockSci objects)

tx_with_hash(tx_hash: str) → blocksci.Tx

This functions gets the transaction with given hash.

Return type:blocksci.Tx
tx_with_index(index: int) → blocksci.Tx

This functions gets the transaction with given index.

Return type:blocksci.Tx