Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
RSKBLOCK merge mine scanner
bitcoin-requests
from bitcoin_requests import BitcoinRPC
bitcoin = BitcoinRPC("http://127.0.0.1:8332", "username", "password")
last_block = bitcoin.getblockchaininfo()["blocks"]
rskblocks = 0
totalblocks = 0
for n in range(last_block, last_block - 14400, -1):
totalblocks += 1
coinbase = bitcoin.getblock(bitcoin.getblockhash(n), 2)["tx"][0]
for output in coinbase["vout"]:
if "52534b424c4f434b" in output["scriptPubKey"]["hex"]:
# OP_RETURN RSKBLOCK
print(n, "RSK")
rskblocks += 1
break
else:
print(n, "---")
print("total blocks", totalblocks)
print("total rskblocks", rskblocks)
print("rsk %", 100 * rskblocks / totalblocks)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment