Skip to content

Instantly share code, notes, and snippets.

@emre

emre/exp.py Secret

Created December 20, 2017 22:43
Show Gist options
  • Save emre/5550df1b9bf33e0f071ea635b8f09145 to your computer and use it in GitHub Desktop.
Save emre/5550df1b9bf33e0f071ea635b8f09145 to your computer and use it in GitHub Desktop.
exp.py
import time
from steem import Steem
from pprint import pprint
s = Steem()
def parse_block(block_height):
block = s.get_block(block_height)
for transaction in block["transactions"]:
for operation in transaction['operations']:
operation_type, operation_data = operation[0:2]
print("Operation: %s" % operation_type)
pprint(operation_data)
def get_last_block_height():
props = s.get_dynamic_global_properties()
return props['last_irreversible_block_num']
def listen_blocks(starting_point=None):
if not starting_point:
starting_point = get_last_block_height()
while True:
while(get_last_block_height() - starting_point) > 0:
starting_point += 1
parse_block(starting_point)
print("Sleeping for 3 seconds...")
time.sleep(3)
listen_blocks(starting_point=18263207)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment