Cryptocurrency API and source code

If you have created your won crptocurrency 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');
Facebook Comments
(Visited 39 times, 1 visits today)

Leave A Comment

Your email address will not be published. Required fields are marked *