multisig-hsm/reference/finish.py
mineracks 7a17ffd12e Initial public release — multisig HSM reference + recipe book
Open-source 2-of-3 policy-enforced threshold HSM: auto-signs cold→hot treasury
refills under on-device Coldcard policy, no human in the loop. Includes the full
operator manual + quick-start, the reference coordinator/signing code, and a
signer-host bootstrap. No keys, seeds, or secrets — placeholders only.

Live signet demo: https://multisighsm.mineracks.com

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 13:56:51 +10:00

22 lines
1.1 KiB
Python

import subprocess, json, os
V='27.0'; DATA=os.path.expanduser('~/cksim/regtest-data')
CLI=os.path.expanduser(f'~/bitcoin-{V}/bin/bitcoin-cli')
def bc(*a, wallet=None):
base=[CLI,f'-datadir={DATA}','-rpcport=18999','-rpcuser=ck','-rpcpassword=ckms']
if wallet: base.append(f'-rpcwallet={wallet}')
r=subprocess.run(base+list(a),capture_output=True,text=True)
if r.returncode: raise SystemExit(f'{a} FAIL {r.stderr.strip()}')
return r.stdout.strip()
s1=open(os.path.expanduser('~/cksim/signed1.psbt')).read().strip()
s2=open(os.path.expanduser('~/cksim/signed2.psbt')).read().strip()
comb=bc('combinepsbt', json.dumps([s1,s2]))
fin=json.loads(bc('finalizepsbt', comb))
print('PSBT_COMPLETE:', fin['complete'])
txid=bc('sendrawtransaction', fin['hex'])
print('BROADCAST_TXID:', txid)
mineaddr=bc('getnewaddress', wallet='miner')
bc('generatetoaddress','1',mineaddr, wallet='miner')
tx=json.loads(bc('gettransaction', txid, wallet='ckms23-watch'))
print('CONFIRMATIONS:', tx.get('confirmations'))
print('WATCH_BALANCE_AFTER:', bc('getbalance', wallet='ckms23-watch'))