Got a minimal DATUM “pool” talking to datum_gateway (interop demo)
TL;DR: datum_gateway being open source is enough to build your own pool. EGPOOL is a minimal proof — not production.
Datum_gateway is open source and the protocol is right there in the code. My take: if you can read the protocol, you can build your own pool.
Before arguing, I wanted to try it. So I hacked together a tiny Python prototype called EGPOOL. It speaks the DATUM protocol and can handshake, push CONFIG, and round-trip shares with the gateway — no Ocean pool code involved.
What I proved (all from the public datum gateway code):
• Framing: 4-byte XOR’d header + payload
• Handshake:
- proto=1 HELLO: sealed to pool LT X25519, signed by client LT Ed25519
- proto=2 RESP: sealed to client SESSION X25519, signed by pool LT Ed25519
• Channel (cmd=5):
- Box(serverSessSK, clientSessPK) w/ 24-byte nonce from nk + client session pk
- Nonces increment per message (LE 6×u32)
• CONFIG 0x99: signed by pool SESSION key, applied by gateway
• Share submit 0x27 ↔ response 0x8F: round-trip works
My test setup
EGPOOL pool server <-> DATUM GATEWAY -> Bitcoin node
I connected a bitaxe miner to DATUM Gateway.
I saw gateway handshake with pool server and accepting shares from miner.
Datum Gateway logs from my run:
Handshake response received.
DATUM Server MOTD: Welcome to Python DATUM Prime (prototype)
client configuration cmd received from DATUM server
DATUM Pool Coinbase Tag: "EGPOOL"
DATUM Pool Prime ID: a1b2c3d4
DATUM Pool Min Diff: 65536
Starting Stratum v1 server
---
quick disclaimer — this is a test rig, not a real pool
This is just an interop demo to show the protocol surface is enough.
A production pool still needs all the boring-but-critical stuff: reliable networking & reconnects, user/worker auth, proper vardiff and duplicate detection, real accept/reject plumbing, accounting backed by a DB, coinbaser v2 with real splits, the 0x50 validation path (stxids → by-id → full set), signature discipline (LT vs session), rate limiting/DoS guards, key management/rotation, metrics/alerts, etc
Want to understand more about the protocol?
check my GitHub
https://github.com/electricalgrade/sv2/blob/main/doc/Datum_Protocol_Spec.md
#Bitcoin #Mining #DATUM
EG
npub12z77...vdkj
home miner
Notes (17)
🧱 Selfish Mining Revisited — Deep Dive into Two Key Papers
Reclaiming Miner Sovereignty: Why Decentralized Block Construction is Crucial for Bitcoin's Future
#bitcoin #mining
👇
https://primal.net/e/naddr1qvzqqqr4gupzq59aa2xs9z3t8jxr6jt9c7zpg9xa59agm2akp8vv62784cqjstrfqquj6um9d3nxjumg94kkjmnfdenj6un9we5hx6t5v4jz6ttyv4jhqttyd9mx2ttfde6x7tt5wahj66m90ykhqctsv4e8xtgdvppt0
🚨 Bitcoin blocks are silently accumulating embedded data — not all of it benign.
I built a model that scans OP_RETURNs for suspicious payloads like malware, phishing links, and binary blobs. It works — and that’s the scary part.
📌 Here's why it matters:
- Today, AV/EDR systems don’t scan `.bitcoin/blocks`
- Tomorrow, they will — and when they do, infected chains could get flagged
- Nodes on cloud infrastructure (AWS, GCP) may face bans or throttling
- Centralized miners can bypass mempool policy, embedding malicious data
🧠 This is about more than spam. It's about Bitcoin's long-term health and legitimacy.
We need:
- Sensible datacarrier/mempool policies
- Transparency in block contents
- Decentralized, policy-respecting mining
Bitcoin is permissionless. Let’s not let it become indefensible.
#Bitcoin #OP_RETURN #Malware #AVDetection #Mempool #Mining #ChainSecurity #Nostr
🧪 Homomorphic Encryption over Nostr — Proof of Concept
Simulated a lightweight Nostr relay using WebSockets + a custom event kind 555 to send/aggregate homomorphically encrypted integers.
Paillier scheme, local clients, fully async, dumb relay.
Built it to explore encrypted coordination on top of Nostr.
+------------------+
| Initiator |
|------------------|
| Gen Paillier Key |
| Encrypt Value X |
| Send via Kind 555|
+--------+---------+
|
v
[ Local Relay ]
|
+-------------------+-------------------+
| | |
v v v
+--------------+ +--------------+ +--------------+
| Responder 1 | | Responder 2 | | Responder 3 |
|--------------| |--------------| |--------------|
| Receive X | | Receive X | | Receive X |
| Add secret a | | Add secret b | | Add secret c |
| Send X+a | | Send X+b | | Send X+c |
+------+--------+ +------+--------+ +------+--------+
| | |
+--------+---------+------------------+
|
v
+------------------+
| Initiator |
|------------------|
| Decrypt X+a |
| Decrypt X+b |
| Decrypt X+c |
+------------------+
🛠️ Spin up Bitcoin Knots + DATUM Gateway in Docker Compose.
No more juggling configs — just docker-compose up and you're live with a proper Bitcoin node + Datum Gateway.
🔗 https://github.com/electricalgrade/btc_datum
Built this for myself, but figured someone else might want it.
Run infra, not drama.
#Bitcoin #Nostr #Docker
Running Bitcoin Knots + Datum is as simple as
docker compose up
Built Bitcoin Knots (v28.1.knots20250305) from source in a clean Docker container 🚀
- Ubuntu 22.04 base
- Wallet disabled (--disable-wallet)
- Auto builds from official Knots repo
- Clean & reproducible setup
- bitcoind ready out-of-the-box
💡 Useful for devs, testers, node runners
#Bitcoin #BitcoinKnots #Docker #Nostr
Source & Dockerfile:
https://github.com/electricalgrade/bitcoin/tree/28.x-knots/docker
Noise Protocol: A Minimal and Modular Cryptographic Tool
Been working with the Noise protocol recently — here’s a quick breakdown of what it does and how it works under the hood.
Noise is a small framework for building secure handshakes. It’s not a full protocol like TLS, more like a toolkit to define your own. It handles the initial key exchange, identity/auth, and gives you encrypted transport keys after the handshake. That’s it. No certificates, no extensions, no middleboxes.
Each handshake in Noise is built using a "pattern" — I’ve been using XX and NX. These define how the keys are exchanged:
* XX: both sides are anonymous, and exchange keys during handshake.
* NX: responder has a static pubkey, initiator is ephemeral (closer to client-server flows like SV2).
Behind the scenes, these patterns are just sequences of Diffie-Hellman operations between the parties' keys (ephemeral and static), and the handshake hash is updated after each message. Once complete, both sides split the final hash into two symmetric cipherstates, and that’s what’s used to encrypt transport messages.
All operations are constant-time. I’m using the `noise-c` library, which supports `Noise_XX_25519_ChaChaPoly_BLAKE2s` (or SHA256 if you tweak the suite string). Noise defines the handshake state machine, but the crypto primitives are pluggable.
The nice part is that everything’s deterministic and testable. Given the same inputs, the handshake always produces the same shared keys. It’s all pure key material — no ASN.1, no PEMs, no handshake extensions to worry about.
In the next post, I’ll show a tiny C implementation that wraps a Noise handshake (XX or NX), and exchanges Stratum V2 `SetupConnection` messages post-handshake. Useful for testing your own SV2 client/server implementations.
#noiseprotocol #cryptography #infosec #keyexchange #stratumv2 #miningprotocol #cprogramming #protocolengineering #decentralization #bitcoin #nostrdev #datumgateway #DLT #securecommunication #networkprotocols
Continuing on my journey of adding Stratum V2 (SV2) support to Datum Gateway (focused on the mining protocol), the first step is getting the connection setup between the SV2 server and the miner (client) working.
It uses noise protocol.
This weekend, I got this connection setup working (see below).
I’ll be writing two posts on the current progress.
In the first post, I’ll explain how the Noise handshake works, the cryptographic primitives behind it, and why it's a great fit for securing communication. I'll also dive into key concepts like Diffie-Hellman and ephemeral keys.
In the second post, I’ll walk through a simple C implementation where we use the Noise handshake to exchange SV2 SetupConnection messages. This will show how Noise can be integrated into a real-world Stratum V2 mining pool setup.
This will be useful for anyone working with mining infrastructure or interested in the cryptographic side of things. Stay tuned for the full details!
Here is current progress!
[pool] listening on 0.0.0.0:3334 (pattern=NX, prologue="STRATUM/2")
[pool] static pubkey: 39c0a192403e698f375524d21594068c5ac693137898582d054b052cddb7da47
[pool] handshake complete
[pool] SetupConnection: protocol=2 min=2 max=2 vendor="c-noise-client"
[pool] sent SetupConnection.Success (version=2 flags=0x00000000)
[client] handshake complete
[client] SetupConnection.Success used_version=2 flags=0x00000000
#cryptography #mining #stratumv2 #NoiseProtocol #DatumGateway #SV2 #Nostr #miningprotocol #blockchain
working on adding support of sv2 to Datum (only mining protocol)
a small, self-contained C library for SV2 wire handling, with a minimal evented adapter integrated into DATUM. This brings upstream/downstream SV2 compatibility while preserving the SV1 path.
✅ Core library in C (wire framing, message helpers)
✅ Thin evented server: accept SV2 clients, handle Setup/Open/Submit
✅ Python SV1↔SV2 bridge for testing (no miner firmware changes) for my standalone testing.
and some initial results here
SV2 server (dummy)
[sv2-dummy] client ('127.0.0.1', 52379) connected
[sv2-dummy] <- ext=0x0000 msg=0x00 pay=17 bytes hex=0000001100000c646174756d2d62726964676500000000...
[sv2-dummy] -> SetupConnection.Success used_version=2 flags=0
[sv2-dummy] <- ext=0x0001 msg=0x20 pay=8 bytes hex=010020080000010000000000c842...
[sv2-dummy] (noop) ext=0x0001 msg=0x20
SV2-SV1 bridge for my testing
[bridge] SV1 client connected: ('0.0.0.0', 54730)
[sv1] <- ('', 54730) {"id": 1, "method": "mining.subscribe", "params": ["cpuminer/2.5.1", "b10cf00c1"]}
[sv1] -> ('', 54730) {"id":1,"result":[[["mining.notify","b10cf00c1"],["mining.set_difficulty","b10cf00c2"]],"b10cf00c",8],"error":null}
[sv1] -> ('1', 54730) {"id":null,"method":"mining.set_difficulty","params":[1024]}
[sv1] (seed) dummy job_id=e1ad9163 ntime=68a549f7
[sv1] -> ('1', 54730) {"id":null,"method":"mining.notify","params":["e1ad9163","0000000000000000000000000000000000000000000000000000000000000000","01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff1042524447","ffffffff010000000000000000015100000000",[],"20000000","1d00ffff","68a549f7",true]}
and the miner (SV1)..
* Trying .0.0.167:13333...
* Connected to 0.0.167 (0.0.167) port 13333 (#0)
* Connection #0 to host 0.0.167 left intact
[2025-08-20 05:07:19] > {"id": 1, "method": "mining.subscribe", "params": ["cpuminer/2.5.1", "b10cf00c1"]}
[2025-08-20 05:07:19] < {"id":1,"result":[[["mining.notify","b10cf00c1"],["mining.set_difficulty","b10cf00c2"]],"b10cf00c",8],"error":null}
[2025-08-20 05:07:19] Stratum session id: b10cf00c1
[2025-08-20 05:07:19] > {"id": 2, "method": "mining.authorize", "params": ["", ""]}
[2025-08-20 05:07:19] < {"id":null,"method":"mining.set_difficulty","params":[1024]}
[2025-08-20 05:07:19] Stratum difficulty set to 1024
[2025-08-20 05:07:19] < {"id":null,"method":"mining.notify","params":["e1ad9163","0000000000000000000000000000000000000000000000000000000000000000","01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff1042524447","ffffffff010000000000000000015100000000",[],"20000000","1d00ffff","68a549f7",true]}
[2025-08-20 05:07:19] < {"id":2,"result":true,"error":null}
[2025-08-20 05:07:19] DEBUG: job_id='e1ad9163' extranonce2=0000000000000000 ntime=68a549f7
#bitcoin #Datum
🧠 Just built a lightweight Heartbeat Dashboard for monitoring Stratum miners!
⛏️ Designed to auto-check active clients from journal logs and optionally restart the gateway.
🖥️ Web dashboard + auto backoff + warning when no miners connected.
🛠️ Written in Python. .
https://github.com/electricalgrade/datum_dash
📝 Check it out: #opensource #bitcoin #stratum #mining #nostr #datum
Bitcoin is rules without rulers — but only if miners don’t outsource the rules.
I summarize two key papers that reveal how attackers exploit fee volatility and network latency to profitably destabilize mining — often without detection.
Decentralization is our immune system. More details in the article below.
#Bitcoin #Mining #SelfishMining #Decentralization #DATUM #Security #ProofOfWork #arXiv #Nostr #CensorshipResistance #Crypto
https://primal.net/e/naddr1qvzqqqr4gupzq59aa2xs9z3t8jxr6jt9c7zpg9xa59agm2akp8vv62784cqjstrfqquj6um9d3nxjumg94kkjmnfdenj6un9we5hx6t5v4jz6ttyv4jhqttyd9mx2ttfde6x7tt5wahj66m90ykhqctsv4e8xtgdvppt0
📢 New Experimental Idea:
I’ve been exploring homomorphic encryption over Nostr — simulating private computation using custom events and local relays.
Just published a write-up detailing the design, protocol flow, and a working Python proof of concept.
🧪 Still exploratory, not production-grade — but could open up interesting directions.
👉 Read it here:
https://primal.net/e/naddr1qvzqqqr4gupzq59aa2xs9z3t8jxr6jt9c7zpg9xa59agm2akp8vv62784cqjstrfqp8hg6rfde4kjmn894skymm4wskkzttwv4mj66mfdejz6um9vd6hyefdv3shgcfdvdhkcmrpvfhhyct5d9hkutthd96xsttgdakk7mt0wfcxs6tr94jkucmj09c8g6t0dc9atucf
Would love to hear thoughts, critiques, or wild extensions.
#nostr #encryption #homomorphic #poc #privacy
🚧 Built my own Nostr bot from scratch using python-nostr.
I generated keypairs directly, and wrote a custom Python wrapper for WebSocket + REST communication. The bot is currently live on my self-hosted relay, where I’m doing end-to-end testing. 🧪
Primal only reads from its own relay — it won’t fetch content from other relays (like my self hosted) you post to. Primal only publishes to relays you have in your profile. To get around this, I extended my lite indexer that parses and searches my relay directly. Please note the bot will not spam primal relay and will only use my relay. It will not post to Primal and used for my own internal testing.
This is the beauty of Nostr. Self hosted and free to do anything without causing spam.
Integrated the bot with n8n — so now I can auto-post to my Nostr relay from any workflow, API, or trigger. 🤖
Planning experiments with Homomorphic Encryption — enabling collaborative computation over encrypted data, embedded in Nostr's event model. 🔐
More fun ahead...
#Nostr #SelfHosted #BotDev #Automation #n8n #HomomorphicEncryption #Decentralization #Prima
Planning experiments with Homomorphic Encryption — enabling collaborative computation over encrypted data, embedded in Nostr's event model. 🔐
More fun ahead...
#Nostr #SelfHosted #BotDev #Automation #n8n #HomomorphicEncryption #Decentralization #Prima🧪 Testing my Nostr relay with custom-generated keypairs 🔐
I'm running a self-hosted relay and testing event publishing using locally generated Nostr keys — no client UI, just code and raw JSON.
Every event is hand-crafted, signed, and sent via WebSocket.
✅ Verifying signatures
✅ Enforcing pubkey whitelisting
✅ Watching it land in my SQLite-backed relay
#nostr #selfhosted #testing #decentralization #sqlite #cryptography
🧠 Curious question for fellow Nostr folks...
How many of you run your own Nostr relay?
I recently set one up and it’s been a fun experiment.
Aside from learning more about the protocol, some nice benefits:
✅ Own your part of the network
✅ Support decentralization
✅ Improve relay diversity
✅ Learn how Nostr works under the hood
Would love to hear from others—do you run one? Thinking about it? Why or why not?
#Nostr #NostrRelay #SelfHost #Decentralization
I am a home btw miner. Started with bitaxe then nerdqaxe and nano3s. I write my journey and technical articles at https://substack.com/@electricalgrade
This is first time I am using Nostr
#introductions