đ I've built two more demos for state machines on #nostr â t...

npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf
hex
1472ed9d0c375df92324f052ffcf474c2a2bc9762b78c67607b3e18627f6428dnevent
nevent1qqspguhdn5xrwh0eyvj0q5hlear5c23te9mzk7xxwcrm8cvxylmy9rgprpmhxue69uhhyetvv9ujuem4d36kwatvw5hx6mm9qgsr4fvpwfeu8vhefay3ss8qguhsf8g0zqqfug77vvqxze4u4xekagcgrm6nxKind-1 (TextNote)
đ I've built two more demos for state machines on #nostr â this time involving #cashu, with a few interesting use cases around custody and betting. âĄ
In addition I've made the explanations more verbose and understandable, and rendered a video for every demo with Remotion đŦ. The actors are now generatable per demo and persist across sessions.
Enjoy on https://schlaustronics.com/nsm đ Source: https://github.com/zeSchlausKwab/nsm đ
â
/nsm/wager - Wager ¡ decentralized escrow The custodian holds nothing. Bettors lock stakes into 2-of-2 Cashu multisig and pre-sign every possible outcome; the oracle's only power is choosing which pre-signed package gets the second signature. The mint enforces â no party can steal. https://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/481baf3e1848f676570650cae6233850d1183595b267ab9d77552f361113936c.mp4
/nsm/bet - Bet ¡ oracle-resolved betting Two bettors stake Cashu against an outcome. An oracle publishes what happened, and a payout scroll computes the winnings deterministically. Anyone replaying the chain can re-run the scroll and get the same numbers. https://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/e86a0e2c8eea98ea3f335ab0e9aaab07bee2f696b2afce0dcf9090f22f2d38fe.mp4
/nsm/counter - Counter ¡ the smallest interesting state machine Two players race to a target on a shared counter. Every interaction is a signed Nostr event on a single relay â no APIs, no shared database, no off-band coordination. https://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/b001c9b59cb852cf58c5cc391e6adc7da9daa16fbc90daf08def578eee4cfba6.mp4
/nsm/rps - Rock Paper Scissors ¡ fair play via commit-reveal Both players publish a sha256 commit of their move before either reveals. The custodian re-hashes each reveal to verify it matches the prior commit before snapshotting. https://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/0d33dc8d6d70d993200ef4ff6df8090e7a4c49af4f49cbdf83f9eb24dc244368.mp4
/nsm/vote - Vote ¡ time-driven voting A roster of voters casts yes/no until the deadline. The custodian fires CLOSE_VOTING and FINALIZE herself â but both are gated by the SM's own deadline guard, so any watchtower can verify she didn't close early. https://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/8fc3d0e0312759bdc636697ca602c69bf8daffe00582da346c8d67b392d75de3.mp4
/nsm/badges - Badges ¡ transferable digital assets One shared kind:7500 ownership state machine, many minted kind:7503 badges, each with its own ownership chain under d-tag = imageHash. Transfers require m-of-n validator cosigns. https://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/d88ea53672e7a6f1aa274540abcd2f7a1b640a13c88ab31fc365029d92582406.mp4
/nsm/scroll-counter - Scroll Counter ¡ state machine with pluggable rules Counter shape, but guards and actions are AssemblyScript-compiled WASM blobs (scrolls) published as kind:1227 events. Swap the engine tag, get different rules â the SM definition itself never changes. https://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/d6923d41c832d39b1ce36d3c7d8e59e78d6949859b43bf968e12e0c1444517a5.mp4
/nsm/negotiator - Negotiator ¡ propose, agree, spawn Two parties iterate on a state machine definition until they agree, then a jukebox spawns the negotiated SM and reports the new machineId back. The negotiation transcript IS the contract. https://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/34a1625525bfa2feb3815b16dcdb79146457d8a2ff3211537b147e551f4b7228.mp4
/nsm/nested - Nested ¡ parent + child state machines A tournament parent SM invokes two child match SMs. Every snapshot carries the children's live state alongside the parent's â readable straight off the relay, no extra subscriptions. https://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/0aa41ab712a7c3ea4436a47abb57f0fd43cdce6c98ec77671564c1561fbcb3fd.mp4
/nsm/pool - Pool ¡ decentralized-custody crowdfunding Three stakers lock Cashu P2PK to a target with a refund timelock back to themselves. Majority yes funds the target; the custodian never touches the money â the mint enforces everything. https://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/3b6cee938a2c054f83a2c1eb79faf8d46b5b4c7f263454d94fbbe77b89da5118.mp4
nostr:nevent1qqsfpwsnyy59rjmthl5uw24suyflyek5h00w069pepy857j4e7vmqsgprfmhxue69uhhyetvv9ujuampwejkvatwvvhxc6tkv5hsygp65kqhyu7rktu57jgcgrsywtcyn583qqy7y00xxqrpv672nvmw5vpsgqqqqqqsuxlxw6
åå§ JSON
{
"kind": 1,
"id": "1472ed9d0c375df92324f052ffcf474c2a2bc9762b78c67607b3e18627f6428d",
"pubkey": "3aa5817273c3b2f94f491840e0472f049d0f10009e23de63006166bca9b36ea3",
"created_at": 1778838030,
"tags": [
[
"alt",
"A short note: đ I've built two more demos for state machines on..."
],
[
"p",
"3aa5817273c3b2f94f491840e0472f049d0f10009e23de63006166bca9b36ea3",
"wss://relay.wavefunc.live/"
],
[
"t",
"nostr"
],
[
"t",
"cashu"
],
[
"r",
"https://schlaustronics.com/nsm"
],
[
"r",
"https://kind:1227/"
],
[
"r",
"https://github.com/zeSchlausKwab/nsm"
],
[
"r",
"https://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/0aa41ab712a7c3ea4436a47abb57f0fd43cdce6c98ec77671564c1561fbcb3fd.mp4"
],
[
"r",
"https://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/3b6cee938a2c054f83a2c1eb79faf8d46b5b4c7f263454d94fbbe77b89da5118.mp4"
],
[
"r",
"https://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/e86a0e2c8eea98ea3f335ab0e9aaab07bee2f696b2afce0dcf9090f22f2d38fe.mp4"
],
[
"r",
"https://kind:7500/"
],
[
"r",
"https://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/d6923d41c832d39b1ce36d3c7d8e59e78d6949859b43bf968e12e0c1444517a5.mp4"
],
[
"r",
"https://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/481baf3e1848f676570650cae6233850d1183595b267ab9d77552f361113936c.mp4"
],
[
"r",
"https://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/b001c9b59cb852cf58c5cc391e6adc7da9daa16fbc90daf08def578eee4cfba6.mp4"
],
[
"r",
"https://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/d88ea53672e7a6f1aa274540abcd2f7a1b640a13c88ab31fc365029d92582406.mp4"
],
[
"r",
"https://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/34a1625525bfa2feb3815b16dcdb79146457d8a2ff3211537b147e551f4b7228.mp4"
],
[
"r",
"https://kind:7503/"
],
[
"r",
"https://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/0d33dc8d6d70d993200ef4ff6df8090e7a4c49af4f49cbdf83f9eb24dc244368.mp4"
],
[
"r",
"https://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/8fc3d0e0312759bdc636697ca602c69bf8daffe00582da346c8d67b392d75de3.mp4"
],
[
"client",
"Amethyst"
]
],
"content": "đ I've built two more demos for state machines on #nostr â this time involving #cashu, with a few interesting use cases around custody and betting. âĄ\n\nIn addition I've made the explanations more verbose and understandable, and rendered a video for every demo with Remotion đŦ. The actors are now generatable per demo and persist across sessions.\n\nEnjoy on https://schlaustronics.com/nsm đ\nSource: https://github.com/zeSchlausKwab/nsm đ\n\nâ\n\n/nsm/wager - Wager ¡ decentralized escrow\nThe custodian holds nothing. Bettors lock stakes into 2-of-2 Cashu multisig and pre-sign every possible outcome; the oracle's only power is choosing which pre-signed package gets the second signature. The mint enforces â no party can steal.\nhttps://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/481baf3e1848f676570650cae6233850d1183595b267ab9d77552f361113936c.mp4\n\n/nsm/bet - Bet ¡ oracle-resolved betting\nTwo bettors stake Cashu against an outcome. An oracle publishes what happened, and a payout scroll computes the winnings deterministically. Anyone replaying the chain can re-run the scroll and get the same numbers.\nhttps://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/e86a0e2c8eea98ea3f335ab0e9aaab07bee2f696b2afce0dcf9090f22f2d38fe.mp4\n\n/nsm/counter - Counter ¡ the smallest interesting state machine\nTwo players race to a target on a shared counter. Every interaction is a signed Nostr event on a single relay â no APIs, no shared database, no off-band coordination.\nhttps://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/b001c9b59cb852cf58c5cc391e6adc7da9daa16fbc90daf08def578eee4cfba6.mp4\n\n/nsm/rps - Rock Paper Scissors ¡ fair play via commit-reveal\nBoth players publish a sha256 commit of their move before either reveals. The custodian re-hashes each reveal to verify it matches the prior commit before snapshotting.\nhttps://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/0d33dc8d6d70d993200ef4ff6df8090e7a4c49af4f49cbdf83f9eb24dc244368.mp4\n\n/nsm/vote - Vote ¡ time-driven voting\nA roster of voters casts yes/no until the deadline. The custodian fires CLOSE_VOTING and FINALIZE herself â but both are gated by the SM's own deadline guard, so any watchtower can verify she didn't close early.\nhttps://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/8fc3d0e0312759bdc636697ca602c69bf8daffe00582da346c8d67b392d75de3.mp4\n\n/nsm/badges - Badges ¡ transferable digital assets\nOne shared kind:7500 ownership state machine, many minted kind:7503 badges, each with its own ownership chain under d-tag = imageHash. Transfers require m-of-n validator cosigns.\nhttps://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/d88ea53672e7a6f1aa274540abcd2f7a1b640a13c88ab31fc365029d92582406.mp4\n\n/nsm/scroll-counter - Scroll Counter ¡ state machine with pluggable rules\nCounter shape, but guards and actions are AssemblyScript-compiled WASM blobs (scrolls) published as kind:1227 events. Swap the engine tag, get different rules â the SM definition itself never changes.\nhttps://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/d6923d41c832d39b1ce36d3c7d8e59e78d6949859b43bf968e12e0c1444517a5.mp4\n\n/nsm/negotiator - Negotiator ¡ propose, agree, spawn\nTwo parties iterate on a state machine definition until they agree, then a jukebox spawns the negotiated SM and reports the new machineId back. The negotiation transcript IS the contract.\nhttps://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/34a1625525bfa2feb3815b16dcdb79146457d8a2ff3211537b147e551f4b7228.mp4\n\n/nsm/nested - Nested ¡ parent + child state machines\nA tournament parent SM invokes two child match SMs. Every snapshot carries the children's live state alongside the parent's â readable straight off the relay, no extra subscriptions.\nhttps://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/0aa41ab712a7c3ea4436a47abb57f0fd43cdce6c98ec77671564c1561fbcb3fd.mp4\n\n/nsm/pool - Pool ¡ decentralized-custody crowdfunding\nThree stakers lock Cashu P2PK to a target with a refund timelock back to themselves. Majority yes funds the target; the custodian never touches the money â the mint enforces everything.\nhttps://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf.blossom.band/3b6cee938a2c054f83a2c1eb79faf8d46b5b4c7f263454d94fbbe77b89da5118.mp4\n\nnostr:nevent1qqsfpwsnyy59rjmthl5uw24suyflyek5h00w069pepy857j4e7vmqsgprfmhxue69uhhyetvv9ujuampwejkvatwvvhxc6tkv5hsygp65kqhyu7rktu57jgcgrsywtcyn583qqy7y00xxqrpv672nvmw5vpsgqqqqqqsuxlxw6",
"sig": "c1e42905a97beddfac67effd6b4a51bb6e84f16f3c9266db23d8fa93e9b4eb23bdd57c95bf944404d0cf6143781223ff8072949c054169e5b99ca6b3dd520bab"
}