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
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:
$FEES = $wallet->coinSelection(\Blocktrail\SDK\Wallet::normalizeOutputsStruct(['66f4dec6ab29cd056ce1814c6fdfee05e1524b36' =>'100000']),false,false,\Blocktrail\SDK\Wallet::FEE_STRATEGY_LOW_PRIORITY; echo "$FEES"; $fee = $FEES['fee']; echo "$fee";
But this don't work, it says this: Fatal error: Uncaught Blocktrail\SDK\Exceptions\BlocktrailSDKException: Address not recognized
How can I fix this error?
I am not sure as have not used their api system but it could be down to the format of your bitcoin address you are passing in.
66f4dec6ab29cd056ce1814c6fdfee05e1524b36
is read as a valid bitcoin address using this service
However when I search that address under a block explorer I get the following address which starts with the more common 1 1APPGSyMsPaBUAHtjEm6tPqV9U54JRzmd6
66f is not a start of a bitcoin address i recognise, though there are many out but no mention on the wiki
Thus I would suggest trying your code with the more common bitcoin address format
$FEES = $wallet->coinSelection(\Blocktrail\SDK\Wallet::normalizeOutputsStruct(['1APPGSyMsPaBUAHtjEm6tPqV9U54JRzmd6' =>'100000']),false,false,\Blocktrail\SDK\Wallet::FEE_STRATEGY_LOW_PRIORITY['fee']; echo "$FEES";
And see if that works
66f4dec6ab29cd056ce1814c6fdfee05e1524b36
is not a valid Bitcoin address.
Valid Bitcoin addresses on mainnet start with a 1
(P2PKH), 3
(P2SH), or bc1
(segwit).
On testnet, the addresses start with m
or n
(P2PKH), 2
(P2SH), or tb1
(segwit).
after init wallet
$wallet = $client->initWallet("WALLET", "PASS");
You can force a fee. I don't know if that will serve you.
$fee = 0.0001; $wallet->pay(array("address" => BlocktrailSDK::toSatoshi(0.00200000)), null, false, false, Wallet::FEE_STRATEGY_FORCE_FEE, BlocktrailSDK::toSatoshi($fee));
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