Created
April 24, 2022 16:37
-
-
Save tobi-bams/cb41d8ba8ede1af8ef91596121d6692a to your computer and use it in GitHub Desktop.
Get Balance from Bitcoin Core
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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