Last active
June 10, 2018 21:04
-
-
Save k9ert/554680ec8b798e7b841d1a2dba777104 to your computer and use it in GitHub Desktop.
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
| #!/usr/bin/env python3 | |
| import sys | |
| if sys.version_info.major < 3: | |
| sys.stderr.write('Sorry, Python 3.x required by this example.\n') | |
| sys.exit(1) | |
| import requests | |
| import bitcoin | |
| import bitcoin.rpc | |
| print("This program is calculating how many transactions disappeared after the \ | |
| Bitcoin-fork on 2015-07-05 21:14:14 \ | |
| see also: \ | |
| https://blockchain.info/orphaned-blocks?offset=300 \ | |
| https://www.heise.de/ct/ausgabe/2018-8-Wie-abgeschlossene-Transaktionen-aus-der-Blockchain-verschwinden-4004027.html ") | |
| proxy = bitcoin.rpc.RawProxy() | |
| block = proxy.getblock(proxy.getblockhash(363997)) | |
| print("Number of transaction in 363997 : " + str(len(block["tx"]))) | |
| oktxs=["test"] | |
| for tx in block["tx"]: | |
| oktxs.append(tx) | |
| block = proxy.getblock(proxy.getblockhash(363998)) | |
| print("Number of transaction in 363998 : " +str(len(block["tx"]))) | |
| for tx in block["tx"]: | |
| oktxs.append(tx) | |
| block = proxy.getblock(proxy.getblockhash(363999)) | |
| print("Number of transaction in 363999 : " +str(len(block["tx"]))) | |
| for tx in block["tx"]: | |
| oktxs.append(tx) | |
| in_tx=0 | |
| out_tx = 0 | |
| resp = requests.get(url="https://blockchain.info/rawblock/000000000000000003ae1223f4926ec86100885cfe1484dc52fd67e042a19b12") | |
| txs = resp.json()["tx"] | |
| for tx in txs: | |
| if tx["hash"] in oktxs: | |
| in_tx=in_tx+1 | |
| else: | |
| out_tx = out_tx +1 | |
| resp = requests.get(url="https://blockchain.info/rawblock/00000000000000000063f97f292fb559773437fb3558c474efec6053a7b0d5a2") | |
| txs = resp.json()["tx"] | |
| for tx in txs: | |
| if tx["hash"] in oktxs: | |
| in_tx=in_tx+1 | |
| else: | |
| out_tx = out_tx +1 | |
| resp = requests.get(url="https://blockchain.info/rawblock/000000000000000012dbd422d7bf1c4b55982c37b390d4613dcee00d31741c6a") | |
| txs = resp.json()["tx"] | |
| for tx in txs: | |
| if tx["hash"] in oktxs: | |
| in_tx=in_tx+1 | |
| else: | |
| out_tx = out_tx +1 | |
| print("in_tx (transactions which were also on the other fork):"+ str(in_tx)) | |
| print("out_tx (transactions which were also on the other fork):"+ str(out_tx)) | |
| print("sum of tranactions on the wrong fork:"+ str(in_tx + out_tx) ) | |
| print("therefore the percentage of tranactions suffering: %"+str(out_tx / (in_tx + out_tx) * 100) ) |
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
| This program is calculating how many transactions disappeared after the | |
| Bitcoin-fork on 2015-07-05 21:14:14 | |
| see also: | |
| https://blockchain.info/orphaned-blocks?offset=300 | |
| https://www.heise.de/ct/ausgabe/2018-8-Wie-abgeschlossene-Transaktionen-aus-der-Blockchain-verschwinden-4004027.html | |
| Number of transaction in 363997 : 1142 | |
| Number of transaction in 363998 : 2315 | |
| Number of transaction in 363999 : 1599 | |
| in_tx (transactions which were also on the other fork):1689 | |
| out_tx (transactions which were also on the other fork):166 | |
| sum of tranactions on the wrong fork:1855 | |
| therefore the percentage of tranactions suffering: %8.94878706199461 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment