James Bachini

Using ChatGPT To Monitor The Silk Road Bitcoin

MONITORING BITCOIN

In this video I demonstrate how to monitor a Bitcoin address using NodeJS

James On YouTube

Here is a quick script (full code below) that was knocked up using chatGPT to play an mp3 alert file if any Bitcoin moves from the SilkRoad address.

I set this up because the DOJ has announced they are going to sell it before Trump gets in.

Silk Road Bitcoin

Here’s a quick explainer on mempools

How Mempools Work

And here’s the code:

const axios = require('axios');
const player = require('play-sound')({player: "powershell"});

const BITCOIN_ADDRESS = 'bc1qa5wkgaew2dkv56kfvj49j0av5nml45x9ek9hz6';
const MEMPOOL_URL = `https://mempool.space/api/address/${BITCOIN_ADDRESS}/txs/mempool`;
const POLL_INTERVAL_MS = 60_000; // 60 seconds = 60000 ms

/**
 * Fetch the mempool data from mempool.space API for the specified address.
 * If transactions are present, play an MP3 alert sound.
 */
async function checkMempool() {
  try {
    const response = await axios.get(MEMPOOL_URL);
    const transactions = response.data;

    if (Array.isArray(transactions) && transactions.length > 0) {
      console.log(`Found ${transactions.length} transactions in the mempool!`);
      player.play('./alert.mp3', (err) => {
        if (err) console.error('Error playing sound:', err);
      });
    } else {
      console.log('No transactions in the mempool (blank array).');
    }
  } catch (error) {
    console.error('Error fetching from mempool:', error);
  }
}

checkMempool();
setInterval(checkMempool, POLL_INTERVAL_MS);

Code is open-sourced on Github at: https://github.com/jamesbachini/Bitcoin-Address-Watch


Get The Blockchain Sector Newsletter, binge the YouTube channel and connect with me on Twitter

The Blockchain Sector newsletter goes out a few times a month when there is breaking news or interesting developments to discuss. All the content I produce is free, if you’d like to help please share this content on social media.

Thank you.

James Bachini

Disclaimer: Not a financial advisor, not financial advice. The content I create is to document my journey and for educational and entertainment purposes only. It is not under any circumstances investment advice. I am not an investment or trading professional and am learning myself while still making plenty of mistakes along the way. Any code published is experimental and not production ready to be used for financial transactions. Do your own research and do not play with funds you do not want to lose.