Skip to content

Instantly share code, notes, and snippets.

@dckc
Created September 23, 2020 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dckc/130bff616cd2a3e7322aadd953ce6500 to your computer and use it in GitHub Desktop.
Save dckc/130bff616cd2a3e7322aadd953ce6500 to your computer and use it in GitHub Desktop.
# pip install pyrchain
# pip install requests
from rchain.client import RClient
from rchain.param import testnet_param
from itertools import accumulate
from datetime import datetime
import requests
step = 50
# start 2:51pm CT Sat 5 Sep 2020
# https://discord.com/channels/375365542359465989/717821191728922684/751892352662241331
# DEPLOY ID (signature)" "c4acf82c128361fbe7df590284034ec2a3f5696ced540b7d6493395a1acc6e7340c668fcbc44d18252cc22707ecc8149b8b4a8fee7cc0639e23608b2996e4e6d1b # noqa
start = 372418
start = 377767
# transaction_host = 'http://localhost:7070'
transaction_host = 'http://kc-strip.madmode.com:7070'
node = 'observer.testnet.rchain.coop'
# node = 'node0.testnet.rchain-dev.tk'
with RClient(node, 40401,
(('grpc.keepalive_time_ms', 10000),
('grpc.max_receive_message_length', 1619430400),)) as client:
client.install_param(testnet_param)
latest_block_number = client.show_blocks(1)[0].blockNumber
def fetch_total_cost(s, e):
blocks = client.get_blocks_by_heights(s, e-1)
for b in blocks:
dt = datetime.fromtimestamp(b.timestamp / 1000.0)
print(b.blockNumber, dt)
requests.get('{}/getTransaction/{}'.format(
transaction_host, b.blockHash))
return e
list(accumulate(range(start, latest_block_number, step), fetch_total_cost))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment