use Blocktrail\SDK\Wallet;
// BEGIN - CHANGE REQUIRED INFOS
require_once __DIR__ . "BLOCKTRAIL_SDK";
define("blocktrail_api", "");
define("blocktrail_secret", "");
define("blocktrail_wallet", "");
define("blocktrail_password", "");
$address = ""; // your address
$satoshi = 100000; // your amount in satoshi
// END - CHANGE REQUIRED INFOS
$client = new BlocktrailSDK(blocktrail_api, blocktrail_secret, "BTC", false);
$wallet = $client->initWallet(blocktrail_wallet, blocktrail_password);
$feeStrategy = \Blocktrail\SDK\Wallet::FEE_STRATEGY_LOW_PRIORITY; // your fee type
$coinselect = $wallet->coinSelection(
\Blocktrail\SDK\Wallet::normalizeOutputsStruct([$address => $satoshi]),
false, false,
$feeStrategy
);
$fees = $coinselect["fee"];
// Logs
var_dump($coinselect);
echo "\n Fees for this transaction will be: ".$fees;
?>
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:
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:
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).