Skip to content

Instantly share code, notes, and snippets.

@dw-io
Forked from Magicking/coldminting.py
Last active March 7, 2016 16:25
Show Gist options
  • Save dw-io/5816143e091bc8cdcc4c to your computer and use it in GitHub Desktop.
Save dw-io/5816143e091bc8cdcc4c to your computer and use it in GitHub Desktop.
Coldminting redeemscript generation
#using pycoin from https://github.com/NeuCoin/pycoin
from pycoin.tx.script import tools
from pycoin.encoding import a2b_hashed_base58, hash160
from pycoin.serialize import b2h
from pycoin.tx.pay_to import ScriptPayToScript
def make_cold(mint, spend):
script_coldminting = 'OP_DUP OP_HASH160 OP_MINT OP_IF %s OP_ELSE %s OP_ENDIF OP_EQUALVERIFY OP_CHECKSIG'
mint_b58 = a2b_hashed_base58(mint)
spend_b58 = a2b_hashed_base58(spend)
compiled = tools.compile(script_coldminting % (b2h(mint_b58[1:]), b2h(spend_b58[1:])))
redeemscript = b2h(compiled)
pts = ScriptPayToScript(hash160(compiled))
addr = pts.info('NEU')['address']
return addr, redeemscript
mint = 'NWNwLaXhZbcJom6u97smZEKB38z8uACFQg' #REPLACE WITH YOUR MINT ADDRESS
spend = 'NbNKWKapLvHtk4GWWXQuccQrbSxpxmBbvP' #REPLACE WITH YOUR SPEND ADDRESS
coldminting_addr, redeemscript = make_cold(mint,spend)
print "The Cold Miniting Address is: %s" % coldminting_addr
print "The redeemScript is: %s" % redeemscript
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment