ofek / bit

Bitcoin made easy.
https://ofek.dev/bit/
MIT License
1.24k stars 212 forks source link

ValueError: Transactions must have at least one unspent. #159

Open Gadzhi07 opened 2 years ago

Gadzhi07 commented 2 years ago

My btc addres : 1GwLg3QmpcdTj3DiQB6tsLeaiRoRtoNTgS My code :

from bit import PrivateKey

my_key = PrivateKey(wif="***") money=1 wallet='1MfnucMaYJ5P81TUYTB9zzeThiHNXdBrvH fee=2000 utxos = my_key.get_unspents() print(utxos)

tx_hash = my_key.create_transaction([(wallet, money, 'usd')],fee=fee,unspents=utxos)

print(tx_hash)

eriktlu commented 2 years ago

Did you ever solve this issue? I have a similar problem.

from bit import PrivateKey

key = PrivateKey('PrivateKeyFromExodusWallet')

print(key.address)
print(key.get_balance('btc'))
print(key.balance)

This gives me a wrong BTC address and shows that balance is 0.

Pep3M commented 2 years ago

This gives me a wrong BTC address and shows that balance is 0.

Change key.balance for key.get_balance