This extensions is meant as a fallback option that uses only existing Substrate RPC methods.
However, it is important to note that this fallback implementation is significantly inefficient, and it is encouraged to utilize third-party search indices where possible for optimal search performance.
substrate=SubstrateInterface(url="ws://127.0.0.1:9944")# Provide maximum block range (bigger range descreases performance) substrate.register_extension(SubstrateNodeExtension(max_block_range=100))
# Returns all `Balances.Transfer` events from the last 30 blocksevents=substrate.extensions.filter_events(pallet_name="Balances",event_name="Transfer",block_start=-30)
# All Timestamp extrinsics in block range #3 until #6extrinsics=substrate.extensions.filter_extrinsics(pallet_name="Timestamp",block_start=3,block_end=6)
# Search for block number corresponding a specific datetimeblock_datetime=datetime(2020,7,12,0,0,0)block_number=substrate.extensions.search_block_number(block_datetime=block_datetime)