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.