Skip to content

Instantly share code, notes, and snippets.

View kushti's full-sized avatar

Alexander Chepurnoy kushti

View GitHub Profile

1. The scheme

A hawala-like transfer has four parties in two cities:

   city 1                          city 2
 ┌───────────┐   cash          ┌───────────┐
 │ A sender  │ ──────────────▶ │ B oper-1  │        A hands cash to B.
 └───────────┘ (A → B) └───────────┘ B signs receipt R1 for A.
// CASH2CASH transfer vault — PROVEN box: R1 (B's cash-collected receipt) is on-chain,
// so B took A's cash and the collateral now belongs to the settlement. This box waits
// for one of two outcomes: C settles with R2 (the normal path), or D takes the insurance
// fallback after T2 (C flaked — the intended recipient is compensated from B's
// collateral, which is correct: B kept A's cash). Design: cash2cash/README.md.
//
// Spending paths:
// SETTLE — C presents R2, D's Schnorr signature over the 55-byte cash-delivered
// record, verified under the R6 key and bound to this deal by the
// record's dealId; C co-signs (proveDlog(R5)) because the receipt alone
// CASH-2-CASH: secured cash transfer
// CASH-2-CASH works as follows: user A pays in cash to operator B, operator C pays in cash to user D.
// This way cash is going from A to D, via on-chain operators B & C.
// CASH2CASH transfer vault — FUNDED box (operator B's USE collateral locked, transfer
// live). Design and threat model: cash2cash/README.md. Four parties: A (sender) pays
// cash to B (operator-1, the vault funder) in one city; C (operator-2) pays cash to D
// (recipient) in another; the vault settles B's debt to C against two Schnorr-signed
// cash receipts — R1 (B's signature, held by A) and R2 (D's signature, held by C).
// NO ORACLE: settlement is proven by the receipt chain alone.

Rosen Intents - On-chain Secured Crosschain Swaps Neutral Protocol

Different blockchains provide very different properties and experience. Old bitcoins are moving to Monero before reaching a centralized exchange;
Ethereum provides basic DeFi with deepest liquidity etc. New blockchains and blockchains coming (such as DarkFi) are ignored by large CEXes if they are not scammy enough (it is enough to be a Proof-of-Work blockchain just and then no chance to get listed on Binance these days), so would be good to provide multichain liquidity access for them since day one.

{
"tx" : {
"inputs" : [
{
"boxId" : "261cd9e7307e286c775659c356934186ced2a1f089632daba8adcae65984a419",
"extension" : {
}
},
{
# How Multisignatures on Monero Are Done
> Answer to: the Haveno README states *"Transactions between traders are secured by non-custodial multisignature transactions on the Monero network."* — what does that actually mean, and how does it work?
## Part 1: How Monero multisig works in general
### No scripts — signatures are the spending condition
Unlike Bitcoin, Monero has **no scripting language**, so a multisig condition cannot be expressed on-chain as "2 of 3 keys may spend". The spending condition of every Monero input is simply *a valid signature*: an **MLSAG ring signature** that produces a unique **key image** (which prevents double spends). Multisig is therefore done by **splitting the keys so that the signature can only be produced jointly**.
ergo {
directory = "/var/pool/ergo/mainnet"
networkType = "mainnet"
node {
mining = true
}
chain {
reemission {
checkReemissionRules = true
}
## Anomalies found and explained
### A. Post-block "invalid tx" bursts (benign race, very frequent)
When block N is applied, its transactions remain in the mempool for a few milliseconds.
`CandidateGenerator` (running on `ef-critical-dispatcher`) races ahead of mempool cleanup
(`ErgoMemPool` invalidation/removal on another thread), so `collectTxs` flags the just-mined
transactions as "double-spending or spending non-existing inputs"
(`src/main/scala/org/ergoplatform/mining/CandidateGenerator.scala:897`).
12:53:40.598 ERROR [ef-critical-dispatcher-17] o.e.m.m.ErgoTransaction - EIP-27 check failed due to requirement failed: outputs contain reemission token :
java.lang.IllegalArgumentException: requirement failed: outputs contain reemission token
at scala.Predef$.require(Predef.scala:281)
at org.ergoplatform.modifiers.mempool.ErgoTransaction.$anonfun$verifyReemissionSpending$14(ErgoTransaction.scala:319)
at org.ergoplatform.modifiers.mempool.ErgoTransaction.$anonfun$verifyReemissionSpending$14$adapted(ErgoTransaction.scala:318)
at scala.collection.TraversableLike.$anonfun$filterImpl$1(TraversableLike.scala:304)
at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:36)
at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:33)
at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:38)
at scala.collection.TraversableLike.filterImpl(TraversableLike.scala:303)
14:25:00.511 INFO [f-critical-dispatcher-541] o.e.m.CandidateGenerator$ - Got candidate block at height 1833224 with 11 transactions, msg c111a9414008fc319efaa2e9d3e69a1aac341252bd2c185471e78b99bc28abff
14:26:14.033 DEBUG [f-critical-dispatcher-540] o.e.m.CandidateGenerator - Regenerating candidate block
14:26:17.642 INFO [f-critical-dispatcher-540] o.e.m.CandidateGenerator$ - Got candidate block at height 1833224 with 20 transactions, msg b992c870e62b656079391035a524e17546cb6ec1cf4911b9f02c9193a7669eda
14:26:52.949 INFO [f-critical-dispatcher-540] o.e.m.CandidateGenerator$ - Got candidate block at height 1833225 with 3 transactions, msg 6bfb2e0a132f614dbca416c8bf02c9a5adbe7e2fa8a3076c4724d5839eb43477
14:27:58.866 DEBUG [f-critical-dispatcher-551] o.e.m.CandidateGenerator - Regenerating candidate block
14:28:01.358 INFO [f-critical-dispatcher-551] o.e.m.CandidateGenerator$ - Got candidate block at height 1833225 with 6 transactions, msg 527530b5cee7188091ae4bc23c4887e4c7e7d7b451832f731f0c3d7c3e6c709e
14:2