Skip to content

Latest commit

 

History

History
57 lines (35 loc) · 1.46 KB

README.md

File metadata and controls

57 lines (35 loc) · 1.46 KB

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 install zeromq bitcoinjs-lib fastify @fastify/websocket

$ npm install

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.js


2. Proof Of Work

$ node proofofwork.js

3. Proof Of Work Binary comparison

The hash comparison occurs at the binary level, allows greater granularity of target diffucilty

$ node proofofwork_binary.js

Donate ❤️ sats via LN ⚡ to incentivize work of this repository

image