Stacks Namespace - Addresses
Author | Léo Pradel @pradel, Greg Ogunyanwo @gregogun |
---|---|
Discussions-To | https://forum.stacks.org/t/caip-2-and-caip-10-stacks-specification/13290 |
Status | Draft |
Type | Standard |
Created | 2022-06-07 |
Requires | CAIP-10, CAIP-2 |
Table of Contents
CAIP-10
For context, see the CAIP-10 specification.
Rationale
Stacks aligns squarely with the “account” model rather than the “UXTO” model but uses the format “c32check” to address the “account” model.
Syntax
Address string concatenates 2 fields without whitespace or dividers: a 1-byte version prefix and a 20-byte hash of any one of the following:
- A single secp256k1 public key (either compressed or uncompressed)
- A Bitcoin p2sh multisig script
- A Bitcoin p2wpkh-p2sh script
- A Bitcoin p2wsh-p2sh script
- A Bitcoin p2tr script
Valid CAIP-10 account_id
s in this namespace are represented as c32check-encoded addresses. The addresses are always all-caps.
A regular expression for validating the account_id
can be defined as:
stacks:S[A-Z0-9]{30-40}
Test Cases
# Stacks mainnet, p2pkh input = a46ff88886c2ef9762d970b4d2c63678835bd39d
stacks:1:SP2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKNRV9EJ7
# Stacks testnet
stacks:2147483648:ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
References
- SIP-005
- c32check documentation
- c32check typescript implementation on github
Copyright
Copyright and related rights waived via CC0.
Citation
Please cite this document as:
Léo Pradel @pradel, Greg Ogunyanwo @gregogun, "namespaces/stacks-caip10: Stacks Namespace - Addresses [DRAFT]," Chain Agnostic Namespaces, stacks-caip10, June 2022 / . [Online serial]. Available: https://github.com/ChainAgnostic/namespaces/stacks-caip10.md