From d0027cd0738d47ee1ce74300031c3e546572e1fd Mon Sep 17 00:00:00 2001 From: inpharmaticist <49789899+inpharmaticist@users.noreply.github.com> Date: Sat, 21 Jun 2025 04:44:37 +0000 Subject: [PATCH] Add files via upload --- stamp.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 stamp.py diff --git a/stamp.py b/stamp.py new file mode 100644 index 0000000..ec306b4 --- /dev/null +++ b/stamp.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +import os +import json +import sys +import datetime + +def getblockhash(block): + return json.loads(os.popen('bitcoin-cli getblockstats '+str(block)).read())['blockhash'] + +def getblocktimestamp(block): + return str(json.loads(os.popen('bitcoin-cli getblockstats '+str(block)).read())['time']) + +def readablets(): + return datetime.datetime.now().strftime('%Y%m%d%H%M') + +try: + argument = sys.argv[1] +except: + argument = 'test' + +try: + argument = os.popen("echo '"+argument+"'|gpg --clear-sign").read() +except: + True + +try: + currentblock = int(os.popen('bitcoin-cli getblockcount').read().splitlines()[0]) +except: + currentblock = os.popen('curl -sSL "https://mempool.space/api/blocks/tip/height"').read() + +tosign = argument+""" +Block Hash Timestamp +"""+str(currentblock)+' '+getblockhash(currentblock)+' '+getblocktimestamp(currentblock)+' '+""" +"""+str(currentblock-1)+' '+getblockhash(currentblock-1)+' '+getblocktimestamp(currentblock-1)+' '+""" +"""+str(currentblock-2)+' '+getblockhash(currentblock-2)+' '+getblocktimestamp(currentblock-2) + +ts=readablets() +with open('ots_stamp_'+ts+'.txt', "w") as write: + write.write(tosign) +os.system('ots stamp ots_stamp_'+ts+'.txt') \ No newline at end of file