Bitcoin Nodejs Playground
This repository contains small experiments with a series of scripts that implement in a few lines some of the workings of Bitcoin or show and process some of the data structures of the blockchain for greater understanding.
1. Stream Transactions and OP_RETURN
Stream in the browser via WebSocket any transaction and OP_RETURN of your Bitcoin Full Node from ZeroMQ interface Server side written in NodeJs Fastify and BitcoinJs-lib
Requirements:
Add in bitcoin.conf enable this line:
zmqpubrawtx=tcp://127.0.0.1:28332
npm dependecies: zeromq bitcoinjs-lib fastify @fastify/websocket
Optionals:
command line utility(part of bitcoin-core): bitcoin-tx
RUN
specify HOST of Bitcoin and ZeroMQ port
$ export HOST=127.0.0.1 PORT=28332
$ node zmq_tx_websocket_fastify.jsshow in the browser at http://localhost:8080/
2. Proof Of Work
3. Proof Of Work Binary comparison
The hash comparison occurs at the binary level, allows greater granularity of target diffucilty
$ node proofofwork_binary.js



