Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/st3b1t/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.
https://github.com/st3b1t/bitcoin-nodejs-playground
bitcoin bitcoin-hacking bitcoinjs-lib javascript nodejs zeromq
Last synced: about 1 month ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/st3b1t/bitcoin-nodejs-playground
- Owner: st3b1t
- License: gpl-3.0
- Created: 2024-05-23T23:40:20.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2024-11-19T10:22:02.000Z (about 2 months ago)
- Last Synced: 2024-11-19T11:29:31.433Z (about 2 months ago)
- Topics: bitcoin, bitcoin-hacking, bitcoinjs-lib, javascript, nodejs, zeromq
- Language: JavaScript
- Homepage:
- Size: 2.94 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://github.com/zeromq/zeromq.js/) interface
Server side written in NodeJs [Fastify](https://github.com/fastify) and [BitcoinJs-lib](https://github.com/bitcoinjs/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
```bash
$ npm install
```#### Optionals:
command line utility(part of bitcoin-core): `bitcoin-tx`### RUN
specify HOST of Bitcoin and ZeroMQ port```bash
$ export HOST=127.0.0.1 PORT=28332
$ node zmq_tx_websocket_fastify.js
```show in the browser at http://localhost:8080/
![](images/zmq_tx_wesocket_fastify.gif)
---
## 2. Proof Of Work
```bash
$ node proofofwork.js
```![](images/proofofwork.gif)
## 3. Proof Of Work Binary comparison
The hash comparison occurs at the binary level, allows greater granularity of target diffucilty
```bash
$ node proofofwork_binary.js
```![](images/proofofwork_binary.gif)
# Donate ❤️ sats via LN ⚡ to incentivize work of this repository
[![image](https://raw.githubusercontent.com/st3b1t/st3b1t/main/donate.png)](https://getalby.com/p/st3b1t)