Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions 11.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,73 @@ msg = secret_0 || C_0 || ... || secret_n || C_n || amount_0 || B_0 || ... || amo

Here, `||` denotes string concatenation. The `C` of each input and `B_` of each output are **hex strings** and `amount` is a UTF-encoded string.

### SigAllSigningPackage

To facilitate multi-party signing for [`SIG_ALL`](#signature-flag-sig_all) transactions, wallets can exchange a `SigAllSigningPackage` containing the minimal data required to reconstruct the transaction message and produce signatures. It is a wallet-led transport format.
Comment thread
KvngMikey marked this conversation as resolved.
Outdated

The `SigAllSigningPackage` has the following structure:

```json
{
"version": "sigallA",
"type": "swap" | "melt",
"quote": <str>, // Optional, for melt only
"inputs": [
{
"secret": <str>,
"C": <hex_str>
}
],
"outputs": <Array[BlindedMessage]>,
"digests": {
"legacy": <hex_str>, // Optional
"current": <hex_str>
},
Comment thread
KvngMikey marked this conversation as resolved.
Outdated
"witness": {
"signatures": <Array[hex_str]>
} // Optional
Comment thread
KvngMikey marked this conversation as resolved.
Outdated
}
```

The package is serialized to a string by JSON-encoding the object with specific key ordering (see `SigAllSigningPackage` definition), converting to base64url, and prefixing with `sigallA`. The keys must be sorted as: `version`, `type`, `quote` (if present), `inputs`, `outputs`, `digests` (if present), `witness` (if present).

The [SIG_ALL swap example] would be represented as the following `SigAllSigningPackage`:
Comment thread
KvngMikey marked this conversation as resolved.
Outdated

```json
{
"version": "sigallA",
"type": "swap",
"inputs": [
{
"secret": "[\"P2PK\",{\"nonce\":\"c7f280eb55c1e8564e03db06973e94bc9b666d9e1ca42ad278408fe625950303\",\"data\":\"030d8acedfe072c9fa449a1efe0817157403fbec460d8e79f957966056e5dd76c1\",\"tags\":[[\"sigflag\",\"SIG_ALL\"]]}]",
"C": "02c97ee3d1db41cf0a3ddb601724be8711a032950811bf326f8219c50c4808d3cd"
}
],
"outputs": [
{
"amount": 2,
"id": "00bfa73302d12ffd",
"B_": "038ec853d65ae1b79b5cdbc2774150b2cb288d6d26e12958a16fb33c32d9a86c39"
}
],
"digests": {
"legacy": "de7f9e3ca0fcc5ed3258fcf83dbf1be7fa78a5ed6da7bf2aa60d61e9dc6eb09a",
"current": "de7f9e3ca0fcc5ed3258fcf83dbf1be7fa78a5ed6da7bf2aa60d61e9dc6eb09a"
Comment thread
KvngMikey marked this conversation as resolved.
Outdated
},
"witness": {
"signatures": [
"ce017ca25b1b97df2f72e4b49f69ac26a240ce14b3690a8fe619d41ccc42d3c1282e073f85acd36dc50011638906f35b56615f24e4d03e8effe8257f6a808538"
]
}
}
```

Serialized:

Comment thread
robwoodgate marked this conversation as resolved.
```
sigallAeyJ2ZXJzaW9uIjoic2lnYWxsQSIsInR5cGUiOiJzd2FwIiwiaW5wdXRzIjpbeyJzZWNyZXQiOiJbXCJQMlBLXCIse1wibm9uY2VcIjpcImM3ZjI4MGViNTVjMWU4NTY0ZTAzZGIwNjk3M2U5NGJjOWI2NjZkOWUxY2E0MmFkMjc4NDA4ZmU2MjU5NTAzMDNcIixcImRhdGFcIjpcIjAzMGQ4YWNlZGZlMDcyYzlmYTQ0OWExZWZlMDgxNzE1NzQwM2ZiZWM0NjBkOGU3OWY5NTc5NjYwNTZlNWRkNzZjMVwiLFwidGFnc1wiOltbXCJzaWdmbGFnXCIsXCJTSUdfQUxMXCJdXX1dIiwiQyI6IjAyYzk3ZWUzZDFkYjQxY2YwYTNkZGI2MDE3MjRiZTg3MTFhMDMyOTUwODExYmYzMjZmODIxOWM1MGM0ODA4ZDNjZCJ9XSwib3V0cHV0cyI6W3siYW1vdW50IjoyLCJpZCI6IjAwYmZhNzMzMDJkMTJmZmQiLCJCXyI6IjAzOGVjODUzZDY1YWUxYjc5YjVjZGJjMjc3NDE1MGIyY2IyODhkNmQyNmUxMjk1OGExNmZiMzNjMzJkOWE4NmMzOSJ9XSwiZGlnZXN0cyI6eyJsZWdhY3kiOiJkZTdmOWUzY2EwZmNjNWVkMzI1OGZjZjgzZGJmMWJlN2ZhNzhhNWVkNmRhN2JmMmFhNjBkNjFlOWRjNmViMDlhIiwiY3VycmVudCI6ImRlN2Y5ZTNjYTBmY2M1ZWQzMjU4ZmNmODNkYmYxYmU3ZmE3OGE1ZWQ2ZGE3YmYyYWE2MGQ2MWU5ZGM2ZWIwOWEifSwid2l0bmVzcyI6eyJzaWduYXR1cmVzIjpbImNlMDE3Y2EyNWIxYjk3ZGYyZjcyZTRiNDlmNjlhYzI2YTI0MGNlMTRiMzY5MGE4ZmU2MTlkNDFjY2M0MmQzYzEyODJlMDczZjg1YWNkMzZkYzUwMDExNjM4OTA2ZjM1YjU2NjE1ZjI0ZTRkMDNlOGVmZmU4MjU3ZjZhODA4NTM4Il19fQ
```

## Locktime Tag

The `locktime` tag signals which set of locking rules the mint should apply. There are three possible states the `locktime` tag can represent:
Expand Down
64 changes: 64 additions & 0 deletions tests/11-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,3 +409,67 @@ The following is a valid multi-sig `SIG_ALL` `MeltRequest`.
]
}
```

### SigAllSigningPackage Test Vectors

The following is an example of a `SigAllSigningPackage`, derived from a `swap` transaction.

Input transaction data:

```json
{
"inputs": [
{
"amount": 2,
"id": "00bfa73302d12ffd",
"secret": "[\"P2PK\",{\"nonce\":\"c7f280eb55c1e8564e03db06973e94bc9b666d9e1ca42ad278408fe625950303\",\"data\":\"030d8acedfe072c9fa449a1efe0817157403fbec460d8e79f957966056e5dd76c1\",\"tags\":[[\"sigflag\",\"SIG_ALL\"]]}]",
"C": "02c97ee3d1db41cf0a3ddb601724be8711a032950811bf326f8219c50c4808d3cd",
"witness": "{\"signatures\":[\"ce017ca25b1b97df2f72e4b49f69ac26a240ce14b3690a8fe619d41ccc42d3c1282e073f85acd36dc50011638906f35b56615f24e4d03e8effe8257f6a808538\"]}"
}
],
"outputs": [
{
"amount": 2,
"id": "00bfa73302d12ffd",
"B_": "038ec853d65ae1b79b5cdbc2774150b2cb288d6d26e12958a16fb33c32d9a86c39"
}
]
}
```

Derived `SigAllSigningPackage` JSON:

```json
{
"version": "sigallA",
"type": "swap",
"inputs": [
{
"secret": "[\"P2PK\",{\"nonce\":\"c7f280eb55c1e8564e03db06973e94bc9b666d9e1ca42ad278408fe625950303\",\"data\":\"030d8acedfe072c9fa449a1efe0817157403fbec460d8e79f957966056e5dd76c1\",\"tags\":[[\"sigflag\",\"SIG_ALL\"]]}]",
"C": "02c97ee3d1db41cf0a3ddb601724be8711a032950811bf326f8219c50c4808d3cd"
}
],
"outputs": [
{
"amount": 2,
"id": "00bfa73302d12ffd",
"B_": "038ec853d65ae1b79b5cdbc2774150b2cb288d6d26e12958a16fb33c32d9a86c39"
}
],
"digests": {
"legacy": "de7f9e3ca0fcc5ed3258fcf83dbf1be7fa78a5ed6da7bf2aa60d61e9dc6eb09a",
"current": "de7f9e3ca0fcc5ed3258fcf83dbf1be7fa78a5ed6da7bf2aa60d61e9dc6eb09a"
Comment thread
KvngMikey marked this conversation as resolved.
Outdated
},
"witness": {
"signatures": [
"ce017ca25b1b97df2f72e4b49f69ac26a240ce14b3690a8fe619d41ccc42d3c1282e073f85acd36dc50011638906f35b56615f24e4d03e8effe8257f6a808538"
]
}
}
```

Serialized string:

```
sigallAeyJ2ZXJzaW9uIjoic2lnYWxsQSIsInR5cGUiOiJzd2FwIiwiaW5wdXRzIjpbeyJzZWNyZXQiOiJbXCJQMlBLXCIse1wibm9uY2VcIjpcImM3ZjI4MGViNTVjMWU4NTY0ZTAzZGIwNjk3M2U5NGJjOWI2NjZkOWUxY2E0MmFkMjc4NDA4ZmU2MjU5NTAzMDNcIixcImRhdGFcIjpcIjAzMGQ4YWNlZGZlMDcyYzlmYTQ0OWExZWZlMDgxNzE1NzQwM2ZiZWM0NjBkOGU3OWY5NTc5NjYwNTZlNWRkNzZjMVwiLFwidGFnc1wiOltbXCJzaWdmbGF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