Embedded Cashu wallet

nucula

Tap-to-pay ecash on a $23 board.
ESP32-C3 · PN7160 NFC · open hardware.

Open source · CERN-OHL-S-2.0 hardware

What is it

A Cashu wallet
on a microcontroller.

Holds ecash from several mints. Receives over NFC. Mints and melts over Lightning. Keeps working offline and redeems later.

MCU
ESP32-C3 · RISC-V
Radio
NXP PN7160 NFC · Wi-Fi
Display
2.4″ OLED · 128 × 64
Input
3 × 4 keypad (detachable)
Power
USB-C · single-cell Li-ion

The idea

Digital cash that behaves like cash.

Cashu is an ecash protocol built on Bitcoin's Lightning Network. A mint issues tokens against Lightning payments using blind signatures, so it signs tokens it never sees. Whoever holds the tokens can spend them. There's no account and no balance on a server: the tokens are the money.

nucula keeps those tokens on a small circuit board. Paying someone works like handing over coins. The tokens move from one device to the other, and that is the whole transaction.

a

Pay a Lightning invoice

Any Lightning wallet can top up a nucula. The mint takes the payment…

b

The mint issues tokens

…and hands back blind-signed ecash. The mint can't tell who ends up holding it.

c

Tokens live on the device

Not in an account, not on a server. Whoever holds the device holds the money.

d

Tap to pass them on

Spending means handing tokens to someone else, over NFC or back out through Lightning.

Cashu over NFC

Tap, and the token moves.

  1. READ creqA…The phone reads a NUT-18 payment request from nucula.
  2. WRITE cashuB…The phone writes the token back to nucula.
  3. SWAP /v1/swapnucula swaps it at the mint, or verifies it offline and stashes it.

Numo made Cashu tap-to-pay real on Android point-of-sale devices. nucula speaks the same NDEF handshake, so a wallet that can pay Numo can pay nucula.

NUT-18 payment requestNDEF text recordISO-DEP · Type 4 Tag

Why dedicated hardware

Why
nucula?

  1. CostAbout $23 in parts per board, at prototype quantities.
  2. FlexibilityOpen hardware, open firmware: change anything.
  3. IntegrationGoes inside machines that already exist.
  4. ExtensionAdds tap-to-pay to a point of sale that has no NFC.
  5. RobustnessA single-purpose device with no OS updates and no app store. It still receives offline.

Anything that takes (or used to take) coins.

Vending

Snacks, drinks, parts.

Ticketing

Transit, events, parking.

Laundromat

Washers, dryers.

Coin slots

Arcades, lockers, meters.

02 / 03

Hardware

Four layers, 128 parts, one I²C bus.

nucula-board · rev 2

One board.

Everything on the top side. The keypad section snaps off.

Outline
60 × 110 mm
Keypad section
60 × 35 mm · breakaway
Layers
4 · FR-4 · 1.6 mm · ENIG
Parts
128 · 55 unique · top side only
License
CERN-OHL-S-2.0

At the heart

ESP32-C3

A modern RISC-V microcontroller with Wi-Fi and Bluetooth LE on the die. Lean, and cheap.

Core
RV32IMC · single core · 160 MHz
Memory
400 KB SRAM · 4 MB flash
Radio
Wi-Fi 4 · Bluetooth 5 LE
Accelerators
SHA · AES · RSA / MPI
Module
WROOM-02-N4 · $3.32

NFC

NXP PN7160

NFC controller with an integrated RF front end. It speaks NCI 2.0 over I²C and emulates a card.

Interface
I²C 0x28 · IRQ · VEN
Mode
Card emulation · ISO-DEP
Antenna
PCB coil · 40 × 40 mm · 4 turns
Inductance
≈ 1.56 µH
Matching
→ 20 Ω @ 13.56 MHz

Charging & power

Power path.

Input
USB-C · 5 V
Charger
TP4054 · 100 mA
Battery
Li-ion · ~400 mAh
Select
USB › battery
Regulator
SY8089 buck · 3.31 V
Supervisor
TLV803

Power stage adapted from Olimex ESP32-C3-DevKit-Lipo rev C · CERN-OHL-S

Input

Keypad,
detachable.

A PCF8574T 8-bit I/O expander scans a 3 × 4 matrix, so the keypad costs two pins on the MCU.

Expander
PCF8574T · I²C 0x20
Breakaway
2 mouse-bite tabs · 28 × ⌀0.6 mm
Bridge
3V3 · GND · SDA · SCL · INT
Silkscreen
“1 CUT BRIDGE / 2 SNAP”

Everything on one bus

Two wires.
Three chips.

MCU
ESP32-C3 · GPIO6/7
NFC
PN7160 · 0x28
OLED
SSD1309 · 0x3C
Keypad
PCF8574T · 0x20

100 kHz · each device probed at boot · all optional

Stackup

Four layers.

The NFC coil and signals are on top. The inner layers are ground. There is no copper under the coil.

1,021trace segments
312vias
91nets

Manufacturing cost

Keep it
standard.

  1. Standard 4-layer stackupNo impedance control ordered.
  2. Open 0.30 mm viasInstead of filled and capped vias. No via-in-pad.
  3. Single-sided assemblyAll parts on top: one stencil, one reflow.
  4. Basic parts where possible“Extended” library parts add setup fees.
Parts per board · prototype qty≈ $23
PN7160$4.05
ESP32-C3 module$3.32
PCF8574T$2.14
Inductors 150 nH ×2$1.67
OLED socket$1.53
USB-C$0.92

Components only · excludes PCB, assembly, display, battery

03 / 03

Firmware

400 KB of RAM, one core and a lot of elliptic curves.

Build environment

C, C++ & ESP-IDF.

ESP-IDF 5.5.1FreeRTOSGCC 14.2CMakesecp256k1blstcJSON · CBOR
19,862lines in main/
1.52MBfirmware image · 80% of app partition
11Cashu NUTs
C · crypto, driversC++ · wallet, protocol, UIheaders

Component map

What runs where.

App
console
UI · display · keypad
NFC payment task
offline drain
Cashu
wallet · mint / melt / swap
keysets · NUT-02
tokens · JSON · CBOR V4
NUT-10 / P2PK
Crypto
secp256k1 · BDHKE · DLEQ
blst · BLS12-381
BIP-39 · NUT-13
HW SHA · RSA / MPI
Drivers
PN7160 · NCI
SSD1309 · PCF8574
Wi-Fi · HTTPS keep-alive
NVS wallet store
Platform
ESP-IDF · FreeRTOS · ESP32-C3

Features

What can it do?

NUT-18

Tap to receive

A payment request over NFC. The phone writes the token back.

NUT-04 · 23

Mint

Fund the wallet with a Lightning invoice.

NUT-05

Melt

Pay Lightning invoices from ecash.

Multi-mint

3 mints

Up to 10 cached keysets each.

NUT-10 / 11

Offline receive

P2PK-locked, verified at tap time, stashed and redeemed when Wi-Fi returns.

NUT-12

DLEQ

Proofs are verified, not trusted.

NUT-13

Seed backup

BIP-39 from hardware entropy. Recover from twelve words.

stickup

Drain all

Every balance out as V4 tokens.

Speaks standard Cashu: any wallet that follows the NUTs can pay a nucula

One tap, step by step

Tap-to-pay flow.

  1. nuculaBuild a NUT-18 request (P2PK-locked if offline) and pre-warm TLS to the mint.
  2. READ BINARYThe phone reads creqA… from nucula.
  3. UPDATE BINARYThe phone writes cashuB… back.
  4. POST /v1/swapnucula swaps the proofs and verifies the mint's DLEQ.
  5. Received ✓The display confirms the payment.

Working around the hardware

Small, slow, and full.

RAM
61KBfree heap · largest block 26 KB

mbedTLS dynamic buffers. One /v1/keys request instead of N. Bounded crypto scratch: a 10 KB stack frame became 3 KB.

CPU
~500×slower than a laptop (M2 Max)

One core at 160 MHz. The accelerators (SHA, RSA/MPI) are the only parallelism, so we use them.

Storage
152KBNVS for proofs, keysets, seed

The 4 MB flash holds a 1.52 MB image in a 1.81 MB slot. SoftAP and IPv6 were cut to save about 50 KB.

Crypto · secp256k1

Every µs counts.

originaloptimised
hash_to_curve3.46 → 1.34 ms
blind_message20.2 → 10.5 ms
verify_dleq56.9 → 21.3 ms
SHA-256

Hardware compression hooked into libsecp256k1.

Tables

A 2 KB signing comb beat the 22 KB and 86 KB tables.

DLEQ

Joint scalar multiplication.

Compiler

-Os beats -O3 because of icache.

Crypto · BLS12-381

BLS on a $3 chip.

Cashu v3 keysets use BLS signatures. A token checks out with one pairing:

e(C, G₂) = e(Y, K)

Fully offline. No DLEQ needed.

The trick: 384-bit Montgomery multiplication runs on the RSA accelerator. The CPU does Fp2 additions while the engine multiplies.

portable CRSA / MPI peripheral
hash_to_G14.6×
G1 scalar mul4.1×
unblind4.1×
pairing verify1286 → 368 ms
batch · 104.37 → 1.11 s
~1.08s10 new proofs, known mint
1.97×BLS verify · warm caches
4,410differential test cases vs host

52 builds later

End to end.

Operationbeforeafterspeed-up
10-proof swap · crypto4,578 ms2,520 ms1.82×
BLS verify · 10 proofs / 10 keys1,886 ms960 ms1.97×
secp DLEQ verify · NUT-1256.95 ms21.30 ms2.67×
Nutroot 8-of-15 threshold1,734 ms138 ms12.56×

On-device, 160 MHz, crypto only. Rejected: whole-program LTO (2× slower), hardware inversion, hand-written asm.

Open hardware

Nothing
to buy.

Schematics, board layout, BOM and manufacturing files are all in the KiCad 10 project. The v2 board is a routed prototype for manual assembly; bring-up is still ahead.

Design
KiCad 10 · project-specific parts included
Fabrication
4 layers · 1.6 mm · ENIG · Gerbers + drills
Sourced separately
OLED · keypad · battery
open the hardwarezsh
$ git clone https://github.com/zeugmaster/nucula-board.git
$ cd nucula-board
# check the schematic (needs kicad-cli)
$ python3 tools/check_schematic.py
$ kicad nucula-v2.kicad_pro
current PCB: v2 · routing review · 22 September 2026

Remaining work

Not done yet.

  1. NFC tuningTune with a VNA toward 20 + j0 Ω, using the trim pads and removable TX links.
  2. Component sizeRF parts are 0805 / 1206 so they can be hand-tuned. Shrink them once the values are known.
  3. Bring-up & powerInrush current, charger heat, and battery runtime.
  4. EnclosureDisplay fit and ribbon routing.