create_block_iterator method

Future<RegisteredIterator> create_block_iterator(
  1. ParamsOfCreateBlockIterator params
)

Block iterator uses robust iteration methods that guaranties that every block in the specified range isn't missed or iterated twice.

Iterated range can be reduced with some filters:

  • start_time – the bottom time range. Only blocks with gen_utime more or equal to this value is iterated. If this parameter is omitted then there is no bottom time edge, so all blocks since zero state is iterated.
  • end_time – the upper time range. Only blocks with gen_utime less then this value is iterated. If this parameter is omitted then there is no upper time edge, so iterator never finishes.
  • shard_filter – workchains and shard prefixes that reduce the set of interesting blocks. Block conforms to the shard filter if it belongs to the filter workchain and the first bits of block's shard fields matches to the shard prefix. Only blocks with suitable shard are iterated.

Items iterated is a JSON objects with block data. The minimal set of returned fields is:

id
gen_utime
workchain_id
shard
after_split
after_merge
prev_ref {
   root_hash
}
prev_alt_ref {
   root_hash
}

Application can request additional fields in the result parameter.

Application should call the remove_iterator when iterator is no longer required.

Implementation

Future<RegisteredIterator> create_block_iterator(
    ParamsOfCreateBlockIterator params) async {
  final res = await _tonCore.request(
      'net.create_block_iterator', params.toString());
  return RegisteredIterator.fromMap(res);
}