1

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):

Get Market Fee Rate

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).

Estimate Fee

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

Make Payment

Then, you can set the fee property when you make a payment.

Making Outgoing Payments

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

  • $main_password Your Main Blockchain Wallet password
  • $second_password Your second Blockchain Wallet password if double encryption is enabled.
  • $to Recipient Bitcoin Address.
  • $amount Amount to send in satoshi.
  • $from Send from a specific Bitcoin Address (Optional)
  • $fee Transaction fee value in satoshi (Must be greater than default fee) (Optional)

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)" }
  • 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 Sep 22 '18 at 6:29
  • It is the minimum fee, but you can pay more if your transaction is not getting confirmed. – JBaczuk Sep 22 '18 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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