Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It only takes a minute to sign up.
Sign up to join this communityAnybody can ask a question
Anybody can answer
The best answers are voted up and rise to the top
Today I created my very first transaction of bitcoin on the testnet programmatically. I created a wallet A, first generated my private key and I generated a deposit address. I deposited 0.00074 btc into it and waited till 6 confirmations so I can send bitcoin to somebody else. I decided to send 0.0000646 BTC to different address B and the transaction was successful however I noticed the transaction fee was 0.0006754 BTC so literally the rest of the balance from wallet A was used as a fee. I found this in the documentation of the api I am using apidocs"When the amount of funds that the recipient should receive is lower than the amount of funds from the UTXOs, the difference is used as a transaction fee."
Does that mean that for example if I deposit 1BTC to a specific address, if I want to send a certain amount of btc thats significantly smaller lets say 0.1 btc, 0.9btc will be used as a fee?? Then what If I want to send only a certain amount of money and dont want to pay such a massive fee do I have to create a completely new deposit address each time I want to send bitcoin and top it up only with the amount I want to send + fee? There must be a way to send small amounts I sent a small amounts from exchanges but did not see what logic is behind, could somebody please explain and give me some example?
You should send some money back to yourself as change. Normally wallets do this automatically for you. Wallets normally generate a new change address for each transaction.
So if A has a UTXO of 1 BTC and wants to send 0.1 BTC to B with a fee of 0.001BTC the transaction would be
- Inputs
- 1 BTC (from A)
- Outputs
- 0.1 BTC to B
- 0.899 BTC to A
This leaves 0.001 BTC unaccounted for which is the transaction fee to be claimed by a miner.
You can get bonuses upto $100 FREE BONUS when you:
π° Install these recommended apps:
π² SocialGood - 100% Crypto Back on Everyday Shopping
π² xPortal - The DeFi For The Next Billion
π² CryptoTab Browser - Lightweight, fast, and ready to mine!
π° Register on these recommended exchanges:
π‘ Binanceπ‘ Bitfinexπ‘ Bitmartπ‘ Bittrexπ‘ Bitget
π‘ CoinExπ‘ Crypto.comπ‘ Gate.ioπ‘ Huobiπ‘ Kucoin.
Comments