add cooperative cancellation to keyspend in concept 1

This commit is contained in:
fbock
2024-05-16 17:11:45 +02:00
parent 6f4860034a
commit e3a96c7e96
4 changed files with 26 additions and 25 deletions

View File

@ -13,11 +13,11 @@
"state": {
"type": "canvas",
"state": {
"file": "Research/Implementation/CLI demonstrator architecture/demonstrator architecture.canvas",
"file": "Research/Trade Pipelines/new concepts/concept locking script 1.canvas",
"viewState": {
"x": -18.47779088477204,
"y": -102.56510451238792,
"zoom": -0.23504842122395792
"x": -114.64351428525751,
"y": -105.99427714297474,
"zoom": -0.06112889783968051
}
}
}
@ -88,7 +88,7 @@
"state": {
"type": "backlink",
"state": {
"file": "Research/Implementation/CLI demonstrator architecture/demonstrator architecture.canvas",
"file": "Research/Trade Pipelines/new concepts/concept locking script 1.canvas",
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
@ -105,7 +105,7 @@
"state": {
"type": "outgoing-link",
"state": {
"file": "Research/Implementation/CLI demonstrator architecture/demonstrator architecture.canvas",
"file": "Research/Trade Pipelines/new concepts/concept locking script 1.canvas",
"linksCollapsed": false,
"unlinkedCollapsed": true
}
@ -128,7 +128,7 @@
"state": {
"type": "outline",
"state": {
"file": "Research/Implementation/CLI demonstrator architecture/demonstrator architecture.canvas"
"file": "Research/Trade Pipelines/new concepts/concept locking script 1.canvas"
}
}
}
@ -152,15 +152,16 @@
"active": "bdb9fd88a01a8909",
"lastOpenFiles": [
"Research/Trade Pipelines/new concepts/concept pipeline 1.canvas",
"Research/Trade Pipelines/Existing research.md",
"Research/Trade Pipelines/current trade flow.canvas",
"Research/Implementation/UI ideas.canvas",
"Research/Implementation/Libraries.md",
"Research/Implementation/CLI demonstrator architecture/demonstrator architecture.canvas",
"Research/Implementation/CLI demonstrator architecture",
"Research/Trade Pipelines/new concepts/concept locking script 1.canvas",
"Research/Trade Pipelines/current trade flow.canvas",
"Research/Trade Pipelines/new concepts/Untitled.md",
"Research/Bitcoin fundamentals/Taproot output structure.canvas",
"Research/Bitcoin fundamentals/Spending Taproot UTXOs.md",
"Research/Trade Pipelines/Existing research.md",
"Research/Bitcoin fundamentals/Knowledge sources.md",
"Research/Implementation/Libraries.md"
"Research/Bitcoin fundamentals/Knowledge sources.md"
]
}

View File

@ -1,14 +1,14 @@
{
"nodes":[
{"id":"deac0e8159d44e7f","x":300,"y":-170,"width":250,"height":80,"type":"text","text":"Trading only logic"},
{"id":"fa909bd36f010298","x":-400,"y":-600,"width":250,"height":60,"type":"text","text":"CLI input parsing"},
{"id":"66a07a00114aaee3","x":-1060,"y":-160,"width":250,"height":60,"type":"text","text":"Coordination only logic"},
{"id":"190c13d27acfe062","x":-740,"y":-160,"width":220,"height":60,"color":"2","type":"text","text":"Coordinator module"},
{"id":"3090e35b6908a516","x":0,"y":-160,"width":250,"height":60,"color":"4","type":"text","text":"Trader module"},
{"id":"5d7f46a9378f9d00","x":-380,"y":-235,"width":250,"height":150,"type":"text","text":"Shared logic\nblockchain scanning,\nBDK functions"},
{"id":"a42a47db35e79b8a","x":-380,"y":160,"width":250,"height":200,"type":"text","text":"Communication module\n\nModule to exchange messages between Coordinator and Trader. Possibly http requests over Tor"},
{"id":"71bd23cde637dcfa","x":-455,"y":-780,"width":360,"height":120,"color":"6","type":"text","text":"**How we could split the code into different parts** to keep the trader module as lightweight as possible"},
{"id":"9d377d1901605378","x":-80,"y":-820,"width":280,"height":160,"type":"text","text":"We should prevent hardcoding a specific trade contract as far as possible to make changes easier"}
{"id":"deac0e8159d44e7f","type":"text","text":"Trading only logic","x":300,"y":-170,"width":250,"height":80},
{"id":"fa909bd36f010298","type":"text","text":"CLI input parsing","x":-400,"y":-600,"width":250,"height":60},
{"id":"66a07a00114aaee3","type":"text","text":"Coordination only logic","x":-1060,"y":-160,"width":250,"height":60},
{"id":"190c13d27acfe062","type":"text","text":"Coordinator module","x":-740,"y":-160,"width":220,"height":60,"color":"2"},
{"id":"3090e35b6908a516","type":"text","text":"Trader module","x":0,"y":-160,"width":250,"height":60,"color":"4"},
{"id":"5d7f46a9378f9d00","type":"text","text":"Shared logic\nblockchain scanning,\nBDK functions","x":-380,"y":-235,"width":250,"height":150},
{"id":"a42a47db35e79b8a","type":"text","text":"Communication module\n\nModule to exchange messages between Coordinator and Trader. Possibly http requests over Tor","x":-380,"y":160,"width":250,"height":200},
{"id":"71bd23cde637dcfa","type":"text","text":"**How we could split the code into different parts** to keep the trader module as lightweight as possible","x":-455,"y":-780,"width":360,"height":120,"color":"6"},
{"id":"9d377d1901605378","type":"text","text":"We should prevent hardcoding a specific trade contract as far as possible to make changes easier","x":-80,"y":-820,"width":280,"height":160}
],
"edges":[
{"id":"0a9f63d0d4d620de","fromNode":"3090e35b6908a516","fromSide":"bottom","toNode":"a42a47db35e79b8a","toSide":"top"},

View File

@ -2,14 +2,14 @@
"nodes":[
{"id":"8799ce953b82f380","type":"text","text":"Possible script conditions","x":-418,"y":-830,"width":285,"height":60,"color":"5"},
{"id":"9945f983ca9b2b3c","type":"text","text":"MSTB Escrow locking key\n(External key of taproot contract where trade participants lock their money to)","x":-678,"y":-690,"width":260,"height":160},
{"id":"4f4cec183e99cc39","type":"text","text":"Internal Key\nSigned by Taker, Maker and Coordinator via MuSig2 in case of complete trade\n","x":-1025,"y":-490,"width":287,"height":140},
{"id":"3584cf3a74895521","type":"text","text":"Script A\n\nAND(AND(TIMELOCK(escrow timer), SIG(MAKER)), SIG(COORDINATOR))\n\nTimeout if Taker doesn't respond anymore.\n\nEverything to Maker\n\n`and_v(v:pk(COORDINATOR),and_v(v:pk(MAKER),after(144)))`","x":-401,"y":-490,"width":278,"height":340},
{"id":"4f4cec183e99cc39","type":"text","text":"Internal Key\nSigned by Taker, Maker and Coordinator via MuSig2 in case of complete trade or cooperative cancellation\n","x":-1025,"y":-490,"width":287,"height":185},
{"id":"c7d1840bae375d47","type":"text","text":"Check size, op_checksigadd 2of2 vs just checking 2 sigs. Maybe there is optimization possible.","x":140,"y":-770,"width":280,"height":130,"color":"1"},
{"id":"cd16e3e9eda3242d","type":"text","text":"(Script B)\nCould also be keyspend MuSig2 spend!\n\nMUSIG(SIG(Maker) && SIG(Taker) && SIG(COORDINATOR))\n\n`and_v(v:pk(MAKER),and_v(v:pk(TAKER),pk(COORDINATOR)))`\n\nEscrow + Maker Bond to Maker.\n\nTaker Bond to Taker\n\nNeeds Coordinator signature to prevent Maker and Taker from stealing Fees of coordinator after successful trade.","x":-110,"y":-490,"width":250,"height":560},
{"id":"f5fbfebcea40c384","type":"text","text":"SCRIPT C\n\nAND(SIG(Maker), SIG(COORDINATOR))\n`and_v(v:pk(MAKER),pk(COORDINATOR))`\n\nFees to coordinator.\nRemaining to Maker\n\n","x":227,"y":-490,"width":385,"height":200},
{"id":"341d50e0a5929e24","type":"text","text":"Script D\n\nAND(SIG(TAKER), SIG(COORDINATOR))\n`and_v(v:pk(TAKER),pk(COORDINATOR))`\n\nFees to coordinator.\nRemaining to Taker.","x":640,"y":-490,"width":447,"height":200},
{"id":"1ae1e95c01b93a8d","type":"text","text":"Script E\nAND(TIMELOCK(**Very** long timelock) & SIG(Maker))\n\n`and_v(v:pk(MAKER),after(12228))`\n\neverything to Maker\n\nbackup in case coordinator and Taker is gone.\nTimelock has to be longer than maximum escrow period. Timelock needs to be very long to incentivise cosigning with coordinator in Script C to get Fees to coordinator.\n\nAlso as protection against extortion trough Coordinator (aka. hey i help you in your dipute but it will cost 90% fees)","x":-418,"y":120,"width":285,"height":580},
{"id":"38bc9592ec0c29e2","type":"text","text":"SCRIPT F\nAND(TIMELOCK(2048), AND(SIG(TAKER), SIG(MAKER)))\n`and_v(and_v(v:pk(MAKER),v:pk(TAKER)),after(2048))`\n\nCooperative close without coordinator, in case coordinator vanishes or doesn't cosign.\n\nCould be used to prevent paying fees to coordinator after successful trade but both maker and taker would have to cooperate and wait at least some time.\n\nIf coordinator is offline this would need a direct communication layer between maker and taker to create the transaction, realistic? \n\n","x":-91,"y":120,"width":250,"height":720}
{"id":"38bc9592ec0c29e2","type":"text","text":"SCRIPT F\nAND(TIMELOCK(2048), AND(SIG(TAKER), SIG(MAKER)))\n`and_v(and_v(v:pk(MAKER),v:pk(TAKER)),after(2048))`\n\nCooperative close without coordinator, in case coordinator vanishes or doesn't cosign.\n\nCould be used to prevent paying fees to coordinator after successful trade but both maker and taker would have to cooperate and wait at least some time.\n\nIf coordinator is offline this would need a direct communication layer between maker and taker to create the transaction, realistic? \n\n","x":-91,"y":120,"width":250,"height":720},
{"id":"1ae1e95c01b93a8d","type":"text","text":"Script E\nAND(TIMELOCK(**Very** long timelock) & SIG(Maker))\n\n`and_v(v:pk(MAKER),after(12228))`\n\neverything to Maker\n\nbackup in case coordinator and Taker is gone.\nTimelock has to be longer than maximum escrow period. Timelock needs to be very long to incentivise cosigning with coordinator in Script C to get Fees to coordinator.\n\nAlso as protection against extortion trough Coordinator (aka. hey i help you in your dipute but it will cost 90% fees)","x":-418,"y":-60,"width":285,"height":580},
{"id":"3584cf3a74895521","type":"text","text":"Script A\n\nAND(AND(TIMELOCK(escrow timer), SIG(MAKER)), SIG(COORDINATOR))\n\nTimeout if Taker doesn't respond anymore.\n\nEverything to Maker\n\n`and_v(v:pk(COORDINATOR),and_v(v:pk(MAKER),after(144)))`","x":-414,"y":-490,"width":278,"height":370}
],
"edges":[
{"id":"28e9d5ed421b6360","fromNode":"4f4cec183e99cc39","fromSide":"top","toNode":"9945f983ca9b2b3c","toSide":"left"},

View File

@ -3,7 +3,7 @@
{"id":"5b8863761f608702","type":"text","text":"Just going to write some stuff down here while thinking about it. **Don't expect it to make sense yet!**","x":-415,"y":-360,"width":460,"height":80,"color":"1"},
{"id":"8b7862709255b800","type":"text","text":"\n***MSTB*** (Maker seller taker buyer)","x":-345,"y":-440,"width":320,"height":60,"color":"3"},
{"id":"428c2dc0767db819","type":"text","text":"semi trusted - coordinator could steal/burn bond - but low risk as bonds are small and reputation would be damaged. Also no control on full trade amount.","x":-402,"y":-260,"width":434,"height":118,"color":"5"},
{"id":"93c73227c82f1a81","type":"text","text":"**Coordinator**\n\nwatches Mempool and Chain, could publish the bond TX. Essentially just to prevent orderbook spam / for skin in the game.\n\n*SIGHASH_ALL | ANYONECANPAY* could make it possible for the coordinator to add inputs up to the height of the bond to push the TX fees without losing capital itself. \nAlso out of band mining would cause a cost for the Maker so there is always a price to being unreliable. \n\nThe Maker could be required to use Inputs at least the value of the trade amount to proof that he owns enough sats to fulfill the trade. Maybe lock the time to invalidate the bond after a certain amount of time.","x":80,"y":-118,"width":500,"height":388},
{"id":"93c73227c82f1a81","type":"text","text":"**Coordinator**\n\nwatches Mempool and Chain, could publish the bond TX. Essentially just to prevent orderbook spam / for skin in the game.\n\n*SIGHASH_ALL | ANYONECANPAY* could make it possible for the coordinator to add inputs up to the height of the bond to push the TX fees without losing capital itself. \nAlso out of band mining would cause a cost for the Maker so there is always a price to being unreliable. \n\nThe Maker could be required to use Inputs at least the value of the trade amount to proof that he owns enough sats to fulfill the trade. Maybe lock the time to invalidate the bond after a certain amount of time.","x":80,"y":-118,"width":500,"height":418},
{"id":"dba9c662192cf5bb","type":"text","text":"**Maker**","x":-600,"y":47,"width":125,"height":58},
{"id":"4a633210842ee3c0","type":"text","text":"Taker","x":-665,"y":410,"width":250,"height":60},
{"id":"f461d9afa4298d14","type":"text","text":"Coordinator","x":135,"y":410,"width":250,"height":60},