Skip to content

Instantly share code, notes, and snippets.

@Aareon
Last active August 17, 2017 16:45
Show Gist options
  • Select an option

  • Save Aareon/e8cbbaf5e453f7e8d854a65bb4957ef6 to your computer and use it in GitHub Desktop.

Select an option

Save Aareon/e8cbbaf5e453f7e8d854a65bb4957ef6 to your computer and use it in GitHub Desktop.
import sqlite3
def get_block():
conn = sqlite3.connect("static/ledger.db") # open to select the last tx to create a new hash from
conn.text_factory = str
c = conn.cursor()
c.execute("SELECT timestamp,block_height FROM transactions WHERE reward = 10 and block_height >= 20000")
return c.fetchall()
if __name__ == "__main__":
l = []
y = 0
result = get_block()
for x in result:
ts_difference = float(x[0]) - float(y)
print("{} {}".format(x[1], ts_difference))
l.append(ts_difference)
y = x[0]
@hclivess
Copy link

Hi, this can be merged, script is outdated, we need to change "reward = 10" to "reward != 0" too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment