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

SIP-018 Signed Structured Data #57

Merged
merged 10 commits into from
Mar 21, 2023

Conversation

MarvinJanssen
Copy link
Collaborator

The Signed Structured Data specification proposed in this SIP describes a standard way to deterministically encode and sign Structured Data. Structured Data is data that can be represented in human-readable format and used in applications and smart contracts. The aim of the standard is to produce signatures that are straightforward and inexpensive to verify by smart contracts.

Reference implementation:

Requires:

See also:

Copy link
Contributor

@jcnelson jcnelson left a comment

Choose a reason for hiding this comment

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

Thank you for submitting this SIP! Based on my initial read, my recommendation is to split this SIP into two or more SIPs with the following proposals:

  • A SIP that proposes to-consensus-buff, which is a breaking change and thus needs a consensus consideration. It could activate with, but no sooner than Stacks 2.1.

  • A SIP that proposes a data signing and verifying scheme built around to-consensus-buff that recommends signed data begin with a canonical preamble that encodes a message prefix constant, a domain, a chain ID, etc. This could activate anytime after to-consensus-buff goes live, and it does not need consensus consideration.

@jcnelson
Copy link
Contributor

I took another pass at this, in light of the recent OpenSea phishing attack. While I stand by my belief that discussion of to-consensus-buff should be part of the Stacks 2.1 SIP, I think the rest of this is good. Most of my comments are just asking for minor clarifications.

@friedger
Copy link
Contributor

friedger commented Feb 26, 2022

Just as additional context, Verifiable Credentials are a second type of structured data that wallets should support

@radicleart
Copy link
Contributor

Marvin - a question on making the domain info stronger by eg including domain names and user agent info?

cf. EIP 712 says this..

The way to solve this is by introducing a domain separator, a 256-bit number. This is a value unique to each domain that is ‘mixed in’ the signature. It makes signatures from different domains incompatible. The domain separator is designed to include bits of DApp unique information such as the name of the DApp, the intended validator contract address, the expected DApp domain name, etc. The user and user-agent can use this information to mitigate phishing attacks, where a malicious DApp tries to trick the user into signing a message for another DApp.

@aulneau
Copy link
Contributor

aulneau commented May 20, 2022

Hi all -- just wanted to let folks know that I've implemented support for interacting with wallets that support this standard within micro-stacks:

Relevant versions:
micro-stacks: >= 0.5.0
@micro-stacks/react: >= 0.2.1

Some docs:
https://docs.micro-stacks.dev/modules/core/connect/message-signing
https://docs.micro-stacks.dev/modules/integrations/react/message-signing

Note: I have also implemented support for recoverable signatures in both RSV mode (like this sip expects) and VRS mode (like legacy stacks functions used)

@jcnelson
Copy link
Contributor

Did another pass. Let's go ahead and advance this to Accepted 🎉

Before we can advance to Recommended, I have two outstanding comments that need to be addressed. Also, @kantai (who is now on the technical CAB) needs to make a pass as well.

@MarvinJanssen
Copy link
Collaborator Author

SIP document updated with the new "SIP018" prefix in 318bad3!

To everyone that was/is implementing SIP018: this is a BREAKING CHANGE.

The prefix has been changed from a single-byte 0xC0 to six bytes: [0x53, 0x49, 0x50, 0x30, 0x31, 0x38]. (Which spells "SIP018" in ASCII.)

If you are curious why, see this discussion: #57 (comment)

The reference implementation has also been updated to reflect the change:

@aulneau
Copy link
Contributor

aulneau commented May 30, 2022

[email protected] has been updated to support the latest implementation of this SIP, matching the test vectors supplied in 318bad3

@kantai
Copy link
Contributor

kantai commented Jun 1, 2022

This looks great to me, just had some superficial comments, and then we can move this to recommended!

@MarvinJanssen
Copy link
Collaborator Author

Implemented suggestions and moved to Recommended.

@jcnelson
Copy link
Contributor

jcnelson commented Jun 4, 2022

Cool! Do the authors feel that this is ready for activation?

@MarvinJanssen
Copy link
Collaborator Author

Yep. But will give @janniks time to respond to the last open conversation.

@jcnelson
Copy link
Contributor

jcnelson commented Jun 7, 2022

Wanna ping me when it's ready? @janniks @MarvinJanssen

@MarvinJanssen
Copy link
Collaborator Author

Ready to go @jcnelson

@jcnelson
Copy link
Contributor

jcnelson commented Jun 8, 2022

Cool, it's now listed as "activating" in the README. Can you set the status to Activation-in-Progress? Thanks!

@MarvinJanssen
Copy link
Collaborator Author

Done!

@MarvinJanssen
Copy link
Collaborator Author

Looking at the activation criteria:

  1. to-consensus-buff or equivalent functionality is added to Stacks 2.1.
  2. At least one popular wallet application implements the standard before or within one year of the launch of Stacks 2.1.

Do you think both have been met @jcnelson? Hiro Wallet as well as the Stacks Ledger applet added support for SIP018 messages and to-consensus-buff has been added to Stacks 2.1. Can we thus consider this SIP activated or do we wait until the launch of Stacks 2.1?

@jcnelson
Copy link
Contributor

Just an update on this -- we will merge this when 2.1 activates on mainnet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Activation-in-Progress SIP is in the process of activating
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants