Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
namespace-identifier: solana-caip122
title: Solana Namespace - SIWx
author: Haardik (@haardikk21)
discussions-to: TBA
status: Draft
type: Standard
created: 2022-07-06
updated: 2022-07-06
requires: ["CAIP-122", "CAIP-2", "CAIP-10"]
CAIP-122
For context, see the CAIP-122 specification.
Rationale
In Solana, signatures can only be made over raw bytes,
Uint8Arrays
in Javascript. This specification provides the signing algorithm to use, thetype
of the signing algorithm to identify it, and a method for signature creation and verification as required by CAIP-122.Specification
Signing Algorithm
Solana uses the Ed25519 signing algorithm for signing and verifying messages. Solana keypairs are also just Ed25519 public/private keypairs.
Signature Type
We propose using the signature type
solana:ed25519
to refer to the chain and algorithm used uniquely.Signature Creation
The abstract data model must be converted into a string representation in an unambigious format, and then the string converted to a byte array to be signed over.
We propose the following string format, inspired from EIP-4361.
For example,
which should then be converted into raw bytes (encoded as base64url for brevity).
Depending on the method used for signatures, this conversion may or may not happen automatically. For example, when using Phantom Wallet client-side, it performs the conversion automatically. However, if doing something server-side, you likely need to do this conversion yourself.
Signature Verification
Signature verification behaves similarly. We can use standard Ed25519 signature verification. We convert the input message to a bytes representation of the string format, then verify the signature over that. The verification public key should be the Solana wallet address, which is just a
base58
encoded Ed25519 public key.References