Skip to content

Instantly share code, notes, and snippets.

@Magicking
Created March 7, 2016 03:28
Show Gist options
  • Save Magicking/57fb8ff44b6caa5bacec to your computer and use it in GitHub Desktop.
Save Magicking/57fb8ff44b6caa5bacec 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