Skip to content

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.

License

Notifications You must be signed in to change notification settings

st3b1t/bitcoin-nodejs-playground

Repository files navigation

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

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

image

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages