Created
December 25, 2020 22:08
-
-
Save fiatjaf/8d35978806bcbf56c4285e9f38f04203 to your computer and use it in GitHub Desktop.
RSKBLOCK merge mine scanner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bitcoin-requests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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