push existing docs to research branch

This commit is contained in:
fbock
2024-05-09 10:13:14 +02:00
parent 6f4ff9ee1c
commit bb20c92c7f
25 changed files with 598 additions and 1 deletions

View File

@ -1,7 +1,7 @@
# taptrade-core
### Research
Find the current research as [Obsidian](https://obsidian.md/) formatted documents under /docs/TapTrade_obs in branch research
Find the current research as [Obsidian](https://obsidian.md/) formatted documents under /docs/TapTrade_obs.
### Implementation
TBD

BIN
docs/TapTrade_obs/.DS_Store vendored Normal file

Binary file not shown.

4
docs/TapTrade_obs/.obsidian/app.json vendored Normal file
View File

@ -0,0 +1,4 @@
{
"promptDelete": false,
"alwaysUpdateLinks": true
}

View File

@ -0,0 +1,3 @@
{
"accentColor": ""
}

View File

@ -0,0 +1,9 @@
{
"items": [
{
"type": "file",
"ctime": 1715166915718,
"path": "Project Timeline.md"
}
]
}

View File

@ -0,0 +1,30 @@
{
"file-explorer": true,
"global-search": true,
"switcher": true,
"graph": true,
"backlink": true,
"canvas": true,
"outgoing-link": true,
"tag-pane": true,
"properties": false,
"page-preview": true,
"daily-notes": true,
"templates": true,
"note-composer": true,
"command-palette": true,
"slash-command": false,
"editor-status": true,
"bookmarks": true,
"markdown-importer": false,
"zk-prefixer": false,
"random-note": false,
"outline": true,
"word-count": true,
"slides": false,
"audio-recorder": false,
"workspaces": false,
"file-recovery": true,
"publish": false,
"sync": false
}

View File

@ -0,0 +1,20 @@
[
"file-explorer",
"global-search",
"switcher",
"graph",
"backlink",
"canvas",
"outgoing-link",
"tag-pane",
"page-preview",
"daily-notes",
"templates",
"note-composer",
"command-palette",
"editor-status",
"bookmarks",
"outline",
"word-count",
"file-recovery"
]

22
docs/TapTrade_obs/.obsidian/graph.json vendored Normal file
View File

@ -0,0 +1,22 @@
{
"collapse-filter": true,
"search": "",
"showTags": false,
"showAttachments": false,
"hideUnresolved": false,
"showOrphans": true,
"collapse-color-groups": true,
"colorGroups": [],
"collapse-display": true,
"showArrow": false,
"textFadeMultiplier": 0,
"nodeSizeMultiplier": 1,
"lineSizeMultiplier": 1,
"collapse-forces": true,
"centerStrength": 0.518713248970312,
"repelStrength": 10,
"linkStrength": 1,
"linkDistance": 250,
"scale": 5.514946953973566,
"close": true
}

View File

@ -0,0 +1,183 @@
{
"main": {
"id": "80a386d23cb49933",
"type": "split",
"children": [
{
"id": "83f3e4f8fc8a23bd",
"type": "tabs",
"children": [
{
"id": "a6f226df420e6a1a",
"type": "leaf",
"state": {
"type": "canvas",
"state": {
"file": "Research/Bitcoin fundamentals/Signature and Flags.canvas",
"viewState": {
"x": 1337.3998874565568,
"y": -91.84205258234509,
"zoom": -0.28644350006291147
}
}
}
}
]
}
],
"direction": "vertical"
},
"left": {
"id": "e6a26e5c5b019a1e",
"type": "split",
"children": [
{
"id": "3f3159116396a08c",
"type": "tabs",
"children": [
{
"id": "35cfcb845e434840",
"type": "leaf",
"state": {
"type": "file-explorer",
"state": {
"sortOrder": "alphabetical"
}
}
},
{
"id": "0e07985fb8283f1e",
"type": "leaf",
"state": {
"type": "search",
"state": {
"query": "",
"matchingCase": false,
"explainSearch": false,
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical"
}
}
},
{
"id": "738df028c16ab1b9",
"type": "leaf",
"state": {
"type": "bookmarks",
"state": {}
}
}
]
}
],
"direction": "horizontal",
"width": 300
},
"right": {
"id": "5f13d93e126071cf",
"type": "split",
"children": [
{
"id": "985598abe7b3b823",
"type": "tabs",
"children": [
{
"id": "dc77dc1e126c6c92",
"type": "leaf",
"state": {
"type": "backlink",
"state": {
"file": "Research/Bitcoin fundamentals/Signature and Flags.canvas",
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
"showSearch": false,
"searchQuery": "",
"backlinkCollapsed": false,
"unlinkedCollapsed": true
}
}
},
{
"id": "1cfcab3d82b07a15",
"type": "leaf",
"state": {
"type": "outgoing-link",
"state": {
"file": "Research/Bitcoin fundamentals/Signature and Flags.canvas",
"linksCollapsed": false,
"unlinkedCollapsed": true
}
}
},
{
"id": "d24ff84f08dd4825",
"type": "leaf",
"state": {
"type": "tag",
"state": {
"sortOrder": "frequency",
"useHierarchy": true
}
}
},
{
"id": "623d6cb84168c727",
"type": "leaf",
"state": {
"type": "outline",
"state": {
"file": "Research/Bitcoin fundamentals/Signature and Flags.canvas"
}
}
}
]
}
],
"direction": "horizontal",
"width": 300,
"collapsed": true
},
"left-ribbon": {
"hiddenItems": {
"switcher:Open quick switcher": false,
"graph:Open graph view": false,
"daily-notes:Open today's daily note": false,
"canvas:Create new canvas": false,
"templates:Insert template": false,
"command-palette:Open command palette": false
}
},
"active": "a6f226df420e6a1a",
"lastOpenFiles": [
"Research/Bitcoin fundamentals/Knowledge sources.md",
"Research/Bitcoin fundamentals/Signature and Flags.canvas",
"assets/anyonecanpay.webp",
"Research/Bitcoin fundamentals/Spending Taproot UTXOs.md",
"Research/Trade Pipelines/current trade flow.canvas",
"Research/Bitcoin fundamentals/Taproot output structure.canvas",
"Research/Implementation/UI ideas.canvas",
"Research/Implementation/Libraries.md",
"assets/sighash_flags.webp",
"assets/DER_encoded_signature.webp",
"assets",
"assets/onchain_lightning_switch_screenshot.png",
"assets/advanced_trade_mode_switch.png",
"Research/Implementation/Untitled.md",
"Project Timeline.md",
"Research/Trade Pipelines/Existing research.md",
"2024-05-08.md",
"Obsidian How-To.md",
"Research/Bitcoin fundamentals/Miniscript.md",
"Research/Bitcoin fundamentals",
"Research/Trade Pipelines",
"Research/Implementation",
"Research/Untitled.md",
"Research/Bitcoin&Taproot",
"Research",
"Welcome.md",
"note.md",
"Ctrl+N.md"
]
}

View File

@ -0,0 +1,6 @@
Obsidian seems like a practical tool to organize and collect our research in a clean way.
To get started you can find a introduction here:
https://help.obsidian.md/Getting+started/Create+your+first+note
We can sync the vault with Git (just push/pull changes like code).

View File

@ -0,0 +1,58 @@
### Week 0 <mark>..May 07</mark> - *Review Period*
- Studying Schnorr signatures in depth (Mastering Bitcoin, online resources)
### Week 1 <mark>May 08..May 15</mark> - *Kick-Off and Onboarding*
- Knowledge exchange with mentors (what research has already been done?, Is there anything existing to build on already?, how can they support me?, exchanging important resources)
- Exchanging ideas with the mentors on how to tackle the implementation, what to consider (e.g. RoboSats specific details)
### Week 2 <mark>May 16..May 22</mark> - *start of project phase 1*
Research:
- Reading BIPs (86, 114, 340, 341, 342)
- Learning Miniscript
- Researching MuSig2
### Week 3-4 <mark>May 23..June 05</mark>
- Researching P2P pipelines/contracts (existing ones, iterating on new ones)
- Exchange with RoboSats devs and mentors on researched pipelines 
### Week 5-6 <mark>June 06..June 19</mark>
- Construction of the contract in Miniscrip, clear definition and documentation
### Week 7-8 <mark>June 06..July 01</mark>
- Beginning with Rust implementation of Pipeline
- First simple functions to verify and test defined outputs
## <u>First evaluation [July 01..July 05]</u>
- time buffer, otherwise continuing implementation
### Week 9-10 <mark>July 04..July 17</mark>
- Implementation of functional CLI tool (client and coordinator)
- Reviewing pipeline again, new insights?
### Week 11-12 <mark>July 18..July 31</mark>
- Implementation of RoboSats specific functionality to prepare for integration
- Documentation
- Thorough testing (Function tests, Signet tests)
### Week 13-14 <mark>August 01..August 15</mark> - *finishing*
If sufficient time is left:
- Compile to WASM binary, bundle into NPM package
- Experiment with integration in RoboSats client and coordinator
* Discuss about UI implementation and userspace documentation
- Finish up code and documentation. 
- Review with mentors
- Submission
🎉🤖🎉🤖🎉🤖🎉🤖🎉
⛓️⛓️⛓️⛓️⛓️⛓️⛓️⛓️⛓️

BIN
docs/TapTrade_obs/Research/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,58 @@
### <u>Relevant BIPs</u>
Understanding the following BIPs is relevant for the project.
#### BIP documents
* [BIP 340 - Schnorr Signatures for secp256k1](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki)
* [BIP 341 - SegWit version 1 spending rules](https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki)
* [BIP 342 - Validation of Taproot Scripts](https://github.com/bitcoin/bips/blob/master/bip-0342.mediawiki)
* [BIP 114(Rejected but interesting) - Merkelized Abstract Syntax Tree](https://github.com/bitcoin/bips/blob/master/bip-0114.mediawiki)
#### BIP Readtrough videos
* [BIP 340 Readtrough - Jimmy Song](https://www.youtube.com/watch?v=rVsNFMzQUck)
* [BIP 341 Readtrough - Jimmy Song](https://www.youtube.com/watch?v=pkS9aorpxNc)
* [BIP 342 Readtrough - Jimmy Song](https://www.youtube.com/watch?v=fAEcXh6nZ9U)
### <u>Taproot</u>
![[Taproot output structure.canvas]]
#### [[Spending Taproot UTXOs]]
#### Videos
* [Introduction to Taproot - Nicolas Dorier - short video](https://www.youtube.com/watch?v=I7HsXKgtD2I)
* [Very good, practical introduction to coding taproot Transactions - Bitdevs LA](https://www.youtube.com/watch?v=E-HxgNkPB-8)
### <u>Descriptors/Miniscript</u>
We can use Descriptors/Miniscript to precisely and human readable describe the Transaction outputs of the escrow transaction pipeline. This improves readability and portability of the pipeline.
#### Videos
* [Using BDK and Wallet descriptors for Taproot - Video - Bitdevs LA](https://www.youtube.com/watch?v=wsQIZRY2BD0)
* [Introduction to Miniscript - Port of Bitcoin](https://www.youtube.com/watch?v=uNZpfHEtP4U)
#### Websites
* [Miniscript introduction/compiler/specification](https://bitcoin.sipa.be/miniscript/)
### <u>Signature/Pubkey aggregation</u>
To combine multiple parties pubkeys to a single combined Taproot pubkey and to create a aggregated signature with all participants MuSig2 is relevant.
* [Paper, very (probably too) deep](https://eprint.iacr.org/2020/1261)
#### Videos
* [MuSig2 in Taproot - Nicolas Dorier - higher level explanation](https://www.youtube.com/watch?v=hrUyGW91JBc)
* [MuSig2: Simple Two-Round Schnorr Multi-Signatures - very detailed, more crypto focused explanation](https://www.youtube.com/watch?v=Dzqj236cVHk)
### <u>Sighashes</u>
Maybe sighashes could be a useful tool?
Need to do research on Sighashes in Schnorr signatures (taproot).
#### Canvas
![[Signature and Flags.canvas]]
#### Blog articles
[Signature Hash Flags Medium Article - enigbe ochekliye](https://enigbe.medium.com/signature-hash-flags-f059d035ddd0)

View File

@ -0,0 +1,27 @@
{
"nodes":[
{"id":"d4896274d8828004","type":"text","text":"DER encoded Signature\n(as used in Bitcoin)","x":80,"y":-140,"width":250,"height":60,"color":"6"},
{"id":"64e37547f27f3e55","type":"file","file":"assets/DER_encoded_signature.webp","x":-177,"y":-20,"width":763,"height":141},
{"id":"3fc5cd05ae124cba","type":"text","text":"1. A starting byte of hex value **[0x30]**\n2. Length of the signature sequence **[0x44]** or **[0x45]**\n3. **_r_**-marker byte of hex value **0x02**\n4. Length of **_r_** **[0x21]**|| Big-endian representation of **_r_**\n5. **_s_**-marker byte of hex value **0x02**\n6. Length of **_s_** **[0x20]**|| Big-endian representation of **_s_**\n7. <mark>1-byte SIGHASH suffix</mark>","x":-35,"y":140,"width":480,"height":230},
{"id":"64c991bc18fbc277","type":"file","file":"assets/sighash_flags.webp","x":640,"y":-200,"width":400,"height":269},
{"id":"6a893127784fae4f","type":"text","text":"1. Creating a copy of the transaction,\n2. Empty **_script_sigs_** for each input and replace with the **_script_pubkey_** they reference. This is done because the “signature is part of the script_sig and … cant sign itself” (Song, 2019, p. 132)\n3. Make sure that **no** other fields are set to empty before the transaction is serialized (**Tx_ser**).\n4. The flag 0x01 is added to the end of the serialized transaction and passed through a hashing function.\n5. This message is then signed by the signing algorithm to generate the signature.","x":1580,"y":-560,"width":660,"height":304,"color":"5"},
{"id":"8526cdb3e9883674","type":"text","text":"For **SIGHASH** **ALL**, given a transaction Tx, the signature applies to all of Txs inputs and all its outputs\n\nThe transaction is rendered invalid if any of its details are changed because the signature will change too and be invalid.","x":1100,"y":-356,"width":391,"height":200,"color":"5"},
{"id":"39bb6307899c5d87","type":"text","text":"1. Create a copy of the transaction\n2. Empty each script_sig for all inputs and replace with the script_pubkey they reference\n3. Empty out all output fields\n4. Serialize the transaction\n5. Append 0x02 to **Tx_ser**, hash, and then sign","x":1620,"y":-169,"width":660,"height":207,"color":"1"},
{"id":"0e6dda772fa0f997","type":"text","text":"For **SIGHASH** **NONE**, the signature applies to all of Txs inputs but to none of the outputs.","x":1100,"y":-104,"width":400,"height":78,"color":"1"},
{"id":"4783ea786041b3c4","type":"text","text":"For **SIGHASH** **SINGLE**, all the inputs of the given transaction Tx are signed and one output that has the same index of one of the inputs being signed. This is essentially “authorizing all other inputs to go with a specific output” (Song, 2019, p. 133).","x":1100,"y":38,"width":400,"height":200,"color":"4"},
{"id":"17953abf6e32fa3d","type":"text","text":"1. Create a copy of the transaction\n2. Empty script_sigs for each input and replace with the script_pubkey they reference\n3. Empty out all output fields bar the specific output\n4. Serialize the transaction\n5. Append 0x03 to **Tx_ser**, hash, and then sign","x":1620,"y":121,"width":660,"height":199,"color":"4"},
{"id":"ee8fd83cff1ef0ba","type":"text","text":"An **ANYONECANPAY** modifier flag exists that can be added to the aforementioned flags that apply to a **single** input in a transaction. Rosenbaum (2019) considers the ANYONECANPAY modifier flag as a way to commit to inputs only, by setting or not setting it, and the existing SIGHASH types (ALL, NONE, SINGLE) as a way to commit to outputs only.","x":1018,"y":-662,"width":473,"height":222,"color":"2"},
{"id":"b93d1dd0b0feb448","type":"file","file":"assets/anyonecanpay.webp","x":1055,"y":-1000,"width":400,"height":297}
],
"edges":[
{"id":"1c3a1e2cc3bf2afa","fromNode":"64e37547f27f3e55","fromSide":"right","toNode":"64c991bc18fbc277","toSide":"left"},
{"id":"1f578d9bd4944f24","fromNode":"64c991bc18fbc277","fromSide":"right","toNode":"8526cdb3e9883674","toSide":"left"},
{"id":"45d8d17cc4baa1af","fromNode":"8526cdb3e9883674","fromSide":"right","toNode":"6a893127784fae4f","toSide":"left"},
{"id":"da10b70b9de850a5","fromNode":"64c991bc18fbc277","fromSide":"right","toNode":"0e6dda772fa0f997","toSide":"left"},
{"id":"3f4068b0a4c19f71","fromNode":"0e6dda772fa0f997","fromSide":"right","toNode":"39bb6307899c5d87","toSide":"left"},
{"id":"a9eb41d7c10ebe6d","fromNode":"64c991bc18fbc277","fromSide":"right","toNode":"4783ea786041b3c4","toSide":"left"},
{"id":"df5f1dd7d4be7955","fromNode":"4783ea786041b3c4","fromSide":"right","toNode":"17953abf6e32fa3d","toSide":"left"},
{"id":"ffddd1b2b5019de2","fromNode":"64c991bc18fbc277","fromSide":"top","toNode":"ee8fd83cff1ef0ba","toSide":"left"},
{"id":"4f220c13ebdf58ab","fromNode":"ee8fd83cff1ef0ba","fromSide":"top","toNode":"b93d1dd0b0feb448","toSide":"bottom"}
]
}

View File

@ -0,0 +1,34 @@
How to construct a Transaction spending a P2TR input.
### <u>Key Path spending</u>
The Key Path spend is the more ressource efficient and private way to spend the output.
If the Internal Key was created by a single party, the creator can just generate a Signature. If the internal Key has been generated from multiple parties public keys, for example via MuSig2, these parties have to collaboratively generate a valid Signature.
1. Create Schnorr signature
* SIGHASH_DEFAULT
2. Put signature in input Witness
### <u>Script Path spending</u>
In case spending condition from the MAST is necessary to spend the output (e.g. Escrow, inactive counterparty) the Transaction input witness has to be constructed of the following elements:
```
witness = [script inputs, script, control block]
```
##### Script inputs
All X script inputs will be the input to the script satisfying it.
##### Script
The spending script contained in the MAST Leaf to be unlocked. Always the penultimate element in the witness.
##### Control Block
Always the last element in the Witness. Proves inclusion of the script in the MAST.
```
CB = 192 | parity bit | internal (untweaked) key | sibling hashes (deepest first)
```

View File

@ -0,0 +1,32 @@
{
"nodes":[
{"id":"10b072d0858d8ac5","type":"text","text":"**External (tweaked) key\n(contained in scriptPubKey)**\n\n-> The address money gets sent to and contains the rules on how the sats can be spent again","x":-125,"y":-30,"width":345,"height":170,"color":"5"},
{"id":"bf9b41802a6b414d","type":"text","text":"**scriptPubKey (output script)**\n\nConstructed from:\n* 0x51 (witness version 1)\n* 0x20 (OP_PUSHBYTES 32 bytes)\n* External (tweaked) key (X-Only-Pubkey)","x":-201,"y":-280,"width":497,"height":200},
{"id":"cfbcdba7713b1114","type":"text","text":"**Address**\n\n\n```\nbech32m(\"bc\", 0x01 || External Pubkey)\n```","x":380,"y":-245,"width":420,"height":130},
{"id":"c6ad2069952ebcd2","type":"text","text":"**Internal Key**\n-> Keypath spend\n\nCan be a single pubkey or a pubkey generated of X other Pubkeys using MuSig2.\nCan be satisfied by a Signature that can also be aggregated by multiple, cooperating parties.\n\nBest case in trade protocol, best privacy, lowest fees.\n","x":-720,"y":592,"width":405,"height":300,"color":"4"},
{"id":"d8a38ee5869c89bd","type":"text","text":"*Key Tweaking*\n\n```\ntweak = hashTapTweak(merkle root || internal key)\n```","x":-221,"y":220,"width":537,"height":120},
{"id":"be201757794f0169","type":"text","text":"**Script C** (Leaf)","x":397,"y":992,"width":250,"height":60},
{"id":"bfafd7060eb2cd4f","type":"text","text":"**Branch**","x":-23,"y":962,"width":250,"height":60,"color":"2"},
{"id":"75d558414fae1d4d","type":"text","text":"**Script A** (Leaf)\n\nLeaf Preimage:\n```\nVersion (0x00) 192 | varint(len) | script\n```","x":-273,"y":1312,"width":500,"height":160},
{"id":"e117a08ba66ebd87","type":"text","text":"**Script B** (Leaf)","x":437,"y":1412,"width":250,"height":60},
{"id":"fb1a9926680eb290","type":"text","text":"sort hashes ascending\n```\nbranch preimage = hash(preimage A) | hash(preimage B)\n```","x":-143,"y":1102,"width":560,"height":119},
{"id":"bf9d4d1c9dfc5207","type":"text","text":"sort hashes ascending, concatenate","x":48,"y":802,"width":349,"height":60},
{"id":"6ce4d3be03adcf22","type":"text","text":"May contain errors!","x":522,"y":742,"width":250,"height":60,"color":"1"},
{"id":"e330bfc77e306001","type":"text","text":"**Merkle Root**\n-> scriptpath spending\n\nReferences all other possible spending conditions","x":-23,"y":590,"width":440,"height":104,"color":"2"},
{"id":"76dda8d665b34f5a","type":"file","file":"Research/Bitcoin fundamentals/Spending Taproot UTXOs.md","x":1160,"y":-493,"width":740,"height":873,"color":"2"}
],
"edges":[
{"id":"ecb55b0a6e548072","fromNode":"10b072d0858d8ac5","fromSide":"top","toNode":"bf9b41802a6b414d","toSide":"bottom"},
{"id":"fe14112fc012532a","fromNode":"10b072d0858d8ac5","fromSide":"right","toNode":"cfbcdba7713b1114","toSide":"bottom"},
{"id":"d717e74a5cf73149","fromNode":"e330bfc77e306001","fromSide":"top","toNode":"d8a38ee5869c89bd","toSide":"bottom"},
{"id":"2344ea239a7da798","fromNode":"c6ad2069952ebcd2","fromSide":"top","toNode":"d8a38ee5869c89bd","toSide":"bottom"},
{"id":"d436eeac8ab6f44c","fromNode":"d8a38ee5869c89bd","fromSide":"top","toNode":"10b072d0858d8ac5","toSide":"bottom"},
{"id":"ba1b447fc2217c0d","fromNode":"e117a08ba66ebd87","fromSide":"top","toNode":"fb1a9926680eb290","toSide":"bottom","label":"hash"},
{"id":"d990815a06fede7c","fromNode":"75d558414fae1d4d","fromSide":"top","toNode":"fb1a9926680eb290","toSide":"bottom","label":"hash"},
{"id":"f18d9ae74dae3367","fromNode":"fb1a9926680eb290","fromSide":"top","toNode":"bfafd7060eb2cd4f","toSide":"bottom","label":"hash"},
{"id":"9803b39035ce563e","fromNode":"bfafd7060eb2cd4f","fromSide":"top","toNode":"bf9d4d1c9dfc5207","toSide":"bottom"},
{"id":"97746870135262b0","fromNode":"be201757794f0169","fromSide":"top","toNode":"bf9d4d1c9dfc5207","toSide":"bottom","label":"hash"},
{"id":"b63a999a702786c6","fromNode":"bf9d4d1c9dfc5207","fromSide":"top","toNode":"e330bfc77e306001","toSide":"bottom","label":"hash "},
{"id":"607b97aae28c2106","fromNode":"bf9b41802a6b414d","fromSide":"top","toNode":"76dda8d665b34f5a","toSide":"top"}
]
}

View File

@ -0,0 +1,16 @@
## [BDK](https://docs.rs/bdk/latest/bdk/)
A modern, lightweight, descriptor-based wallet library written in Rust.
Higher level, with wallet functionality. Supports Miniscript descriptors.
## [rust-bitcoin crate](https://docs.rs/bitcoin/latest/bitcoin/)
Lower level, lighter library for assembling transactions, generating addresses etc.
## [musig2 crate](https://docs.rs/musig2/latest/musig2/)
Still in beta but could be used by us.
This crate provides a flexible rust implementation of [MuSig2](https://eprint.iacr.org/2020/1261), an optimized digital signature aggregation protocol, on the `secp256k1` elliptic curve.
MuSig2 allows groups of mutually distrusting parties to cooperatively sign data and aggregate their signatures into a single aggregated signature which is indistinguishable from a signature made by a single private key. The group collectively controls an _aggregated public key_ which can only create signatures if everyone in the group cooperates (AKA an N-of-N multisignature scheme). MuSig2 is optimized to support secure signature aggregation with only **two round-trips of network communication.**

View File

@ -0,0 +1,11 @@
{
"nodes":[
{"id":"e8204cb906ddb1b9","type":"file","file":"assets/advanced_trade_mode_switch.png","x":-620,"y":-263,"width":400,"height":235},
{"id":"dc9b77a5f6e0ce12","type":"file","file":"assets/onchain_lightning_switch_screenshot.png","x":-20,"y":-263,"width":400,"height":235},
{"id":"73a35de4989447e9","type":"text","text":"A switch like this could be used ","x":180,"y":-400,"width":300,"height":60}
],
"edges":[
{"id":"cd605372cc750411","fromNode":"e8204cb906ddb1b9","fromSide":"right","toNode":"dc9b77a5f6e0ce12","toSide":"left"},
{"id":"fdd17f73f4b5c94a","fromNode":"73a35de4989447e9","fromSide":"bottom","toNode":"dc9b77a5f6e0ce12","toSide":"top"}
]
}

View File

@ -0,0 +1,22 @@
Collection of existing onchain p2p trade protocols and research.
### <u>RoboSats</u>
##### Onchain deposit with PSBTs
[Github Issue by Jacksper13](https://github.com/RoboSats/robosats/issues/1114)
##### Onchain P2P pipeline as Taproot/MAST contract
[Github Issue by Reckless-Satoshi](https://github.com/RoboSats/robosats/issues/230)
### <u>Bisq</u>
##### Reduce trade protocol to 1 single transaction
[Github Issue by sqrrm](https://github.com/bisq-network/proposals/issues/279)
##### Investigations for a new trade protocol #5430
[Github discussion by chimp1984](https://github.com/bisq-network/bisq/discussions/5430)
##### Current bisq flow as taker
[Wiki](https://docs.bisq.network/getting-started#take-an-offer)
[Anatomy of a Bisq trade - Forum](https://bisq.community/t/anatomy-of-a-bisq-trade/10979/2)

View File

@ -0,0 +1,62 @@
{
"nodes":[
{"id":"fe94f3c9a67875b6","type":"text","text":"Maker | **selling sats**","x":-440,"y":-460,"width":260,"height":60},
{"id":"9d82ff6bff57a83c","type":"text","text":"2.Sell-order in Orderbook","x":-462,"y":-260,"width":305,"height":60},
{"id":"8fa39f8a35b6f963","type":"text","text":"Taker | **buying sats**","x":-60,"y":-250,"width":250,"height":50},
{"id":"4d60bd1ab9f37b0b","type":"text","text":"**Possibility 1**\nTaker sent Fiat | Maker confirms","x":-720,"y":160,"width":300,"height":85,"color":"4"},
{"id":"bc83b23761a4f553","type":"text","text":"**Possibility 2**\nTaker doesn't send fiat (and doesn't claim he did)","x":-359,"y":160,"width":424,"height":85,"color":"2"},
{"id":"b3437bec8e00d656","type":"text","text":"**Possibility 3**\nTaker maybe sent Fiat | Maker doesn't confirm","x":100,"y":160,"width":500,"height":85,"color":"1"},
{"id":"859640fc50ee7149","type":"text","text":"Fiat exchange (Chat)","x":-240,"y":-20,"width":250,"height":60},
{"id":"e94e83cd61e18e1b","type":"text","text":"Taker","x":-1220,"y":400,"width":110,"height":60,"color":"4"},
{"id":"534b2aec29273277","type":"text","text":"Coordinator","x":-1097,"y":333,"width":157,"height":60,"color":"4"},
{"id":"09c6192278d0c20c","type":"text","text":"Maker","x":-1000,"y":430,"width":120,"height":60,"color":"4"},
{"id":"1939841fedec6c0f","type":"text","text":"***Possible Keyspend***","x":-1203,"y":580,"width":263,"height":60,"color":"3"},
{"id":"ab10f89dba11c188","type":"text","text":"***Protocol A***\n***MSTB*** (Maker seller taker buyer), maybe some nomenclature could be useful for further thoughts","x":-340,"y":-700,"width":405,"height":140,"color":"3"},
{"id":"f61c6285cefa3b31","type":"text","text":"**Timeout**\nMaker gets his own Bond and Taker bond","x":-757,"y":660,"width":374,"height":79},
{"id":"b9b6ba151bbae01d","type":"text","text":"Maker","x":-637,"y":920,"width":134,"height":60,"color":"2"},
{"id":"425368ae6596b423","type":"text","text":"**Cooperative Cancellation**\nMaker and Taker accept to cancel trade","x":-196,"y":550,"width":362,"height":60},
{"id":"0cb3e5ea0f8dfb8b","type":"text","text":"Maker","x":-196,"y":920,"width":115,"height":60,"color":"2"},
{"id":"e2f7dbb8041baf43","type":"text","text":"Taker","x":200,"y":920,"width":115,"height":60,"color":"2"},
{"id":"247142651f831887","type":"text","text":"**Escrow**\nCoordinator collects Evidence of Fiat payment","x":600,"y":367,"width":433,"height":67},
{"id":"8dbbfd87977269b0","type":"text","text":"Taker wins dispute","x":1000,"y":580,"width":220,"height":60},
{"id":"cae35a028b34a2f8","type":"text","text":"**Maker wins dispute**\nTaker can't provide sufficient evidence of fiat payment (e.g. bank statement)","x":475,"y":580,"width":250,"height":159},
{"id":"898c648993e5d4f1","type":"text","text":"Maker","x":475,"y":920,"width":125,"height":60,"color":"1"},
{"id":"d58f256b0c1fbb19","type":"text","text":"Taker","x":800,"y":920,"width":110,"height":60,"color":"1"},
{"id":"4d414222fef35d69","type":"text","text":"Coordinator","x":1360,"y":920,"width":160,"height":60,"color":"1"},
{"id":"f57afde511e8ac94","type":"text","text":"**SCRIPT A**","x":-712,"y":1080,"width":250,"height":140,"color":"3"},
{"id":"b3099a08b3bd00c0","type":"text","text":"SCRIPT B","x":-60,"y":1080,"width":250,"height":140,"color":"3"},
{"id":"da056e0d063f396b","type":"text","text":"SCRIPT C","x":413,"y":1080,"width":250,"height":60,"color":"3"},
{"id":"3c9f98938fad14f1","type":"text","text":"SCRIPT D","x":1033,"y":1080,"width":250,"height":60,"color":"3"}
],
"edges":[
{"id":"0452390c8e326418","fromNode":"fe94f3c9a67875b6","fromSide":"bottom","toNode":"9d82ff6bff57a83c","toSide":"top","label":"1. paying/locking Maker bond"},
{"id":"5c69a086cc90154f","fromNode":"8fa39f8a35b6f963","fromSide":"bottom","toNode":"859640fc50ee7149","toSide":"top","label":"3. taking order by locking bond\n & submitting payout address"},
{"id":"d2599d1347bf5417","fromNode":"859640fc50ee7149","fromSide":"bottom","toNode":"4d60bd1ab9f37b0b","toSide":"top"},
{"id":"dabd41167871657b","fromNode":"859640fc50ee7149","fromSide":"bottom","toNode":"bc83b23761a4f553","toSide":"top"},
{"id":"e8af56d7bbf332bd","fromNode":"859640fc50ee7149","fromSide":"bottom","toNode":"b3437bec8e00d656","toSide":"top"},
{"id":"24e029ca9217e5d1","fromNode":"9d82ff6bff57a83c","fromSide":"right","toNode":"8fa39f8a35b6f963","toSide":"left"},
{"id":"244fd8e5cde7ee1f","fromNode":"b3437bec8e00d656","fromSide":"bottom","toNode":"247142651f831887","toSide":"top"},
{"id":"7409e2562900eece","fromNode":"bc83b23761a4f553","fromSide":"bottom","toNode":"f61c6285cefa3b31","toSide":"top"},
{"id":"7b9eb4c7df6ad656","fromNode":"4d60bd1ab9f37b0b","fromSide":"left","toNode":"e94e83cd61e18e1b","toSide":"top","label":"Bought sats (escrow)"},
{"id":"dcd01ed41d5129a1","fromNode":"4d60bd1ab9f37b0b","fromSide":"bottom","toNode":"534b2aec29273277","toSide":"top","label":"Fees"},
{"id":"18976f0f1451edc9","fromNode":"4d60bd1ab9f37b0b","fromSide":"bottom","toNode":"09c6192278d0c20c","toSide":"top","label":"Bond"},
{"id":"492605ad1ed05298","fromNode":"f61c6285cefa3b31","fromSide":"bottom","toNode":"b9b6ba151bbae01d","toSide":"top","label":"Maker + Taker Bond + Escrow"},
{"id":"2674ef5128f75398","fromNode":"425368ae6596b423","fromSide":"bottom","toNode":"0cb3e5ea0f8dfb8b","toSide":"top","label":"Escrow + Maker Bond"},
{"id":"145bd54f1037a13d","fromNode":"425368ae6596b423","fromSide":"bottom","toNode":"e2f7dbb8041baf43","toSide":"top","label":"Taker Bond"},
{"id":"2d05cba9001d314c","fromNode":"bc83b23761a4f553","fromSide":"bottom","toNode":"425368ae6596b423","toSide":"top"},
{"id":"0660ca0a50ba6756","fromNode":"247142651f831887","fromSide":"bottom","toNode":"cae35a028b34a2f8","toSide":"top","label":"Possibility 1"},
{"id":"9b3b38743a629a49","fromNode":"247142651f831887","fromSide":"bottom","toNode":"8dbbfd87977269b0","toSide":"top","label":"Possibility 2"},
{"id":"b355d2e09719aca7","fromNode":"cae35a028b34a2f8","fromSide":"bottom","toNode":"898c648993e5d4f1","toSide":"top","label":"Escrow + Maker Bond + Taker Bond"},
{"id":"576229e1d5f72190","fromNode":"8dbbfd87977269b0","fromSide":"bottom","toNode":"d58f256b0c1fbb19","toSide":"top","label":"Escrow + Taker Bond + Maker Bond"},
{"id":"a2b9b90f6f7a973e","fromNode":"8dbbfd87977269b0","fromSide":"bottom","toNode":"4d414222fef35d69","toSide":"top","label":"Fees"},
{"id":"e18ea56127e2c901","fromNode":"1939841fedec6c0f","fromSide":"top","toNode":"e94e83cd61e18e1b","toSide":"bottom"},
{"id":"cf6a0dd14c4b6225","fromNode":"1939841fedec6c0f","fromSide":"top","toNode":"534b2aec29273277","toSide":"bottom"},
{"id":"b735412385ea0d09","fromNode":"1939841fedec6c0f","fromSide":"top","toNode":"09c6192278d0c20c","toSide":"bottom"},
{"id":"e65e294cc356fe69","fromNode":"f57afde511e8ac94","fromSide":"top","toNode":"b9b6ba151bbae01d","toSide":"bottom"},
{"id":"94c7b24ff5a761ab","fromNode":"b3099a08b3bd00c0","fromSide":"top","toNode":"e2f7dbb8041baf43","toSide":"bottom"},
{"id":"5cc19e98879e3a76","fromNode":"b3099a08b3bd00c0","fromSide":"top","toNode":"0cb3e5ea0f8dfb8b","toSide":"bottom"},
{"id":"bdbd42ea0e67729c","fromNode":"da056e0d063f396b","fromSide":"top","toNode":"898c648993e5d4f1","toSide":"bottom"},
{"id":"adc7cacda2b737b7","fromNode":"3c9f98938fad14f1","fromSide":"top","toNode":"4d414222fef35d69","toSide":"bottom"},
{"id":"5f984c88b11c03f9","fromNode":"3c9f98938fad14f1","fromSide":"top","toNode":"d58f256b0c1fbb19","toSide":"bottom"}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB