1200wd / bitcoinlib

Bitcoin and other Cryptocurrencies Library for Python. Includes a fully functional wallet, Mnemonic key generation and management and connection with various service providers to receive and send blockchain and transaction information.
http://bitcoinlib.readthedocs.io/
GNU General Public License v3.0
606 stars 201 forks source link

Error with sending transaction on Ubuntu #325

Closed NoTUsR closed 9 months ago

NoTUsR commented 1 year ago
def create_wallet(wallet_name: str, network: str = 'btc'):
    try:
        w = Wallet.create(wallet_name, witness_type='segwit', network=network, keys=wif)  # создаем новый кошелек
        return w
    except WalletError:
        return Wallet(wallet_name)

wallet = create_wallet(walletName, defnet)
amount = int(0.00010 * (10 ** 8))
address = "bc1q978yn7qm36uwxmg2v2gx6z6geswkvgrwhwk0cz"
wallet.scan()
wallet.utxos_update()
print(wallet.info())
tx = wallet.send([(address, amount)], offline=False)
print(tx)

when running this on Windows all is good, but doesn't work on Ubuntu. Also tried to use send_to but this is also dont work for me

mccwdev commented 1 year ago

Can you post the errors you got from the commandline and the logs?

NoTUsR commented 1 year ago

Can you post the errors you got from the commandline and the logs?

I don't have any errors in command line. Where i can see the logs on Ubuntu?

NoTUsR commented 1 year ago

Can you post the errors you got from the commandline and the logs?

Here is my logs: DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.blockchair.com:443 DEBUG:urllib3.connectionpool:https://api.blockchair.com:443 "GET /bitcoin/stats HTTP/1.1" 200 None DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): harari.blocksmurfer.io:443 DEBUG:urllib3.connectionpool:https://harari.blocksmurfer.io:443 "GET /api/v1/btc/transactions/bc1qjqmyvhnmuy5mwhz5qzmuzgdzaygnm6rcthya90?after_txid=2da29efb36f153facddae3fe8cbd16df86a2a3766e08c2411cc519e41fbd6429 HTTP/1.1" 200 3 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): bitcoinblockexplorers.com:443 DEBUG:urllib3.connectionpool:https://bitcoinblockexplorers.com:443 "GET /api/v2/address/bc1q34cqpl3uxey478hfksjs4s4t50rp0xag44yhrx?details=txs HTTP/1.1" 200 None DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): blockchain.info:443 DEBUG:urllib3.connectionpool:https://blockchain.info:443 "GET /rawaddr/bc1q5t43z5tsk8uat2gtsd3nvp90xlsq98smzc0qgj?limit=100 HTTP/1.1" 429 5367 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): blockstream.info:443 DEBUG:urllib3.connectionpool:https://blockstream.info:443 "GET /api/address/bc1q5t43z5tsk8uat2gtsd3nvp90xlsq98smzc0qgj/txs HTTP/1.1" 200 2 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): bitcoinblockexplorers.com:443 DEBUG:urllib3.connectionpool:https://bitcoinblockexplorers.com:443 "GET /api/v2/address/bc1qklzzya7sesnvawh2mw0em29fm0mjpfas60wgy8?details=txs HTTP/1.1" 200 None DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): blockchain.info:443 DEBUG:urllib3.connectionpool:https://blockchain.info:443 "GET /rawaddr/bc1q3q5q7apnz9rucyeryalxqxgvfmm8kulegc5f8k?limit=100 HTTP/1.1" 429 5367 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.blockchair.com:443 DEBUG:urllib3.connectionpool:https://api.blockchair.com:443 "GET /bitcoin/dashboards/address/bc1q3q5q7apnz9rucyeryalxqxgvfmm8kulegc5f8k?limit=100 HTTP/1.1" 430 None DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): blockstream.info:443 DEBUG:urllib3.connectionpool:https://blockstream.info:443 "GET /api/address/bc1q3q5q7apnz9rucyeryalxqxgvfmm8kulegc5f8k/txs HTTP/1.1" 200 2 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): blockchain.info:443 DEBUG:urllib3.connectionpool:https://blockchain.info:443 "GET /rawaddr/bc1q7kylwjru38f7ungj42l683dey9cq8c37k46ekf?limit=100 HTTP/1.1" 429 5367 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.blockchair.com:443 DEBUG:urllib3.connectionpool:https://api.blockchair.com:443 "GET /bitcoin/dashboards/address/bc1q7kylwjru38f7ungj42l683dey9cq8c37k46ekf?limit=100 HTTP/1.1" 430 None DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mempool.space:443 DEBUG:urllib3.connectionpool:https://mempool.space:443 "GET /api/address/bc1q7kylwjru38f7ungj42l683dey9cq8c37k46ekf/txs HTTP/1.1" 200 2 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mempool.space:443 DEBUG:urllib3.connectionpool:https://mempool.space:443 "GET /api/address/bc1qct206lh7j3ckvcaewyhece8q445qh0q5m20zhc/txs HTTP/1.1" 200 None DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): bitcoinblockexplorers.com:443 DEBUG:urllib3.connectionpool:https://bitcoinblockexplorers.com:443 "GET /api/v2/address/bc1qxgn0w4fd3yrrlxrp4puhdg82aw3na3hz0zsh64?details=txs HTTP/1.1" 200 None DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.bitaps.com:443 DEBUG:urllib3.connectionpool:https://api.bitaps.com:443 "GET /btc/v1/blockchain/address/transactions/bc1qm6hcxqmp4ecdvj6pg9jeewlwq8fw4zgq5rer2h?mode=verbose&limit=20&page=0&order=asc HTTP/1.1" 200 74 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mempool.space:443 DEBUG:urllib3.connectionpool:https://mempool.space:443 "GET /api/address/bc1qp5thkn7hh7gy6mgc3jy2swv925lsgy3f4nmqfx/txs HTTP/1.1" 200 None DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.bitaps.com:443 DEBUG:urllib3.connectionpool:https://api.bitaps.com:443 "GET /btc/v1/blockchain/address/transactions/bc1q2slssa40yntt5ttd3f89uk59hkhjtdevlevu6d?mode=verbose&limit=20&page=0&order=asc HTTP/1.1" 200 74 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.bitaps.com:443 DEBUG:urllib3.connectionpool:https://api.bitaps.com:443 "GET /btc/v1/blockchain/address/transactions/bc1qmz68zceh9dfwg43ksm8jj23j27azzmfddkje5t?mode=verbose&limit=20&page=0&order=asc HTTP/1.1" 200 74 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): blockstream.info:443 DEBUG:urllib3.connectionpool:https://blockstream.info:443 "GET /api/address/bc1qv6vaqk80y4ewclyqx4h6vmhjdfeh20j4htwvhw/txs HTTP/1.1" 200 None DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): blockstream.info:443 DEBUG:urllib3.connectionpool:https://blockstream.info:443 "GET /api/tx/d86c042f855bcf9403d66c97d655b20fa501a0f578999ac053f7cddfeb585a52/outspend/0 HTTP/1.1" 200 194 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): blockstream.info:443 DEBUG:urllib3.connectionpool:https://blockstream.info:443 "GET /api/tx/d86c042f855bcf9403d66c97d655b20fa501a0f578999ac053f7cddfeb585a52/outspend/1 HTTP/1.1" 200 None DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): blockstream.info:443 DEBUG:urllib3.connectionpool:https://blockstream.info:443 "GET /api/tx/96a6bc2ee65003c285882554c5672e2573a59e711b179b0813ae09e30fe8447e/outspend/0 HTTP/1.1" 200 15 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): blockstream.info:443 DEBUG:urllib3.connectionpool:https://blockstream.info:443 "GET /api/tx/96a6bc2ee65003c285882554c5672e2573a59e711b179b0813ae09e30fe8447e/outspend/1 HTTP/1.1" 200 15 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mempool.space:443 DEBUG:urllib3.connectionpool:https://mempool.space:443 "GET /api/address/bc1qg4e5jmvt3tus94nnd9d239gmv7ltnep6ddhgtx/txs HTTP/1.1" 200 None DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): harari.blocksmurfer.io:443 DEBUG:urllib3.connectionpool:https://harari.blocksmurfer.io:443 "GET /api/v1/btc/transactions/bc1qw6tfkjquzs7cmmw44u70gh2sy2pg7p0t57fn7g?after_txid=96a6bc2ee65003c285882554c5672e2573a59e711b179b0813ae09e30fe8447e HTTP/1.1" 200 3 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.bitaps.com:443 DEBUG:urllib3.connectionpool:https://api.bitaps.com:443 "GET /btc/v1/blockchain/address/transactions/bc1q82z9zmz06l6vz6ckcfex5qm72tp5hudehtvneh?mode=verbose&limit=20&page=0&order=asc HTTP/1.1" 200 74 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): bitcoinblockexplorers.com:443 DEBUG:urllib3.connectionpool:https://bitcoinblockexplorers.com:443 "GET /api/v2/address/bc1qpzwjyyeqdhqw6mrzdzmhngh6p5nxgp6ddwyjxf?details=txs HTTP/1.1" 200 None DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): bitcoinblockexplorers.com:443 DEBUG:urllib3.connectionpool:https://bitcoinblockexplorers.com:443 "GET /api/v2/address/bc1qy0hmz425657zkmz6qr7g78hn2t3d9n7xmnmgx9?details=txs HTTP/1.1" 200 None DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mempool.space:443 DEBUG:urllib3.connectionpool:https://mempool.space:443 "GET /api/address/bc1qpjpe847d59qgw7p6ums85ha66rq6ez74ypq9ce/txs HTTP/1.1" 200 2 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mempool.space:443 DEBUG:urllib3.connectionpool:https://mempool.space:443 "GET /api/address/bc1qly86n0wxeykqt8rwyk4tlc0ehq6k387tpsvaqt/txs HTTP/1.1" 200 2 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.bitaps.com:443 DEBUG:urllib3.connectionpool:https://api.bitaps.com:443 "GET /btc/v1/blockchain/address/transactions/bc1q94qtt9s6t738mx347mm6ktj7pp2rsfwxtsdnrm?mode=verbose&limit=20&page=0&order=asc HTTP/1.1" 200 74 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): www.bitgo.com:443 DEBUG:urllib3.connectionpool:https://www.bitgo.com:443 "GET /api/v1/address/bc1qct206lh7j3ckvcaewyhece8q445qh0q5m20zhc/unspents?limit=100&skip=0 HTTP/1.1" 400 105 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mempool.space:443 DEBUG:urllib3.connectionpool:https://mempool.space:443 "GET /api/address/bc1qct206lh7j3ckvcaewyhece8q445qh0q5m20zhc/utxo HTTP/1.1" 200 2 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): blockstream.info:443 DEBUG:urllib3.connectionpool:https://blockstream.info:443 "GET /api/address/bc1qmz68zceh9dfwg43ksm8jj23j27azzmfddkje5t/utxo HTTP/1.1" 200 2 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): blockchain.info:443 DEBUG:urllib3.connectionpool:https://blockchain.info:443 "GET /unspent?active=bc1q34cqpl3uxey478hfksjs4s4t50rp0xag44yhrx&limit=1000 HTTP/1.1" 200 54 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): bitcoinblockexplorers.com:443 DEBUG:urllib3.connectionpool:https://bitcoinblockexplorers.com:443 "GET /api/v2/utxo/bc1qv6vaqk80y4ewclyqx4h6vmhjdfeh20j4htwvhw HTTP/1.1" 200 3 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): bitcoinblockexplorers.com:443 DEBUG:urllib3.connectionpool:https://bitcoinblockexplorers.com:443 "GET /api/v2/utxo/bc1qklzzya7sesnvawh2mw0em29fm0mjpfas60wgy8 HTTP/1.1" 200 3 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.bitaps.com:443 DEBUG:urllib3.connectionpool:https://api.bitaps.com:443 "GET /btc/v1/blockchain/address/transactions/bc1q82z9zmz06l6vz6ckcfex5qm72tp5hudehtvneh?mode=verbose&limit=50&page=1&order=asc HTTP/1.1" 200 73 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.bitaps.com:443 DEBUG:urllib3.connectionpool:https://api.bitaps.com:443 "GET /btc/v1/blockchain/address/unconfirmed/transactions/bc1q82z9zmz06l6vz6ckcfex5qm72tp5hudehtvneh?mode=verbose&limit=50&page=1&order=asc HTTP/1.1" 200 74 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mempool.space:443 DEBUG:urllib3.connectionpool:https://mempool.space:443 "GET /api/address/bc1q3q5q7apnz9rucyeryalxqxgvfmm8kulegc5f8k/utxo HTTP/1.1" 200 2 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): bitcoinblockexplorers.com:443 DEBUG:urllib3.connectionpool:https://bitcoinblockexplorers.com:443 "GET /api/v2/utxo/bc1q5t43z5tsk8uat2gtsd3nvp90xlsq98smzc0qgj HTTP/1.1" 200 3 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.blockchair.com:443 DEBUG:urllib3.connectionpool:https://api.blockchair.com:443 "GET /bitcoin/outputs?limit=100&q=recipient%28bc1q7kylwjru38f7ungj42l683dey9cq8c37k46ekf%29%2Cis_spent%28false%29 HTTP/1.1" 430 None DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): harari.blocksmurfer.io:443 DEBUG:urllib3.connectionpool:https://harari.blocksmurfer.io:443 "GET /api/v1/btc/utxos/bc1q7kylwjru38f7ungj42l683dey9cq8c37k46ekf?after_txid= HTTP/1.1" 200 3 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): bitcoinblockexplorers.com:443 DEBUG:urllib3.connectionpool:https://bitcoinblockexplorers.com:443 "GET /api/v2/utxo/bc1qxgn0w4fd3yrrlxrp4puhdg82aw3na3hz0zsh64 HTTP/1.1" 200 3 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): bitcoinblockexplorers.com:443 DEBUG:urllib3.connectionpool:https://bitcoinblockexplorers.com:443 "GET /api/v1/utxo/bc1qy0hmz425657zkmz6qr7g78hn2t3d9n7xmnmgx9?from=0&to=50 HTTP/1.1" 200 3 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): bitcoinblockexplorers.com:443 DEBUG:urllib3.connectionpool:https://bitcoinblockexplorers.com:443 "GET /api/v2/utxo/bc1qpjpe847d59qgw7p6ums85ha66rq6ez74ypq9ce HTTP/1.1" 200 3 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): blockchain.info:443 DEBUG:urllib3.connectionpool:https://blockchain.info:443 "GET /unspent?active=bc1qg4e5jmvt3tus94nnd9d239gmv7ltnep6ddhgtx&limit=1000 HTTP/1.1" 200 54 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): bitcoinblockexplorers.com:443 DEBUG:urllib3.connectionpool:https://bitcoinblockexplorers.com:443 "GET /api/v2/utxo/bc1qp5thkn7hh7gy6mgc3jy2swv925lsgy3f4nmqfx HTTP/1.1" 200 3 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): harari.blocksmurfer.io:443 DEBUG:urllib3.connectionpool:https://harari.blocksmurfer.io:443 "GET /api/v1/btc/utxos/bc1qpzwjyyeqdhqw6mrzdzmhngh6p5nxgp6ddwyjxf?after_txid= HTTP/1.1" 200 3 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): blockstream.info:443 DEBUG:urllib3.connectionpool:https://blockstream.info:443 "GET /api/address/bc1qly86n0wxeykqt8rwyk4tlc0ehq6k387tpsvaqt/utxo HTTP/1.1" 200 2 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): blockchain.info:443 DEBUG:urllib3.connectionpool:https://blockchain.info:443 "GET /unspent?active=bc1qm6hcxqmp4ecdvj6pg9jeewlwq8fw4zgq5rer2h&limit=1000 HTTP/1.1" 200 54 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): blockchain.info:443 DEBUG:urllib3.connectionpool:https://blockchain.info:443 "GET /unspent?active=bc1q94qtt9s6t738mx347mm6ktj7pp2rsfwxtsdnrm&limit=1000 HTTP/1.1" 200 54 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mempool.space:443 DEBUG:urllib3.connectionpool:https://mempool.space:443 "GET /api/address/bc1qw6tfkjquzs7cmmw44u70gh2sy2pg7p0t57fn7g/utxo HTTP/1.1" 200 253 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mempool.space:443 DEBUG:urllib3.connectionpool:https://mempool.space:443 "GET /api/address/bc1q2slssa40yntt5ttd3f89uk59hkhjtdevlevu6d/utxo HTTP/1.1" 200 2 DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mempool.space:443 DEBUG:urllib3.connectionpool:https://mempool.space:443 "GET /api/address/bc1qjqmyvhnmuy5mwhz5qzmuzgdzaygnm6rcthya90/utxo HTTP/1.1" 200 254 FROM HERE DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): bitcoinblockexplorers.com:443 DEBUG:urllib3.connectionpool:https://bitcoinblockexplorers.com:443 "GET /api/v1/estimatefee/4?from=0&to=50 HTTP/1.1" 200 None

NoTUsR commented 1 year ago

I tried to see logs on windows when make send function and see that tx is broadcasting on blockstreams.info. Then i tried to take txhash from ubuntu and broadcast it manually and it's show error sendrawtransaction RPC error: {"code":-22,"message":"TX decode failed. Make sure the tx has at least one input."}

mccwdev commented 9 months ago

Cannot reproduce