blocktrail-sdk-php
blocktrail-sdk-php copied to clipboard
Can't send bitcoin using pay api in node.js getting Invalid Address Error
I am using node. I am using exact mention code but I am not able to pay. I have tried with multiple addresses.
I have attached the snapshot of code. Please help me.
app.get("/pay/:address", function(req, res) { client.initWallet("ashokrayaltestnet", "12345678!@#$", function(err, wallet) { value = blocktrail.toSatoshi(1.1); wallet.pay({'1NcXPMRaanz43b1kokpPuYDdk6GGDvxT2T': value}, null, false, true, blocktrail.Wallet.FEE_STRATEGY_BASE_FEE, function(err, result) { if(err){ console.log(err); } res.send(JSON.stringify(result)); }); wallet.pay({'1NcXPMRaanz43b1kokpPuYDdk6GGDvxT2T': value}, null, false, true, blocktrail.Wallet.FEE_STRATEGY_LOW_PRIORITY, function(err, result) { if(err){ console.log(err); } res.send(JSON.stringify(result)); }); }); });
ashokrayaltestnet
you mention testnet in your wallet identifier. If it's a testnet wallet, only testnet addresses will work, but you are passing in a mainnet address.