Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EIP-0042 Multi-Signature Wallet #88

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

vorujack
Copy link
Contributor

No description provided.


This data is transferred between multi-signature wallets until one wallet has at least `N` commitments (including its own).

This wallet creates a partially signed transaction with this encoding:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does the last wallet create a "partially signed transaction" and not a fully signed transaction if it already has N commitments? Or does this sentence apply until N-1 commitments are collected?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see https://github.com/ergoplatform/eips/blob/9906f403f61d8592ab955494cc4310563f4067c6/eip-0011.md#signing-procedure.
It's a two-round protocol in which the parties generate commitments in the first round. The last party is able to partially sign (he has only one of the keys so he cannot fully sign) and then, each of them signs the transaction partially and sends the generated signature to another party. This process continues until the signature is completed.

partialTx: "<partially signed transaction encoded as base64>",
commitments: <ancoded commitments>
signed: [<base64 encoded of signed public keys>],
simulated: [<base64 encoded of simulated public keys>],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What means simulated? This is only the list of missing keys, which can be determined by the wallet address. Why do we need it?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see https://storage.googleapis.com/ergo-cms-media/docs/ErgoScript.pdf, Appendix A2. Proving.
Those signers that do not participate in signing will be simulated. See above for details.

eip-0042.md Outdated Show resolved Hide resolved
This reduced format can be transformed into the standard format:

```
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This format differs from the actual format in EIP-11 (index/position, pubkey/pk, a/commitment). Is EIP-11 outdated?


The general commitment format is as follows. However, this general-purpose commitment can be used for any contract.
```
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Differs from EIP-11, see below

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, if EIP-11 is not suitable "as-is", then please explain why and if motivated, then EIP-11 should be updated. Then this EIP should follow EIP-11.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this format is used in the node, sigma-rust and other libs, see /wallet/generateCommitments.
I'm not sure why EIP-11 is not following this format.

eip-0042.md Show resolved Hide resolved

The general commitment format is as follows. However, this general-purpose commitment can be used for any contract.
```
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, if EIP-11 is not suitable "as-is", then please explain why and if motivated, then EIP-11 should be updated. Then this EIP should follow EIP-11.

eip-0042.md Show resolved Hide resolved
eip-0042.md Outdated
- Two bytes, with values `73` and `00`, respectively.
The value `00` indicates the VLQ-encoded index of value `N` in the list of constants.
- A constant byte with value `83`, the VLQ-encoded value of `M`, and a constant byte with value `08`
- For each public key (`M` times), a byte with value `73`,followed by the VLQ-encoded value of the index of the public key in the list of constants
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to use ErgoTree spec and specify here the ErgoTree using operation names from the specification.
And and most magic bytes in the text above are actually opcodes, so it is better to mention them (like "atLeast")

eip-0042.md Outdated
Sort the list of signers' public keys before being used in the contract.
Create the required ergoTree array as follows:

- The first byte in the array is `10`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first byte is the header, which contains ErgoTree version bits.
While it is ok to always use one specific version, in the EIP it is better to have version as parameter.
And, if the version > 0, then size bit 3 should be set, and the size of tree bytes should be stored in as necessary (see section 5.5 in the spec)

eip-0042.md Show resolved Hide resolved
eip-0042.md Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a mistake.
The "Collection Element Data Type (SigmaProp)" is not saved.
Please check ConcreteCollectionSerializer and ValueSerializer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if I got it, please elaborate.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On your picture, the "Collection Element Data Type (SigmaProp)" shown under "Repeated for each public key". This is not correct. That 08 value is stored only once. And you already showing it as "Collection Data Type (SigmaProp)"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to the doc, it seems you're right since Expression Serializations requires opCode and body; however, in the tests I'm getting parsing error if I eliminate those types and surprisingly it's working when type is added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants