Announcing an updated drawing protocol for the donor lotteries

Up­date 28 Jan 2019: We’ve re­verted to us­ing the origi­nal NIST Bea­con pro­to­col for the draw.

It has come to our at­ten­tion that the pub­lic source of ran­dom­ness used to draw the Effec­tiveAltru­ donor lot­tery — the NIST Ran­dom­ness Bea­con — is not cur­rently op­er­at­ing due to the on­go­ing US gov­ern­ment shut­down. This means our reg­u­lar method of draw­ing win­ning num­bers is un­available.


There have been sev­eral al­ter­na­tive meth­ods sug­gested for a good pub­lic source of ran­dom­ness. After care­ful de­liber­a­tion, we have cho­sen to use the In­cor­po­rated Re­search In­sti­tu­tions for Seis­mol­ogy (IRIS) list of earth­quakes as a ran­dom­ness source. The data in­cludes a range of num­bers that will be im­pos­si­ble to pre­dict in ad­vance, in­clud­ing the lat­i­tude, lon­gi­tude, mag­ni­tude, and depth of the earth­quake.

We will choose the first earth­quake ap­pear­ing on this list of large earth­quakes with a times­tamp im­me­di­ately af­ter the lot­tery draw date.

Speci­fi­cally, we will:

  • Take the nu­meric digits in or­der from the text-for­mat­ted re­sponse of the IRIS API for the rele­vant earth­quake ID (ex­am­ple re­sponse)

  • Calcu­late the SHA256 hash of the re­sult­ing string of digits

  • Use the first 10 hex­adec­i­mal digits of the re­sult­ing SHA256 hash as the win­ning number

We will do the draw­ing at least 24 hours af­ter the draw date to en­sure that IRIS has had time to pro­cess in­com­ing data.

There are two lot­ter­ies up for draw­ing ($100k and $500k), cur­rently with draw times stag­gered by five min­utes. In or­der to en­sure there are two sep­a­rate draw­ings, we will re­set their draw times­tamps to be iden­ti­cal, and then use the first two earth­quake events ap­pear­ing on the list af­ter that times­tamp as fol­lows:

Worked Example

Let’s as­sume that the donor lot­ter­ies in ques­tion closed at mid­night on Jan­uary 23, 2019. The two earth­quake events im­me­di­ately af­ter this times­tamp are 10998501 and 10998539 re­spec­tively.

  • The or­dered digits from the API re­sponse for the first earth­quake are 1099850120190123013843145727667721002000743

  • The SHA256 hash of these char­ac­ters is 3914a0a9b27a061c620ee651f417c4d211b218c41c089c96c8b9ad567d8c

  • The first 10 hex­adec­i­mal char­ac­ters of the hash are 3914a0a9b2, which is 245159209394 in decimal

  • There­fore 245159209394 is the win­ning num­ber for the first ($100k) lot­tery!

  • Re­peat­ing the pro­cess for the sec­ond num­ber gives a win­ning num­ber for the sec­ond ($500k) lot­tery of df4ceccb88/​959068294024

Refer­ence implementation

The fol­low­ing bash script illus­trates the pro­cess for gen­er­at­ing the hashes:


#  Bash script for calcu­lat­ing the win­ning lot­tery num­ber us­ing earth­quake  
#  data from IRIS (In­cor­po­rated Re­search In­sti­tu­tions for Seis­mol­ogy).  
#  Usage:  
#         ./​draw_lot­ iris_id  
#   e.g.  ./​draw_lot­ 10998811  
#  The script works as fol­lows:  
#  - get the re­quest from the IRIS server for the rele­vant event  
#  - trim newl­ines from the re­sponse  
#  - strip the re­sponse to just the nu­meric digits  
#  - get the SHA256 hash of the digit string in bi­nary  
#  - cast the bi­nary hash to a hex­dump (only keep­ing the first line)  
#  - trun­cate the hash to its first 10 char­ac­ters  


curl -s “http://​​ser­​​fd­snws/​​event/​​1/​​query?even­tid=$EVENT_ID&for­mat=text″ \  
 | tr -d ‘\n’ \  
 | awk ‘{gsub(/​​[^0-9]/​​,“”)}1’ \  
 | openssl dgst -sha256 -bi­nary \  
 | xxd -p | head -n 1 \  
 | cut -c −10

Fur­ther info

To avoid any more late-break­ing changes, we’ll com­mit to us­ing this pro­to­col even in the event that the NIST bea­con comes back on­line be­fore the lot­tery draw date.

EDIT 28 Jan 2019: The NIST bea­con has come back on­line. Notwith­stand­ing the state­ment that we would stick with the above pro­to­col, we’ve de­cided that it would be best to re­vert to the NIST Bea­con as our source of ran­dom­ness. That is, the draw­ing pro­ce­dure will be as it origi­nally was (as de­scribed in the donor lot­tery’s method­ol­ogy sec­tion).

If you have any more ques­tions, please com­ment be­low.

Cross­posted from the Cen­tre For Effec­tive Altru­ism blog