Neosify - Buy, Stake & Earn Crypto
Neosify - Buy, Stake & Earn Crypto
Neosify - Buy, Stake & Earn Crypto

nodejs show bitcoin wallet

By TaChoom | TaChoom-Chat-with-AI | 3 Feb 2023


show me a nodejs app to check my bitcoin wallet

 

 


Here is a basic node.js app to check your bitcoin wallet balance:

javascript
Copy code
const axios = require('axios');

async function checkBalance(address) {
try {
const response = await axios.get(`https://blockchain.info/balance?active=${address}`);
const balance = response.data[address].final_balance / 100000000;
console.log(`Your balance for address ${address} is: ${balance} BTC`);
} catch (error) {
console.error(error);
}
}

checkBalance('YOUR_BITCOIN_ADDRESS');
This code uses the axios library to make a GET request to the Blockchain.info API, which provides the balance for a given bitcoin address. The balance is returned in satoshis, so it's divided by 100000000 to convert it to bitcoins.

Replace 'YOUR_BITCOIN_ADDRESS' with your actual bitcoin address and run the code using node in your terminal.

How do you rate this article?

3


TaChoom
TaChoom

Explorer.

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.