Skip to content

tomholub/multisig-core

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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 [email protected] create P:aaa P:bbb
       # not recommended - both keys on one machine

    digital_oracle --email [email protected] 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

    from multisigcore import *
    from multisigcore.providers.electrum import ElectrumService
    from multisigcore.oracle import PersonalInformation, OracleUnknownKeychainException
    from multisigcore.hierarchy import MasterKey, MultisigAccount
    from pycoin.services import insight, get_tx_db
    from pycoin.serialize import b2h, h2b
    
    secrets = [WALLET_PHRASE, RECOVERY_PHRASE] # don't put both phrases on one machine in real life
    keys = [MasterKey.from_master_secret(x).bip44_account(0) for x in secrets]
    account = MultisigAccount(keys, complete=False)
    oracle = Oracle(account, tx_db=get_tx_db())
    oracle.verbose = 0
    parameters = {"levels": [ {
                              "asset": "BTC",
                              "period": 3600,
                              "value": 1.0
                          }]}
    try: oracle.get()
    except OracleUnknownKeychainException: 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 = service
    print(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

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%