Skip to content

Instantly share code, notes, and snippets.

View gist:62e07e9234088c476ee286e9016b71b2
#!/usr/bin/env python
import json, cStringIO, traceback, sys, os, urllib2, random, time
blockfilename = '000000000000000001c37467f0843dd9e09536c21938c5c20551191788a70541'
mempoolfilenames = ['00000000000000000008658cdaba34569f00748085df3923cb5287e55a2fe27c',
'000000000000000000328e4b6f34904c9525e4815c1a32a9e55a3ec6b0e5afa6',
'00000000000000000175b9186c4004b77ea9dc61976f4d7aed140d10919d0c05']
debug = '--debug' in sys.argv or '-d' in sys.argv
View simulate_failures.py
from hashlib import sha256
import random
def duplicates_for_shortid(txidsize, mempoolsize_mb=32, mempoolsize_kb=None):
if mempoolsize_kb:
n = int(mempoolsize_kb * 1024.0 / 266)
else:
n = int(mempoolsize_mb * 1024.0 * 1024.0 / 266)
txids = set()
View gist:4fbfdf16c211148fb6b38c050cff87e8
from __future__ import print_function
from base58 import b58encode, b58decode
crypto_data = {
'btc': {'bip44_coin_type': 0x80000000},
'ltc': {'bip44_coin_type': 0x80000002},
'doge': {'bip44_coin_type': 0x80000003},
'bch': {'bip44_coin_type': 0x80000091},
'uno': {'bip44_coin_type': 0x8000005c},
'eth': {'bip44_coin_type': 0x8000003c},
@priestc
priestc / gist:370d3d5639e5b039da845d35831d3d45
Last active Jul 3, 2018
Government regulation of Cryptocurrencies
View gist:370d3d5639e5b039da845d35831d3d45

17 CFR Volume 3 Chapter II, Part 228 - Crypto Assets [Draft]

Philosophy of this regulation

  • To establish a "Review Comittee" of people that perform code reviews on new cryptocurrencies.
  • To avoid badly defined terms like "centralized" and "decentralized" and to instead focus on "open admission" which is easier to define.
  • These Code Reviews will be the basis for rules that exchanges must follow.
  • The Review Process is objective and not designed to handle issues based on subjectivity.
  • The purpose is to encourage investors to invest in the crypto assets based on the most understood technology, and to discourage investiemts on crypto assets based on less understood technology.
@priestc
priestc / gist:5b06e3dc4718d73cd601aff75b13daf4
Created Oct 13, 2017
How the Moneywagon project will handle the possibly new BTC ticker
View gist:5b06e3dc4718d73cd601aff75b13daf4
The moneywagon project provides a symbol normalization service through it's API.
For instance, the HitBTC exchange calls Bitcoin Cash BCC. Most other exchanges
use BCH as the symbol for Bitcoin Cash. If you do a lot of trading, this can
be confusing for you. If you use the Moneywagon software to execute your trades,
you always use the BCH identifier to buy or sell Bitcoin Cash, no matter which
exchange you're dealing with.
Other examples of currencies that have different symbols on different exchanges
are Dash and Myriadcoin. Some exchnages give Dash the symbol "DASH", while others,
such as Wex, call it "DSH". Also Myriadcoin is sometimes called "MYR", and
View gist:09c945cad4ebeaa3f8a35deed1f5a4af
$ moneywagon network-replay btc bch latest --verbose
Getting latest BTC block
* Trying: <Service: BitpayInsight (0 in cache)> btc
Got Response: https://insight.bitpay.com/api/status?q=getLastBlockHash
Got Response: https://insight.bitpay.com/api/block/000000000000000000e3e8cb2e4d6f8a1dc9f777c5502e0161440710adfb7c67
Latest BTC block is #479634
Using BlockDozer for pushing to BCH
Using LocalBitcoinsChain (Insight) for getting BTC transactions
Finished getting block header, 844 transactions in block, will replay 5
View FTC-supply.mediawiki
Era Start Block Start Date End Block Reward per block Total Created This Era (in millions) Total Existing (in millions) Percentage Issued
1 0 04-16-2013 204638 200 40.9276 40.9276 12.18
2 204639 04-25-2014 2100000 80 151.629 192.556 57.31
3 2100001 12-01-2017 4200000 40
View dashrewards.md
block time reward
100 2014-1-19 3:59
200 2014-1-19 4:01 500
300 2014-1-19 4:04
400 2014-1-19 4:06
500 2014-1-19 4:08 500
1000 2014-1-19 4:33 500
2000 2014-1-19 6:25 500
3000 2014-1-19 9:10 500
View gist:715bd684af5bb841ee99aead248cf641
function get_title() {
return document.getElementById("itemTitle").innerText.trim();
}
function voice_announce(msg) {
var utter = new SpeechSynthesisUtterance(msg);
window.speechSynthesis.speak(utter);
}
function total_seconds_remaining() {
@priestc
priestc / cryptotrade.py
Last active Feb 9, 2018
Automatically trade cryptocurrencies
View cryptotrade.py
from moneywagon import get_current_price, get_address_balance
from moneywagon.tx import Transaction
from bitcoin import privkey_to_address
data = [
['btc', 'KwsccfDeJkrW6ZgMH6AJ7apNGncMVEagNWhTwq9MJnqoKp58i1MG'],
['ltc', 'T3ht4QWpi8q6sQKDpj7AKwMkDeFfZKbaBibiodmtsm1xqhcTJZT1']
]
## DETERMINE IF TRADE IS NEEDED
You can’t perform that action at this time.