SendTransaction API Creation For Bitcoin

149 views Asked by At

I'm facing issue on creating sendtransaction API using bitcore SendFrom method here please lookup my API ("http://localhost:3000/bitcoin/api/sendfrom?"""2NFuJDmdvKWP2zB5EfsXqNuYz9AW65tBrAy" 0.001 6 "donation" "seans outpost"") and its getting like "error:A wallet phrase needed and has not set" Anyone can please tell me how to create sendtrasaction API for bitcoin using nodejs and bitcore already i created generateNewaddress and getbalance,getaccounts API's i tested it in postman. please find below nodejs code:

var bitcoinapi = require('bitcoin-node-api');
var express = require('express');
var app = express();
 var port =3000;
//Username and password relate to those set in the bitcoin.conf file

var wallet = {
  host: 'localhost',
  port: 18332,
  user: 'test',
  pass: 'test123'
};

bitcoinapi.setWalletDetails(wallet);
bitcoinapi.setAccess('default-safe'); //Access control
app.use('/bitcoin/api', bitcoinapi.app); //Bind the middleware to any chosen url

app.listen(3000);
console.log('server is running at port ' +port);

please find below screens:

1

There are 1 answers

0
RajmondX On
  1. Did you install and setup BitcoinCore?
  2. You need to run the deamon in BitcoinCore (your "wallet" settings)

Btw. you can use the api of the deamon directly (it's not anymore up to date, but gives you an idea: https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list )