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
  • Select an option

  • Save dw-io/5816143e091bc8cdcc4c to your computer and use it in GitHub Desktop.

Select an option

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
coldminting_addr, redeemscript = make_cold('NWNwLaXhZbcJom6u97smZEKB38z8uACFQg', 'NbNKWKapLvHtk4GWWXQuccQrbSxpxmBbvP')
#coldminting_addr is nNy7UyPnJp3B4QUB1a7pAGP1tCtJze3btZ
#redeemscript is 76a9c0631472caf23efb189034f583de35e0dbe5c26fe62a2d6714a985aa03d0e15d75b57fed8b863eb9f11f3fd5406888ac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment