Cashu open source contributor
2025, Chiang Mai
What is a nut?
Can we genetically engineer nuts?
How are nuts made?
Show me your nuts
Nut == Token == Proofs == Ecash
A nut (ecash token) is a proof
that a secret has been previously blindly signed with a given key
+
=
Secret
Blinding factor
Fertilizer (AKA mint signature)
Nut anatomy 101
Secret
Signature
KeysetID
Amount
{
"secret":"1ea6f7f0e907f5841285a3815a74c84e6d710b0b458b959d68c9d60aabbb40ac",
"C":"02c6ee49eabc2bb027973ab5c79cdf379a74fff0731ccbae3b0d419b3d635075e6",
"amount":1,
"id":"00b4cd27d8861a44"
}
Nut anatomy: Recovarable
{
"secret":"1ea6f7f0e907f5841285a3815a74c84e6d710b0b458b959d68c9d60aabbb40ac",
"C":"02c6ee49eabc2bb027973ab5c79cdf379a74fff0731ccbae3b0d419b3d635075e6",
"amount":1,
"id":"00b4cd27d8861a44"
}
{
"deterministic_secret":"1ea6f7f0e907f5841285a3815a74c84e6d710b0b458b959d68c9d60aabbb40ac",
"deterministic_blinding_factor":"02c6ee49eabc2bb027973ab5c79cdf379a74fff0731ccbae3b0d419b3d635075e6",
}
Nut anatomy: Well known secret / script
{
"amount": 1,
"secret": "[\"P2PK\",{\"nonce\":\"859d4935c4907062a6297cf4e663e2835d90d97ecdd510745d32f6816323a41f\",\"data\":\"0249098aa8b9d2fbec49ff8598feb17b592b986e62319a4fa488a3dc36387157a7\",\"tags\":[[\"sigflag\",\"SIG_INPUTS\"]]}]",
"C": "02698c4e2b5f9534cd0687d87513c759790cf829aa5739184a3e3735471fbda904",
"id": "009a1f293253e41e",
"witness": "{\"signatures\":[\"60f3c9b766770b46caac1d27e1ae6b77c8866ebaeba0b9489fe6a15a837eaa6fcd6eaa825499c72ac342983983fd3ba3a8a41f56677cc99ffd73da68b59e1383\"]}"
}
Ex: P2PK lock
Nut anatomy: HTLC
[
"HTLC",
{
"nonce": "da62796403af76c80cd6ce9153ed3746",
"data": "023192200a0cfd3867e48eb63b03ff599c7e46c8f4e41146b2d281173ca6c50c54",
"tags": [
[
"pubkeys",
"02698c4e2b5f9534cd0687d87513c759790cf829aa5739184a3e3735471fbda904"
],
["locktime", "1689418329"],
[
"refund",
"033281c37677ea273eb7183b783067f5244933ef78d8c3f15b1a77cb246099c26e"
]
]
}
]
Ex: P2PK lock
Nut anatomy: Offline verify
{
"id": <str>,
"amount": <int>,
"secret": <str>,
"C": <str>,
"dleq": { <-
"e": <str>,
"s": <str>,
"r": <str>
}
}
With DLEQ proof
Proof that blind signature was from mint's key
Nut anatomy: Offline receivable
P2PK + DLEQ = Offline receivable
{
"amount": 1,
"secret": "[\"P2PK\",{\"nonce\":\"859d4935c4907062a6297cf4e663e2835d90d97ecdd510745d32f6816323a41f\",\"data\":\"0249098aa8b9d2fbec49ff8598feb17b592b986e62319a4fa488a3dc36387157a7\",\"tags\":[[\"sigflag\",\"SIG_INPUTS\"]]}]",
"C": "02698c4e2b5f9534cd0687d87513c759790cf829aa5739184a3e3735471fbda904",
"id": "009a1f293253e41e",
"witness": "{\"signatures\":[\"60f3c9b766770b46caac1d27e1ae6b77c8866ebaeba0b9489fe6a15a837eaa6fcd6eaa825499c72ac342983983fd3ba3a8a41f56677cc99ffd73da68b59e1383\"]}"
"dleq": {
"e": "<str>",
"s": "<str>",
"r": "<str>"
}
}
Nut anatomy: Fully offline transaction
P2PK + timelock + refund + DLEQ = Offline transaction
{
"amount": 1,
"secret": [
"P2PK",
{
"nonce": "da62796403af76c80cd6ce9153ed3746",
"data": "033281c37677ea273eb7183b783067f5244933ef78d8c3f15b1a77cb246099c26e",
"tags": [
["locktime", "1689418329"],
[
"refund",
"033281c37677ea273eb7183b783067f5244933ef78d8c3f15b1a77cb246099c26e"
],
[
"pubkeys",
"023192200a0cfd3867e48eb63b03ff599c7e46c8f4e41146b2d281173ca6c50c54"
]
]
}
],
"C": "02698c4e2b5f9534cd0687d87513c759790cf829aa5739184a3e3735471fbda904",
"id": "009a1f293253e41e",
"witness": {
"signatures": "<Array[<hex_str>]>"
},
"dleq": {
...
}
}
Nut anatomy: Fully offline transaction
Online
Alice
Bob
Mint
Get pubkey
Mint locked ecash
Send ecash
Offline (QR)
Verify offline
Redeem before refund timelock expires
npub1cj6ndx5akfazux7f0vjl4fyx9k0ulf682p437fe03a9ndwqjm0tqj886t6
Let's keep in touch on nostr