Skip to content

Instantly share code, notes, and snippets.

View jtoomim's full-sized avatar

Jonathan Toomim jtoomim

View GitHub Profile

Keybase proof

I hereby claim:

  • I am jtoomim on github.
  • I am jtoomim (https://keybase.io/jtoomim) on keybase.
  • I have a public key ASDod9SqHSH1rw-M-c2s0lGUKkEwdOt82rJK793twLQjVAo

To claim this, I am signing this object:

@jtoomim
jtoomim / subreddit.py
Created April 28, 2019 12:59
Quick script for checking how many comments occurred in a month on a subreddit using pushshift.io
import urllib.request, json
# https://api.pushshift.io/reddit/comment/search/?subreddit=btc&aggs=subreddit&size=0&after=2015-09-01&before=2016-01-01&author=!automoderator
doc_counts = {}
sub = 'btc'
for y in range(2011, 2020):
for m in range(1, 13):
if m == 12:
nm = 1 # next month
15.2879120879 bits/tx for a 910 tx block or about 13.55 excluding coinbase/header 99.42%
20.7946127946 bits/tx for a 297 tx block or about 14.33 excluding coinbase/header 99.41%
24.7195767196 bits/tx for a 189 tx block or about 14.14 excluding coinbase/header 99.51%
368.0 bits/tx for a 7 tx block or about 41.14 excluding coinbase/header 87.15%
22.7659574468 bits/tx for a 188 tx block or about 14.04 excluding coinbase/header 99.22%
18.6136363636 bits/tx for a 352 tx block or about 14.11 excluding coinbase/header 99.37%
19.9882697947 bits/tx for a 341 tx block or about 14.36 excluding coinbase/header 99.29%
20.3800904977 bits/tx for a 442 tx block or about 15.19 excluding coinbase/header 99.11%
18.7796610169 bits/tx for a 354 tx block or about 14.31 excluding coinbase/header 99.44%
37.2602739726 bits/tx for a 73 tx block or about 14.79 excluding coinbase/header 98.93%
@jtoomim
jtoomim / stresstest_block_prop_early_draft.tsv
Created September 8, 2018 18:34
BCH stresstest block propagation draft results
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 14. in line 1.
['14.161.3.136', '198.48.143.147', '208.84.223.121', '24.149.8.238', '37.221.198.57', '50.57.119.10', '63.13.62.197', '84.209.133.114', '88.198.39.205']
14.161. 198.48. 208.84. 24.149. 37.221. 50.57.1 63.13.6 84.209. 88.198. first_seen timestamp size (kb) kB/s
000000000000000000b63de5a36f29fb69119a3b55bcbdb961a9744bcacf86f4 1 0 1 1 2018-08-29 03:11:59 1535512299 107 0.000030
00000000000000000109990e189bee722307dda0b21406306f903083467cafe3 1 0 1 1 2018-08-29 03:28:04 1535513258 136 0.000038
00000000000000000102bff1bdb95fd3cdd5a91912cc714677bbc30cbd743b1c 1 0 1 1 2018-08-29 03:39:13 1535513918 96 0.000027
0000000000000000000aedb3aff750d3f8dd42fd73cd7d21776298051468b7d9 0 0 0 0 2018-08-29 03:41:08 1535514045 5 0.000001
0000000000000000014fe6a0c57324a8ad999907c98e14dc2dabef1adec40bb3 1 0 1 1 2018-08-29 03:53:51 1535514819 58 0.000016
000000000000000001ecfa089ddc0e4dce2324ab563366f1fa00
import random
def get_reward(shares):
return shares[0] / float(1+sum(shares[1:]))
def run_sim(low, high, N):
# preload the share chain
shares = [random.randint(low, high) for i in range(N)]
# -*- coding: utf-8 -*-
all_colors = ['#aec7e8',
'#ff7f0e',
'#1f77b4',
'#ffbb78',
'#2ca02c',
'#98df8a',
'#d62728',
'#ff9896',
'#9467bd',
2015-12-04 22:38:24.609066 got inv: block 000000000000004f4c5d910ec28bf87ba4bb8da3e9c8b951aa7717aa5dee44b0 new peer=149
2015-12-04 22:38:24.609237 sending: getheaders (1029 bytes) peer=149
2015-12-04 22:38:24.609407 getheaders (608187) 000000000000004f4c5d910ec28bf87ba4bb8da3e9c8b951aa7717aa5dee44b0 to peer=149
2015-12-04 22:38:24.609484 sending: getdata (37 bytes) peer=149
2015-12-04 22:38:25.283993 received: headers (82 bytes) peer=149
2015-12-04 22:38:25.498568 got inv: block 000000000000004f4c5d910ec28bf87ba4bb8da3e9c8b951aa7717aa5dee44b0 have peer=334
2015-12-04 22:38:25.887277 received: addr (35 bytes) peer=320
2015-12-04 22:38:26.034848 got inv: block 000000000000004f4c5d910ec28bf87ba4bb8da3e9c8b951aa7717aa5dee44b0 have peer=4
2015-12-04 22:38:26.282229 received: merkleblock (101711 bytes) peer=149
2015-12-04 22:38:26.282482 received thin block 000000000000004f4c5d910ec28bf87ba4bb8da3e9c8b951aa7717aa5dee44b0 peer=149
Loading files from /bulk/home/jtoomim/newan/../indlogs/byname/processed
Processing log file: ../indlogs/byname/processed/_74_82_233_205.blocks
Finished log file: ../indlogs/byname/processed/_74_82_233_205.blocks
Processing log file: ../indlogs/byname/processed/_139_162_2_241.blocks
Error with 1EF22685544A989C8AB828E0F99D60D4D6B53BE88BC34908ECA3: Expected size 112501, but found size -1
Error with 1233A8949D69497F5E2AED3226FB003F17870485759A0C385DCF: Expected size 124579, but found size -1
Error with 8677F483A0BE9C666867D2F1A039519322E09CFBEEBF6F4B07: Expected size 39957, but found size -1
Error with 6C6DE8B4A4AADDAA048E554930D7318D9DB7BB50111FCBB611D: Expected size 24539, but found size -1
Error with 149E58B91ADC076FCABA545CA23F512B2D0533216FBA9F454879: Expected size 78458, but found size -1
Error with 78487281A29D57D559539F97E1FB3C4DAF2C828FD94C536ECFF: Expected size 27536, but found size -1
2015-12-02 14:00:54.586075 CreateNewBlock2(): total size 393639
2015-12-02 14:00:54.588090 CNB2 times: 0 0 0 2 46 0 1 51 0 23 6
2015-12-02 14:00:55.801055 submitblock: hash=000000000005d231b0b93bcac8dcb3910bb1fbebc9475e6930ba03b846986239
2015-12-02 14:00:55.801218 ERROR: CheckProofOfWork(): hash doesn't match nBits
2015-12-02 14:00:55.801267 ERROR: CheckBlockHeader(): proof of work failed
2015-12-02 14:00:55.801311 ERROR: ProcessNewBlock: CheckBlock FAILED
2015-12-02 14:00:56.541240 submitblock: hash=00000000000fb4c52af547c787c8f944aee79e3d4fc46327810e20ee0a696904
2015-12-02 14:00:56.544688 - Load block from disk: 0.00ms [0.00s]
2015-12-02 14:00:56.610185 - Connect 245 transactions: 41.67ms (0.170ms/tx, 0.017ms/txin) [0.04s]
2015-12-02 14:00:56.610291 - Verify 2494 txins: 41.80ms (0.017ms/txin) [0.04s]
[2015-11-22 00:40:18.481] SUBMIT BLOCK RETURNED: inconclusive
[2015-11-22 00:40:18.481] Submitted, but rejected block 606600
[2015-11-22 00:40:18.488] Possible block solve diff 46.756359 !
[2015-11-22 00:40:18.582] Submitting block data!
[2015-11-22 00:40:23.654] Parent process ckpool received signal 2, shutting down
[2015-11-22 00:40:46.763] File /tmp/ckpool/generator.pid exists
[2015-11-22 00:40:46.764] File /tmp/ckpool/stratifier.pid exists
[2015-11-22 00:40:46.764] File /tmp/ckpool/connector.pid exists
[2015-11-22 00:40:46.765] ckpool generator starting
[2015-11-22 00:40:46.765] ckpool stratifier starting