https://github.com/devrandom/multisig-core
Multisig python API implementation using the pycoin library
https://github.com/devrandom/multisig-core
Last synced: 3 months ago
JSON representation
Multisig python API implementation using the pycoin library
- Host: GitHub
- URL: https://github.com/devrandom/multisig-core
- Owner: devrandom
- License: mit
- Created: 2015-03-04T21:12:27.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-08-05T04:30:27.000Z (almost 10 years ago)
- Last Synced: 2025-01-31T22:06:37.618Z (5 months ago)
- Language: Python
- Homepage: https://cryptocorp.co/
- Size: 315 KB
- Stars: 0
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
BitOasis / CryptoCorp's Multisig python API implementation using the pycoin library.
[](https://travis-ci.org/devrandom/multisig-core)Currently this requires the `p2sh` branch of `https://github.com/devrandom/pycoin.git`.
Examples
===
```bash
export PYCOIN_CACHE_DIR=~/.pycoin_cache
export PYCOIN_SERVICE_PROVIDERS=BLOCKR_IO:BLOCKCHAIN_INFO:BITEASY:BLOCKEXPLORERdigital_oracle --email [email protected] create P:aaa P:bbb
# not recommended - both keys on one machinedigital_oracle --email [email protected] create P:aaa xpub...
digital_oracle -i 0/0/123 address P:aaa xpub...
# shows deposit addresstx -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
===```python
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())
```