class TestSplitUtxos(unittest.TestCase): def setUp(self): self.api = BtcTxStore(dryrun=True, testnet=True) def test_singleinput(self): wif = "cNHPbjVpkv4oqqKimBNp1UfQ2dhjETtRZw4KkHWtPgnU36SBtXub" # address n4RHA7mxH8EYV7wMS8evtYRYwCpQYz6KuE txids = self.api.splitutxos(wif, 10000000) # 100mBTC print("TestSplitUtxos txids:", len(txids)) self.assertEqual(len(txids), 1) def test_manyinputs(self): wif = "cRoboMG5KM19VP8ZcVCDXGCfi1JJraKpw58ofe8v57j7vqDxaQ5m" # address mqox6abLAiado9kFvX3EsHaVFbYVimSMCK txids = self.api.splitutxos(wif, 100000) # 1mBTC print("TestSplitUtxos txids:", len(txids)) self.assertEqual(len(txids), 6)
#!/usr/bin/env python # coding: utf-8 # Copyright (c) 2015 Fabian Barkhau <*****@*****.**> # License: MIT (see LICENSE file) from __future__ import print_function from __future__ import unicode_literals from btctxstore import BtcTxStore # Please do not spend the testnet coins is this wallet # or the example will fail due to lack of funds. wif = "cUZfG8KJ3BrXneg2LjUX4VoMg76Fcgx6QDiAZj2oGbuw6da8Lzv1" # use testnet and dont post tx to blockchain for example api = BtcTxStore(testnet=True, dryrun=True) limit = 10000000 # 0.1BTC txids = api.splitutxos(wif, limit) print(txids)