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.
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
Add in bitcoin.conf
enable this line:
zmqpubrawtx=tcp://127.0.0.1:28332
npm dependecies: zeromq bitcoinjs-lib fastify @fastify/websocket
$ npm install
command line utility(part of bitcoin-core): bitcoin-tx
specify HOST of Bitcoin and ZeroMQ port
$ export HOST=127.0.0.1 PORT=28332
$ node zmq_tx_websocket_fastify.js
show in the browser at http://localhost:8080/
$ node proofofwork.js
The hash comparison occurs at the binary level, allows greater granularity of target diffucilty
$ node proofofwork_binary.js