Waves Namespace - Addresses
Author | Maxim Smolyakov, Yury Sidorov |
---|---|
Discussions-To | https://github.com/ChainAgnostic/namespaces/pull/49 |
Status | Draft |
Type | Standard |
Created | 2023-01-19 |
Requires | CAIP-2, CAIP-10 |
Table of Contents
CAIP-10
For context, see the [CAIP-10][] specification.
Rationale
Each Waves “account” has one public key that is the same across any Waves blockchain. But on each Waves blockchain, this public key is expressed as a distinct “address” expressed as a 26 byte array derived from public key (and chain identifier) and represented as a Base58btc encoded string.
Waves “address” can change depending on chain ID. This prevents unintentional transfers across Waves blockchains. Addresses also contain an address checksum mechanism, which protects against typos and copying errors of the address.
Syntax
The syntax of Waves addresses:
caip10-like address: namespace + ":" chainId + ":" + address
namespace: waves
chain Id: [-128..127] value packed with leading zeros at least 3 characters in length
address: Waves address represented as a [Base58btc][]-encoded string
The underlying form of each Waves address is byte array of Entity type + Chain
ID + Account public key hash + Checksum
, where:
Entity type
— always 1-byte integer with value1
Chain ID
— 1-byte integer of current blockchain IDAccount public key hash
— first 20 bytes of the result ofkeccak256(publicKey)
hashing functionChecksum
— first 4 bytes of the result of `keccak256(Entity type + Chain ID- Account public key hash)` hashing function.
Resolution method
To derive an address from public key, make a GET HTTP request
/addresses/publicKey/{publicKey}
to the blockchain node, for example:
https://nodes-testnet.wavesnodes.com/addresses/publicKey/7Y5rWP1aB1iGkDer8cS9TasAv1HpvCMZiZ2C9KLema6
Thus, the node will return in response an address of the account with the public key for the current blockchain, for example:
{
"address": "3NBNV8hiq8DTVF7UmzFLSUwud3h3pKZkVB3"
}
Test Cases
# Namespace-wide Public Key:
# 7Y5rWP1aB1iGkDer8cS9TasAv1HpvCMZiZ2C9KLema6
# Address on Waves Mainnet (87)
waves:087:3PPPJ62chFkr7hQu34WLPwKiywCpeSbfap7
# Address on Waves Testnet (84)
waves:084:3NBNV8hiq8DTVF7UmzFLSUwud3h3pKZkVB3
# Waves custom network (-7)
waves:-07:4Wa91bcuNGyv4BdV52UJ2VdpRtvZTd4BZfm
Links
Copyright
Copyright and related rights waived via CC0.
Citation
Please cite this document as:
Maxim Smolyakov, Yury Sidorov, "namespaces/waves-caip10: Waves Namespace - Addresses [DRAFT]," Chain Agnostic Namespaces, waves-caip10, January 2023 / . [Online serial]. Available: https://github.com/ChainAgnostic/namespaces/waves-caip10.md