Skip to content

Repository files navigation

BitOasis / CryptoCorp's Multisig python API implementation using the pycoin library. Build Status

Currently this requires the p2sh branch of https://github.com/devrandom/pycoin.git.

Examples

export PYCOIN_CACHE_DIR=~/.pycoin_cache
export PYCOIN_SERVICE_PROVIDERS=BLOCKR_IO:BLOCKCHAIN_INFO:BITEASY:BLOCKEXPLORER
digital_oracle --email a@b.com create P:aaa P:bbb
# not recommended - both keys on one machine
digital_oracle --email a@b.com create P:aaa xpub...
digital_oracle -i 0/0/123 address P:aaa xpub...
# shows deposit address
tx -i SOURCE_ADDRESS DESTINATION_ADDRESS/100000 CHANGE_ADDRESS -o tx.bin
digital_oracle sign P:aaa xpub... tx.bin -i 0/0/123
# signs and shows tx hex)
digital_oracle sign P:aaa xpub... tx.bin -i 0/0/123 0/0/124 -c - 0/1/44
# signs tx with two inputs and two outputs. The second output is change.

Programmatic Examples

frommultisigcoreimport*frommultisigcore.providers.electrumimportElectrumServicefrommultisigcore.oracleimportPersonalInformation, OracleUnknownKeychainExceptionfrommultisigcore.hierarchyimportMasterKey, MultisigAccountfrompycoin.servicesimportinsight, get_tx_dbfrompycoin.serializeimportb2h, h2bsecrets= [WALLET_PHRASE, RECOVERY_PHRASE] # don't put both phrases on one machine in real lifekeys= [MasterKey.from_master_secret(x).bip44_account(0) forxinsecrets]
account=MultisigAccount(keys, complete=False)
oracle=Oracle(account, tx_db=get_tx_db())
oracle.verbose=0parameters= {"levels": [ {
"asset": "BTC",
"period": 3600,
"value": 1.0
}]}
try: oracle.get()
exceptOracleUnknownKeychainException: oracle.create(parameters, PersonalInformation())
print("http://btc.blockr.io/address/info/"+account.address(0))
account.set_lookahead(0)
service=insight.InsightService('https://insight.bitpay.com/')
#service = ElectrumService("electrum.no-ip.org", 50002)account._provider=serviceprint(account.balance())
print(oracle._url())
tx=account.tx([(DEST_ADDRESS, 50000)])
account.sign(tx)
res=oracle.sign(tx, "spend003")
print(res)
print(res.transaction.as_hex())

About

Multisig python API implementation using the pycoin library

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages