Sovereign Engineering Cohort 5 with a bunch of nostr freedom tech hackers. I spent three weeks in paradise walking the levadas, experimenting with new ideas, and leveling up my vibe skills. It was a great success! I was only able to stay for the first half of the cohort but I arrived back home more bullish than ever. I continued the Friday shipping schedule from home for the remainder of the cohort and followed it up with my favorite bitcoin conference, TABconf, where I sat on a mining decentralization panel.
Before I travelled to Madiera, I was still hard at work hashing out the protocol (pun intended). It worked by creating locked quotes at the mint and letting the user's wallet sweep the quotes on demand using the locking privkey. But in order to make this work I had to communicate the mint quote to the wallet somehow. The easiest solution was to create a mint quote lookup API. This design degrades user privacy if the user reuses locking keys but it has the nice property of reusing the mint as a storage service for unclaimed ehash tokens, minimizing network trips necessary to mint ehash.
I opened a PR to the cashu NUTs repo to upstream this API. Calle nacked the proposal on privacy grounds so I began a refactor to the protocol that would return the quote ID to the proxy server via new Sv2 extension message channels. It was a big task that would involve a lot of new message types and channels between the different components of the mining pool. I had been avoiding making big changes to the Sv2 protocol but at this point the right path was clear to me. I began this work but did not get far before travelling to Madiera.
No problem, I told myself...I'm gonna vibe on nostr stuff and get back to ehash development later. lol
For the first week of SovEng I wanted to start building nostr mempool. This is a project that has captured my imagination for some time now. The idea is to elevate bitcoin transaction relay to a new transport layer outside of the bitcoin peer-to-peer network. The benefits of this approach are manifold: we can drop all filter rules on transactions (spam AND policy filters), we can use ecash exogenous transaction fees to sidestep RBF and CPFP fee bumping restrictions, and, most importantly for my purposes, I can build a new set of truly public and permissionless transaction acceleration rails for the next generation of mining pools. I will write more on this topic as the project advances.
After a week of work I published my first rust crate bitcoin-nostr-relay. It's a dead simple library that speaks bitcoin RPC and nostr websockets. The basic idea is to periodically scan your bitcoin node's mempool for new transactions and broadcast them over nostr. When a new transaction is received from nostr the library will insert it into your node's mempool via RPC.
I vibed up a sandbox playground to test the library. The sandbox environment runs two bitcoin nodes in blocks-only mode. They transmit blocks to each other but do not participate in bitcoin p2p transaction relay. Instead they both connect to a nostr relay using the bitcoin-nostr-relay
crate and gossip transactions over nostr. It supports regtest and testnet4. Test cases include standard and non-standard bitcoin transactions. In the next upgrade I will add transaction filters so node runners who want to block spam (or any other type of transaction) from their node can easily do so.
My initial plan was to push nostr mempool and other projects forward for the duration of Sovereign Engineering but after the first week people kept asking me "wen ehash" so I pivoted and put the hammer down on ehash development for the remainder of the cohort. I think this is the correct order of development because nostr mempool only makes sense with a robust network of mining nodes. When it comes to transaction relay, only mining nodes matter. This is a fact that seems to be lost in the culture war debates.
For the second week I wanted to demo ehash payment forwarding to the cohort but I was still in the middle of a protocol refactor. I didn't want to build payment forwarding on top of the quote lookup API, which was on its way out, so I put my nose to the grindstone and finished the protocol refactor. I had to get outside of my comfort zone to vibe up a new set of Sv2 protocol extension messages between the mint and the other roles.
In the new architecture, the pool receives a share, creates a quote at the mint, and returns a success message immediately to the proxy. When the quote status is set to PAID
(which currently happens immediately, but in the future will happen upon block template validation) the mint broadcasts the quote ID to the pool and the pool forwards it to the proxy over the new message channels. It felt really good to demystify much of the Sv2 messaging layer protocols by building new channel and message types.
This architecture allows the mint to maintain strict privacy of quote IDs, only ever sharing the quote ID with the party who generated it. Another benefit of this approach is that it allows the miner to automatically regain their privacy from the mint. When you mine to a mining pool today, you expose your IP address. So if you retrieve the ehash tokens directly from the quote that was created on a connection that exposed your IP, the mint can associate the IP used to create the quote with the IP used to redeem it.
One of the magical properties of ecash is that it only takes one transaction to regain your privacy. In the new architecture the proxy redeems the quotes directly, so no new IP address is doxxed. With payment forwarding the proxy makes an additional transaction, removing the possibility of the pool or mint linking the destination wallet IP to the mining IP.
With one day left I began vibing on cashu payment request forwarding. The idea is to receive the ehash tokens at the proxy and send them, encrypted, to a nostr relay where the user can claim them asynchronously. It was simple in concept and I got probably 90% of the way to a working implementation before demo time, but I did not produce a working implementation.
I felt pretty down leading up to my demo but the 5 or 6 projects before me all failed in one way or another so when I stood up to present and got a big laugh by pointing this out I felt much better. I still plan to build this feature and I've left the development plans in the repo for when I get back to it. I think it's a killer usability feature and development should go much more smoothly next time I give it a go.
For the third week, my last week in Madiera, I wanted to demo ehash to a live audience for the first time. Gary did this in Austin a few months before but I had bigger designs. I wanted to vibe up a mining pool UI with a faucet, mine to it from a bitaxe, and demo claiming the ehash to a wallet. After trying to do too much the previous week and falling short of my goal I was feeling good about the more limited scope of this plan. No need to reinvent the protocol before beginning to tackle the demo.
I had not mined to hashpool directly from an ASIC before so I had to do a little work to align the pool and proxy difficulty adjustments. The problem I encountered when mining with a real ASIC was that the pool and proxy were both trying to adjust their difficulty targets, which lead to a kind of three body problem. It was very difficult to arrive at a stable difficulty target because both targets kept moving. My solution was to disable the proxy difficulty adjustment and let the pool be the source of truth. If you look at SRI release notes you will notice they recently implemented the same solution.
This was a quick win in my hacky architecture so I had plenty of time to vibe up a UI. Demo day was a great success! Inside of 6 minutes I demonstrated mining ehash from a bitaxe and claiming it to a cashu.me instance. Below you can see the first version of the UI. Not too bad! The LLM just decided it should have a green on black terminal aesthetic so I rolled with it. Bitchat vibes. No regrets.
I left Sovereign Engineering physically but I was still there in spirit. I spent most of the fourth week cleaning up the UI and deploying it. I fixed a ton of display issues, replaced all the emojis with svg icons from the Bitcoin icons project, stood up a vps, and deployed my dev environment to it. It was super hacky but it technically worked and it looked great.
In the process I had to discover how the ehash units would work. I wanted a system that would allow ehash from different pools to share a universal difficulty. This will be critical for hash traders to compare different ehash assets from different pools. The fundamental problem is that block header hashes are 256 bit numbers but cashu assets (in cdk) are 64 bit numbers. So I needed to shrink the representable range of share hashes by 75%. I did a little math and came up with a reasonable range.
I tasked MacchuPikachu with this issue some time ago and when I poked him he opened a PR with his work in progress fix. It worked great! I cherry-picked it into master with a couple of fix up commits, redacted the miner IPs, and launched the site. Teamwork makes the dreamwork. 🤝
You can see the two sites now at pool.hashpool.dev and proxy.hashpool.dev. I also stood up a forked version of cashu.me at wallet.hashpool.dev. I had to fork it to enable the HASH
currency unit and disable the others. I don't want people storing real money on my dev wallet because I am definitely going to rug them.
When I chatted with MacchuPikachu in our development meeting he shared this excellent resource on vibe coding in large codebases. I could tell it was good because I had independently discovered many of the principles at work that the author describes. I decided to level up again and push forward a really big project: rebasing Hashpool onto the latest SRI version. I spent a day or two vibing up a development plan only to have my LLM give up the ghost immediately. Rebasing every SRI commit against every Hashpool commit for almost a year of work was not a feasible plan.
I did manage to get my version up to SRI 1.2.0 and extract some of the ehash logic into a separate crate. But in order to pull off this upgrade I was going to have to be a lot more aggressive. I started again with a new plan to split out the stats service from the pool and proxy services. After a lot of vibing I was ready to deploy on Friday afternoon. Ugh! I knew better but I needed to get it done to hold to the Friday shipping schedule so I pushed through.
My deployment process of building and running the entire environment on the VPS fell over at exactly that time. I forget my exact solution but it involved copying over the built binaries and running them manually. I got it working but my Friday evening was shot and it was only a temporary solution. What is that famous saying about deploying on Friday?
For my final week of SovEng I wanted to accomplish a long-term goal of publishing the NUT spec for minting ehash. But first, I had to fix the production deployment. I vibed up some proper deployment scripts and got them working. No more cargo builds on a CPU-throttled vps or out of memory errors!
I also refactored the roles again to split the stats and web services into separate roles and use a snapshot broadcast model instead of attempting to reconstruct the proper state from individual message announcements. This was necessary to clean up the litany of display and stale data issues. By now I was getting pretty comfortable vibing large refactors. It's really addictive to work hard and progress quickly!
With the project in a good state I crafted two new NUT specs and opened draft PRs. Deterministic Derivation Paths are necessary to enable a different unit for each ehash mining epoch. The Mining Share Payment Method details the process and key concerns of minting ehash tokens.
With SovEng in my rear view mirror I headed to Atlanta for my favorite bitcoin conference: TABConf. This was my first technical bitcoin conference many years ago and I have become a regular fixture since then.
I sat on a mining decentralization panel in the socratic village that went really well. A few people told me it was the best event of the conference. Cool! All the panel members also felt that it went well.
At the conference I discussed my work and my thinking with a bunch of people, including core devs working on compact block relay, MEVpool developers, Bob McElrath of Braidpool, and I even got to meet Christopher Allen at a conference afterparty. (I cashu pilled him!)
I look forward to pursuing these working relationships and, as always, my brain is brimming with the possibility space that opened up from the things I learned and people I met at TABconf.
I feel that progress on ehash and Hashpool has dramatically accelerated in the past few months. I am well positioned to finish the SRI version upgrade and start contributing to that team's discussions on splitting up the monorepo. I think I bring a valuable perspective as one of the first Sv2 extensions.
I am also ready to begin developing ehash redemptions. I have a really solid platform to generate ehash tokens, now we just need to turn them into sats. I discussed the protocol design with Calle in one of those 1 hour meetings that can save you 2 years of work so I have a rough outline of how to make it work. Now I just have to vibe it into reality. LFG :)