2
I am using blockchain.info API to send payments. but i need to know that what will I be charged by the network. So any way to get the network fee with specific amount to sent.. or how to generate it to show to user.
2
I am using blockchain.info API to send payments. but i need to know that what will I be charged by the network. So any way to get the network fee with specific amount to sent.. or how to generate it to show to user.
2
i need to know that what will I be charged by the network.
The network doesn't charge you, you decide what to pay the miners, and the miners determine if your transaction fee is high enough to include in the next block or not (since they get the transaction fees).
It doesn't look like Blockchain.info has an API for estimating the fee (it is an estimate, since it is primarily based on transaction volume, it varies). But, you can use another api such as earn.com to estimate a fee rate (in satoshi/B):
Recommended Transaction Fees https://bitcoinfees.earn.com/api/v1/fees/recommended
Example response:
{ "fastestFee": 40, "halfHourFee": 20, "hourFee": 10 }
fastestFee: The lowest fee (in satoshis per byte) that will currently result in the fastest transaction confirmations (usually 0 to 1 block delay).
halfHourFee: The lowest fee (in satoshis per byte) that will confirm transactions within half an hour (with 90% probability).
hourFee: The lowest fee (in satoshis per byte) that will confirm transactions within an hour (with 90% probability).
Without knowing the transaction size, you might have to guess. Something with 1 input, and 2 outputs (one for change) might be around 250B.
fee = feerate * tx_size
Then, you can set the fee property when you make a payment.
Send bitcoin from your wallet to another bitcoin address. All transactions include a 0.0001 BTC miners fee.
All bitcoin values are in Satoshi i.e. divide by 100000000 to get the amount in BTC. The Base URL for all requests: https://blockchain.info/merchant/$guid/. $guid should be replaced with your Blockchain Wallet identifier (found on the login page).
http://localhost:3000/merchant/$guid/payment?password=$main_password&second_password=$second_password&to=$address&amount=$amount&from=$from&fee=$fee
Response: 200 OK, application/json
{ "message" : "Response Message" , "tx_hash": "Transaction Hash", "notice" : "Additional Message" }
{ "message" : "Sent 0.1 BTC to 1A8JiWcwvpY7tAopUkSnGuEYHmzGYfZPiq" , "tx_hash" : "f322d01ad784e5deeb25464a5781c3b20971c1863679ca506e702e3e33c18e9c" , "notice" : "Some funds are pending confirmation and cannot be spent yet (Value 0.001 BTC)" }
0
Blockchain.info offers a fee API: https://api.blockchain.info/mempool/fees
The response looks something like this: {"limits":{"min":1,"max":75},"regular":3,"priority":50}. To calculate the transaction fee multiply either the value for regular or priority by your transaction size.
but if you send btc from blockchain.info website it charge less than 0.0001 btc depends upon transaction size... so is 0.0001 btc is static size for every transaction? – Muhammad Ahsan Ayaz Khan – 2018-09-22T06:29:59.077
It is the minimum fee, but you can pay more if your transaction is not getting confirmed. – JBaczuk – 2018-09-22T13:10:57.053