Title: Blocktrail/btc.com SDK Fees estimation Post by: new-bie 75 on July 28, 2018, 01:13:05 PM First of all hi and thanks for your support and your time.
I want to calculate the fees of a blocktrail transaction with blocktrail SDK, before making the transaction, in order to let the recipient pay fees. Here is what I tried: Code: $FEES = $wallet->coinSelection(\Blocktrail\SDK\Wallet::normalizeOutputsStruct(['66f4dec6ab29cd056ce1814c6fdfee05e1524b36' =>'100000']),false,false,\Blocktrail\SDK\Wallet::FEE_STRATEGY_LOW_PRIORITY['fee']; But this don't work, error says this: Code: Fatal error: Uncaught Blocktrail\SDK\Exceptions\BlocktrailSDKException: Address not recognized I have also another question, how should I process payments on my site and why? Is more correct to process a payment when user request it, so with only 1 input or to process all payments togheter with a cronjob? Thanks for read, hope that you'll have a nice day :) Title: Re: Blocktrail/btc.com SDK Fees estimation Post by: btj on July 29, 2018, 11:08:50 PM Here is how to do it:
Code: <?php Change some informations like: BLOCKTRAIL_SDK path, blocktrail api, address where you want to send the amount, and the amount it self in ($satoshi string). I notice the bitcoin address you are trying to send BTC to: Code: 66f4dec6ab29cd056ce1814c6fdfee05e1524b36 If it's a testnet address, please switch to testnet on Blocktrail, but i don't know if Fees estimation is supported or not for testnet, change this line: Code: $client = new BlocktrailSDK(blocktrail_api, blocktrail_secret, "BTC", false); Code: $client = new BlocktrailSDK(blocktrail_api, blocktrail_secret, "BTC", true); I suggest to process payments semi-automatically ... when user submit new withdraw request, from admin panel you can process it with one button click. I used Blocktrail API in the past, but personnaly i didn't liked it ... support is late or never answer to customers tickets/emails, and the fees for transactions are very high (I don't know if this changed from that time - Around one year ago). |