Today I took some time to mess around with the bit Python library, which I find pretty easy to use. I have been wanting to do some Bitcoin programming for a while, so I decided to create a simple web wallet to test creating and broadcasting transactions. I'm obviously using testnet for this.

I initially used a testnet faucet to send two transactions to a main address, 0.0005 and 0.0001 tBTC to get started. I used my code to check for this address' balance and got 0.0006, cool. I then proceeded to used my newly developed web wallet to send two transactions to another address, both with a value of 0.00001 tBTC. I immediately noticed the balance from my main address was off, showing me 0.000028 tBTC which to me makes no sense, it should have been something close to 0.00058. I used blockcypher to check on those transactions (which are unconfirmed, but I believe this is irrelevant) to make sure my code was ok. Sure enough, 0.00001 tBTC was sent twice to the correct address, but the change sent back to the sender address is way off. What exactly happened here?

I include the transactions here and here.

Thanks in advance!

1 Answer 1


This is expected.

You don't appear to be accounting for fees.

If you account for them, you get:

+0.0005 386d83da01218ca74cbe72b19a6814293b98357921042a9b03ab39706fef8736
+0.0001 8e95c68f524e557a9b42d11207effae89c4e61913c5c4758adb142a6cdd03848
-0.00001 with -0.00034408 as Fees 91224995f2c240159141a499b91db8d26f0a6425fb12f5277d2f735576596aa7
-0.00001 with -0.00020792 as Fees  92287c75721563643f8dbf9ee5fff59abe1c9b6b36a638daa05c35d5fea981d0

This gives you a final balance of +0.0005 + 0.0001 -0.00001 -0.00034408 -0.00001 -0.00020792, which is 0.000028

  • Thanks for your reply! I was looking for tx fees in the pages I included but it slipped past me, so I assumed testnet transactions didn’t have fees at all. Jun 21, 2019 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.