wallet.scan()
#475
-
|
Do I have to call wallet.scan() after sending a transation to get unspent utxos? |
Beta Was this translation helpful? Give feedback.
Answered by
mccwdev
Sep 27, 2025
Replies: 1 comment
-
|
You don't have to use the scan method, the utxo's will be included in wallet. However they show up as unconfirmed. To see if your transaction is accepted by the network, and see how many confirmations it has, you have to use the scan or utxos_update method. >>> from bitcoinlib.wallets import wallet_create_or_open
>>> w = wallet_create_or_open('bcl-testwallet', network='bitcoinlib_test')
>>> w.utxos_update() # to get some test coins
2
>>> w.send_to('blt1qf3nktn0txwt5ue8800hxgzh29l98t6vh8c85jz', 10000000, broadcast=True)
<WalletTransaction(input_count=1, output_count=2, status=unconfirmed, network=bitcoinlib_test)>
>>> w.info()
=== WALLET ===
ID 117
Name bcl-testwallet
Owner
Scheme bip32
Multisig False
Witness type segwit
Main network bitcoinlib_test
Latest update None
= Wallet Master Key =
ID 884
Private True
Depth 0
- NETWORK: bitcoinlib_test -
- - Keys
889 m/84'/9999999'/0'/0/0 blt1qnyzy4munnvlg2lhq3lcezxkr2tquhxcs0nm7xv address index 0 2.00000000 T
891 m/84'/9999999'/0'/1/0 blt1qcjxqafvne39mc947wyqhxsjja0wv0929hppzha address index 0 0.00000000 T
- - Transactions Account 0 (4)
883ddaec4a016bf1244c3bc8621678e51db71422fd94462cbe72160fbaaccaa1 blt1qnyzy4munnvlg2lhq3lcezxkr2tquhxcs0nm7xv 10 1.00000000 T
3a8b8a21b26d381efc09fdc9dadeffc0b5393a4e85a6419379762b0a81af38df blt1qnyzy4munnvlg2lhq3lcezxkr2tquhxcs0nm7xv 10 1.00000000 T U
95a6368a894f991796aa7fb8a421987cf4e093559a9cffaac7aaa14561664814 blt1qnyzy4munnvlg2lhq3lcezxkr2tquhxcs0nm7xv 0 -1.00000000 T
95a6368a894f991796aa7fb8a421987cf4e093559a9cffaac7aaa14561664814 blt1qcjxqafvne39mc947wyqhxsjja0wv0929hppzha 0 0.89995301 T U
= Balance Totals (includes unconfirmed) =
bitcoinlib_test (Account 0) 1.89995301 T |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
mccwdev
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You don't have to use the scan method, the utxo's will be included in wallet.
However they show up as unconfirmed. To see if your transaction is accepted by the network, and see how many confirmations it has, you have to use the scan or utxos_update method.