Skip to content

SIP-018 Signed Structured Data - #57

Merged
jcnelson merged 10 commits into
stacksgov:mainfrom
MarvinJanssen:feat/signed-structured-data
Mar 21, 2023
Merged

jcnelson merged 10 commits into
stacksgov:mainfrom
MarvinJanssen:feat/signed-structured-data

Conversation

@MarvinJanssen

Copy link
Copy Markdown
Contributor

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:

Comment thread sips/sip-018/sip-018-signed-structured-data.md Outdated
Comment thread sips/sip-018/sip-018-signed-structured-data.md Outdated
Comment thread sips/sip-018/sip-018-signed-structured-data.md Outdated
Comment thread sips/sip-018/sip-018-signed-structured-data.md Outdated
Comment thread sips/sip-018/sip-018-signed-structured-data.md Outdated
Comment thread sips/sip-018/sip-018-signed-structured-data.md Outdated
Comment thread sips/sip-018/sip-018-signed-structured-data.md Outdated
Comment thread sips/sip-018/sip-018-signed-structured-data.md Outdated
Comment thread sips/sip-018/sip-018-signed-structured-data.md Outdated
Comment thread sips/sip-018/sip-018-signed-structured-data.md Outdated
Comment thread sips/sip-018/sip-018-signed-structured-data.md

@jcnelson jcnelson left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread sips/sip-018/sip-018-signed-structured-data.md Outdated
Comment thread sips/sip-018/sip-018-signed-structured-data.md Outdated
@jcnelson

Copy link
Copy Markdown
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

friedger commented Feb 26, 2022 •

Copy link
Copy Markdown
Contributor

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

@mijoco-btc

Copy link
Copy Markdown
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

aulneau commented May 20, 2022 •

Copy link
Copy Markdown
Contributor

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)

Comment thread sips/sip-018/sip-018-signed-structured-data.md Outdated
Comment thread sips/sip-018/sip-018-signed-structured-data.md Outdated
@jcnelson

Copy link
Copy Markdown
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
Copy Markdown
Contributor 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

aulneau commented May 30, 2022

Copy link
Copy Markdown
Contributor

micro-stacks@0.5.1 has been updated to support the latest implementation of this SIP, matching the test vectors supplied in 318bad3

Comment thread sips/sip-018/sip-018-signed-structured-data.md
Comment thread sips/sip-018/sip-018-signed-structured-data.md Outdated
Comment thread sips/sip-018/sip-018-signed-structured-data.md Outdated
@kantai

kantai commented Jun 1, 2022

Copy link
Copy Markdown

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

Comment thread sips/sip-018/sip-018-signed-structured-data.md
@MarvinJanssen

Copy link
Copy Markdown
Contributor Author

Implemented suggestions and moved to Recommended.

@jcnelson

jcnelson commented Jun 4, 2022

Copy link
Copy Markdown
Contributor

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

@MarvinJanssen

Copy link
Copy Markdown
Contributor Author

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

@jcnelson

jcnelson commented Jun 7, 2022

Copy link
Copy Markdown
Contributor

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

@MarvinJanssen

Copy link
Copy Markdown
Contributor Author

Ready to go @jcnelson

@jcnelson

jcnelson commented Jun 8, 2022

Copy link
Copy Markdown
Contributor

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

@MarvinJanssen

Copy link
Copy Markdown
Contributor Author

Done!

@MarvinJanssen

Copy link
Copy Markdown
Contributor 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
Copy Markdown
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