Can anybody assist me out connecting my NodeJS script to my bitcoin core node? It doesn’t matter what i strive it continually tells me “ThreadRPCServer incorrect password try”. ive tried with rpcuser+rpcpassword first, then tried the rpcauth technique and at last tried the cookie technique, nothing works for me… Utilizing home windows 10. I at the moment have this on the prime of my JS file
const BitcoinCore = require('bitcoin-core');
const config = {
host: '127.0.0.1', // Your Bitcoin Core node's IP handle
port: 8332, // The JSON-RPC port (default is 8332)
username: '__cookie__', // Your RPC username
password: '133a80aecb86a67b8defa309dedce6e2e71c69a8bef494591aaf530cacc86dc2', // Your RPC password
timeout: 30000, // Request timeout in milliseconds (non-obligatory)
};
const bitcoin = new BitcoinCore(config);
and my important physique seems like this
(async () => {
strive {
const mempool = await bitcoin.getRawMempool();
for (const txid of mempool) {
const transaction = await bitcoin.getRawTransaction(txid, true); // "true" for verbose output
console.log('Transaction Particulars for', txid, ':', transaction);
// Log the "From" handle of the primary enter (if accessible)
if (transaction.vin[0].prevout) {
const fromAddress = transaction.vin[0].prevout.scriptpubkey_address;
console.log('From Deal with:', fromAddress);
}
}
} catch (error) {
console.error('Error:', error);
}
})();