Skip to content

Instantly share code, notes, and snippets.

@tobi-bams
Created April 24, 2022 16:37
Show Gist options
  • Save tobi-bams/cb41d8ba8ede1af8ef91596121d6692a to your computer and use it in GitHub Desktop.
Save tobi-bams/cb41d8ba8ede1af8ef91596121d6692a to your computer and use it in GitHub Desktop.
Get Balance from Bitcoin Core
const axios = require("axios");
const GetBalance = async () => {
const body = {
jsonrpc: "1.0",
method: "getbalance",
id: "curltext",
parameter: [],
};
const port = 38332;
try {
const response = await axios.post(`http://127.0.0.1:${port}/`, body, {
auth: {
username: "test",
password: "test",
},
});
console.log(response.data);
} catch (error) {
console.log(error.response.data);
}
};
GetBalance();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment