Command to Setup Cryptocurrency API using Node.js and Bitcoin Core

Command to Setup Cryptocurrency API using Node.js and Bitcoin Core

If you have created your own cryptocurrency and if your coin is ready , it’s time to setup the API.

Command to Setup Directories

mkdir webwallet

cd webwallet

npm init

Command To Install Bitcoin Core Package of Node Js

npm install bitcoin-core

Code to invoke API Calls

console.log("Hello");

const Client = require('bitcoin-core');

const wallet1 = new Client({
	host: '127.0.0.01',
	port: '6332',
	username:'yourusername',
	password: 'yourpassword'
	
});

wallet1.command('getbalance').then((responses) => console.log(responses));	

wallet1.command('getnewaddress').then((responses) => console.log(responses));	
	
wallet1.sendToAddress('NRGte5USJJZt2ErUwoteuEsQRvCq9T3jJR', 0.1,  'Any Text', 'Any Text');