Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DuniterPy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
python
DuniterPy
Commits
c61a7855
Commit
c61a7855
authored
4 years ago
by
Hugo Trentesaux
Committed by
Vincent Texier
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[feat] example for loading local blockchain
parent
8d1fe3bf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!128
Release 0.62.0
,
!124
#130: Support reading Duniter's local json blockchain
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/load_local_blockchain.py
+11
-0
11 additions, 0 deletions
examples/load_local_blockchain.py
with
11 additions
and
0 deletions
examples/load_local_blockchain.py
0 → 100644
+
11
−
0
View file @
c61a7855
# 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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment