Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction broadcast failed #167

Closed
mrx23dot opened this issue Aug 17, 2022 · 2 comments
Closed

Transaction broadcast failed #167

mrx23dot opened this issue Aug 17, 2022 · 2 comments

Comments

@mrx23dot
Copy link

mrx23dot commented Aug 17, 2022

I'm trying the main example on mainnet with minimal values:

from bit import Key

key = Key.from_hex('..')

print('bal',key.get_balance('satoshi'),'sat')
print('unspents', key.unspents) 
# got: unspents [Unspent(amount=18485, confirmations=6, script='..', txid='..', txindex=30, segwit=False, sequence=..)]

outputs = [
  ('1EH.., 1, 'satoshi'),
]

key.send(outputs, fee=5, absolute_fee=True) # will take long time to verify, only for testing
key.send(outputs, fee=10, absolute_fee=False) 

# expecting getting back the remaining

All of them give:

Traceback (most recent call last):
  File "test_transf_single.py", line 19, in <module>
    txid = key.send(outputs, fee=5, absolute_fee=False)
  File "C:\py38_64\lib\site-packages\bit\wallet.py", line 385, in send
    NetworkAPI.broadcast_tx(tx_hex)
  File "C:\py38_64\lib\site-packages\bit\network\services.py", line 1226, in broadcast_tx
    raise ConnectionError('Transaction broadcast failed, or Unspents were already used.')
ConnectionError: Transaction broadcast failed, or Unspents were already used.

I've got confirmed unspents so no idea why getting this.

Vers
bit==0.8.0
Python 3.8.8

@mrx23dot
Copy link
Author

mrx23dot commented Aug 17, 2022

API
https://mempool.space/api/v1/fees/recommended
says:
"minimumFee": 1
so
key.send(outputs, fee=1, absolute_fee=True) or worst case absolute_fee=False
should work.

@mrx23dot
Copy link
Author

Turns out the smallest amount transferable is 1000sat.
A warning would have been nicer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant