-
Notifications
You must be signed in to change notification settings - Fork 2
Get Blockchain info
wirfeon edited this page Feb 17, 2021
·
1 revision
from xpxchain import models
from xpxchain import client
ENDPOINT = '//localhost:3000'
with client.BlockchainHTTP(ENDPOINT) as http:
height = http.get_blockchain_height()
print(height)
- Following parameters required:
- Height - height of block to get info from
from xpxchain import models
from xpxchain import client
ENDPOINT = '//localhost:3000'
height = 100
with client.BlockchainHTTP(ENDPOINT) as http:
block = http.get_block_by_height(height)
print(block)
- Following parameters required:
- Height - height of block to get info from
- Limit - how many block infos to return
from xpxchain import models
from xpxchain import client
ENDPOINT = '//localhost:3000'
height = 100
limit = 10
with client.BlockchainHTTP(ENDPOINT) as http:
blocks = http.get_blocks_by_height_with_limit(height, limit)
print(blocks)
- Following parameters required:
- Height - height of block to get transactions from
from xpxchain import models
from xpxchain import client
ENDPOINT = '//localhost:3000'
height = 1
with client.BlockchainHTTP(ENDPOINT) as http:
block = http.get_block_transactions(height)
print(block)
from xpxchain import models
from xpxchain import client
ENDPOINT = '//localhost:3000'
with client.BlockchainHTTP(ENDPOINT) as http:
score = http.get_blockchain_score()
print(score)