diff --git a/examples/load_local_blockchain.py b/examples/load_local_blockchain.py new file mode 100644 index 0000000000000000000000000000000000000000..260f49fda356397d022de5b7a80a1ba93f4a6121 --- /dev/null +++ b/examples/load_local_blockchain.py @@ -0,0 +1,11 @@ +# this example lets you load locally copy of duniter blockchain into duniterpy objects +# by default, it searches in ~/.config/duniter/duniter_default/g1/ + +from duniterpy.helpers.blockchain import load + +bc = load() # gets blockchain iterator +b = next(bc) # gets block +b.number # should return 0 +# you can access all properties of this block through it's duniterpy objects attributes +next(bc).number # should return 1 +next(bc).number # should return 2 (and so on) \ No newline at end of file