mirror of
https://github.com/RoboSats/taptrade-core.git
synced 2025-07-19 09:13:39 +00:00
seperate script and trading flow
This commit is contained in:
18
docs/TapTrade_obs/.obsidian/workspace.json
vendored
18
docs/TapTrade_obs/.obsidian/workspace.json
vendored
@ -13,11 +13,11 @@
|
||||
"state": {
|
||||
"type": "canvas",
|
||||
"state": {
|
||||
"file": "Research/Trade Pipelines/current trade flow.canvas",
|
||||
"file": "Research/Trade Pipelines/new concepts/concept pipeline 1.canvas",
|
||||
"viewState": {
|
||||
"x": 691.5201009303707,
|
||||
"y": 2353.5880104568555,
|
||||
"zoom": -0.048799810246148365
|
||||
"x": 200.29145596293188,
|
||||
"y": 1110.762218345142,
|
||||
"zoom": -0.5681202822884297
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -88,7 +88,7 @@
|
||||
"state": {
|
||||
"type": "backlink",
|
||||
"state": {
|
||||
"file": "Research/Trade Pipelines/current trade flow.canvas",
|
||||
"file": "Research/Trade Pipelines/new concepts/concept pipeline 1.canvas",
|
||||
"collapseAll": false,
|
||||
"extraContext": false,
|
||||
"sortOrder": "alphabetical",
|
||||
@ -105,7 +105,7 @@
|
||||
"state": {
|
||||
"type": "outgoing-link",
|
||||
"state": {
|
||||
"file": "Research/Trade Pipelines/current trade flow.canvas",
|
||||
"file": "Research/Trade Pipelines/new concepts/concept pipeline 1.canvas",
|
||||
"linksCollapsed": false,
|
||||
"unlinkedCollapsed": true
|
||||
}
|
||||
@ -128,7 +128,7 @@
|
||||
"state": {
|
||||
"type": "outline",
|
||||
"state": {
|
||||
"file": "Research/Trade Pipelines/current trade flow.canvas"
|
||||
"file": "Research/Trade Pipelines/new concepts/concept pipeline 1.canvas"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -151,8 +151,10 @@
|
||||
},
|
||||
"active": "bdb9fd88a01a8909",
|
||||
"lastOpenFiles": [
|
||||
"Research/Trade Pipelines/new concepts/random pipeline 1 tbd.canvas",
|
||||
"Research/Trade Pipelines/current trade flow.canvas",
|
||||
"Research/Trade Pipelines/new concepts/concept locking script 1.canvas",
|
||||
"Research/Trade Pipelines/new concepts/concept pipeline 1.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",
|
||||
|
@ -56,18 +56,7 @@
|
||||
{"id":"a2878365b55bb0dd","type":"text","text":"Taker | **selling sats**","x":2823,"y":-310,"width":250,"height":50},
|
||||
{"id":"ae0873e7f893c725","type":"text","text":"***Protocol B***\n***MBTS*** (Maker buyer taker seller)\n\nAdapted a bit to onchain possibilities (no time limitations with onchain, so payout address can be submitted upfront/Escrow can be locked with Bond)","x":2543,"y":-760,"width":405,"height":190,"color":"3"},
|
||||
{"id":"1eb173a56b45f948","type":"text","text":"Taker","x":1625,"y":273,"width":110,"height":60,"color":"4"},
|
||||
{"id":"826f1b6a518c2a10","type":"text","text":"","x":-2000,"y":1360,"width":250,"height":60},
|
||||
{"id":"91eb76b688aa2fa3","type":"text","text":"","x":5040,"y":1360,"width":250,"height":60},
|
||||
{"id":"9dde114e072e9785","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":133,"y":1860,"width":250,"height":560},
|
||||
{"id":"5f8cc10757f876b2","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":-180,"y":1860,"width":278,"height":320},
|
||||
{"id":"9652d176ca6f0655","type":"text","text":"Possible script conditions","x":-197,"y":1520,"width":285,"height":60,"color":"5"},
|
||||
{"id":"513e29d4bb6616cd","type":"text","text":"MSTB Escrow locking key\n(External key of taproot contract where trade participants lock their money to)","x":-457,"y":1660,"width":260,"height":160},
|
||||
{"id":"7a1cd17e5924c237","type":"text","text":"Internal Key\nSigned by Taker, Maker and Coordinator via MuSig2 in case of complete trade\n","x":-804,"y":1860,"width":287,"height":140},
|
||||
{"id":"ef48e8e586afd9c9","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":-183,"y":2220,"width":285,"height":740},
|
||||
{"id":"91fe39ac62950c10","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":400,"y":1860,"width":385,"height":200},
|
||||
{"id":"85053658a29a3bb7","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":800,"y":1860,"width":447,"height":200},
|
||||
{"id":"15325febea2b856b","x":133,"y":2460,"width":250,"height":580,"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\n"},
|
||||
{"id":"c82c619d813331ac","x":-220,"y":3040,"width":280,"height":100,"color":"1","type":"text","text":"Check size, op_checksigadd 2of2 vs just checking 2 sigs"}
|
||||
{"id":"91eb76b688aa2fa3","type":"text","text":"","x":5040,"y":1360,"width":250,"height":60}
|
||||
],
|
||||
"edges":[
|
||||
{"id":"0452390c8e326418","fromNode":"fe94f3c9a67875b6","fromSide":"bottom","toNode":"9d82ff6bff57a83c","toSide":"top","label":"1. paying/locking Maker bond and Escrow"},
|
||||
@ -131,14 +120,6 @@
|
||||
{"id":"797f33fc3f6591ba","fromNode":"508af0ac065cc414","fromSide":"top","toNode":"f37650cb37821ec1","toSide":"bottom"},
|
||||
{"id":"a1ee13348f08da96","fromNode":"58af737d4b901b93","fromSide":"bottom","toNode":"f37650cb37821ec1","toSide":"top","label":"Fees"},
|
||||
{"id":"ed04b15bb0b41fcc","fromNode":"da056e0d063f396b","fromSide":"top","toNode":"eaabe56112938e2c","toSide":"bottom"},
|
||||
{"id":"10b87549eefddaae","fromNode":"cae35a028b34a2f8","fromSide":"bottom","toNode":"eaabe56112938e2c","toSide":"top","label":"Fees"},
|
||||
{"id":"472a8a46eb9b23ae","fromNode":"91eb76b688aa2fa3","fromSide":"left","toNode":"826f1b6a518c2a10","toSide":"right","label":"Untested/incomplete thoughts below this line"},
|
||||
{"id":"aa8b98f0cfd897fe","fromNode":"7a1cd17e5924c237","fromSide":"top","toNode":"513e29d4bb6616cd","toSide":"left"},
|
||||
{"id":"316934cbb245da9e","fromNode":"ef48e8e586afd9c9","fromSide":"top","toNode":"513e29d4bb6616cd","toSide":"right"},
|
||||
{"id":"6262986d7025c285","fromNode":"9dde114e072e9785","fromSide":"top","toNode":"513e29d4bb6616cd","toSide":"right"},
|
||||
{"id":"3326fc6ba63a6040","fromNode":"5f8cc10757f876b2","fromSide":"top","toNode":"513e29d4bb6616cd","toSide":"right"},
|
||||
{"id":"730bcb6bb8477259","fromNode":"91fe39ac62950c10","fromSide":"top","toNode":"513e29d4bb6616cd","toSide":"right"},
|
||||
{"id":"fb50e1e7bbd04c9a","fromNode":"85053658a29a3bb7","fromSide":"top","toNode":"513e29d4bb6616cd","toSide":"right"},
|
||||
{"id":"d3e522d4c66fd50d","fromNode":"15325febea2b856b","fromSide":"top","toNode":"513e29d4bb6616cd","toSide":"right"}
|
||||
{"id":"10b87549eefddaae","fromNode":"cae35a028b34a2f8","fromSide":"bottom","toNode":"eaabe56112938e2c","toSide":"top","label":"Fees"}
|
||||
]
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
{
|
||||
"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":"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":-88,"y":-490,"width":250,"height":560},
|
||||
{"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":-404,"y":-130,"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":-88,"y":110,"width":250,"height":720},
|
||||
{"id":"c7d1840bae375d47","type":"text","text":"Check size, op_checksigadd 2of2 vs just checking 2 sigs. Maybe there is optimization possible.","x":-399,"y":550,"width":280,"height":130,"color":"1"},
|
||||
{"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":179,"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":579,"y":-490,"width":447,"height":200}
|
||||
],
|
||||
"edges":[
|
||||
{"id":"28e9d5ed421b6360","fromNode":"4f4cec183e99cc39","fromSide":"top","toNode":"9945f983ca9b2b3c","toSide":"left"},
|
||||
{"id":"5781d1d6de00a686","fromNode":"1ae1e95c01b93a8d","fromSide":"top","toNode":"9945f983ca9b2b3c","toSide":"right"},
|
||||
{"id":"fdff063bc6a5a29b","fromNode":"cd16e3e9eda3242d","fromSide":"top","toNode":"9945f983ca9b2b3c","toSide":"right"},
|
||||
{"id":"55dae8da91322d9d","fromNode":"3584cf3a74895521","fromSide":"top","toNode":"9945f983ca9b2b3c","toSide":"right"},
|
||||
{"id":"bd533537290174c1","fromNode":"f5fbfebcea40c384","fromSide":"top","toNode":"9945f983ca9b2b3c","toSide":"right"},
|
||||
{"id":"f70d21b71f594663","fromNode":"341d50e0a5929e24","fromSide":"top","toNode":"9945f983ca9b2b3c","toSide":"right"},
|
||||
{"id":"7507fec708260d89","fromNode":"38bc9592ec0c29e2","fromSide":"top","toNode":"9945f983ca9b2b3c","toSide":"right"}
|
||||
]
|
||||
}
|
@ -19,8 +19,8 @@
|
||||
{"id":"880c77a2d23f2cec","type":"text","text":"+signed TX\n\n-> Bond to coordinator\n -> change to self\n -> SIGHASH_ALL | ANYONECANPAY\n\n+MuSig2 public nonce\n+taproot public key (for agg. internal key)","x":-390,"y":-39,"width":390,"height":230},
|
||||
{"id":"e3b8669b30d1c80e","type":"text","text":"+ signed psbt\n+ signed punishment TX in case the taker tries to spend the input somewhere else before the maker signs, the coordinator can claim or burn the bond (same like the maker bond). In case of out of band mining the maker would not lose money and the taker has a cost associated to doing this act","x":-610,"y":800,"width":815,"height":120},
|
||||
{"id":"483fbdbcc5ea8501","type":"text","text":"I think there could be an advanced mode / external wallet mode where this could be done directly from an external Wallet e.g. Hardware wallet with Sparrow. But it would require lot of copy pasting (signed txs, psbts, addresses). Also there is secret state needed to be saved for MuSig2, this could be downloaded as file or stored encrypted on the coordinator. \n\nFor easy use there would need to be a wallet in RoboSats (BDK) but UI wise this would be either a challenge or a privacy reduction (if you use the same wallet but different Robot). It's also possible to limit the Wallet to one robot so the user must withdraw the sats after the trade (can't import wallet into robosats, only export). I think wallet could also be stored encrypted on coordinator or exported as file/seed.","x":80,"y":-480,"width":660,"height":338},
|
||||
{"id":"7645baf985ca338b","x":420,"y":1180,"width":400,"height":400,"type":"file","file":"Research/Trade Pipelines/current trade flow.canvas"},
|
||||
{"id":"51e650a981068490","x":420,"y":1120,"width":400,"height":60,"color":"2","type":"text","text":"see contract definition at the bottom here"}
|
||||
{"id":"51e650a981068490","type":"text","text":"see contract definition","x":420,"y":1120,"width":400,"height":60,"color":"2"},
|
||||
{"id":"0d1d6b982cbde6e2","x":420,"y":1180,"width":400,"height":400,"type":"file","file":"Research/Trade Pipelines/new concepts/concept locking script 1.canvas"}
|
||||
],
|
||||
"edges":[
|
||||
{"id":"77d1ff9130716b53","fromNode":"dba9c662192cf5bb","fromSide":"right","toNode":"93c73227c82f1a81","toSide":"left"},
|
Reference in New Issue
Block a user