Partisia Blockchain - Networks
Author | Partisia Blockchain Foundation |
---|---|
Discussions-To | https://github.com/ChainAgnostic/namespaces/pull/130 |
Status | Draft |
Type | Standard |
Created | 2024-10-22 |
Table of Contents
CAIP-2
For context, see the CAIP-2 specification.
CAIP-2 defines a general identification scheme for blockchains. This is the implementation of CAIP-2 for Partisia Blockchain.
Rationale
Partisia Blockchain consists of multiple networks: mainnet, testnet and potentially other private networks. Each network has a unique chain id that can be used to identify the network.
The Partisia Blockchain networks are identified by the partisia
namespace prefix, followed by the
chain id of the particular network.
Syntax
The chain id of Partisia Blockchain is a human-readable identifier of the particular chain. Due to
the character limitations of CAIP-2, all characters that are not allowed in the CAIP-2 characterset (i.e.,
[^-_a-zA-Z0-9]
) are replaced with _
.
Resolution Mechanics
To resolve the blockchain reference for a Partisia Blockchain chain, a GET request can be made to a
running reader node on the path /blockchain/chainId
. This will return a JSON object with the key
chainId
that are the human-readable chain id of this chain.
For example:
# Request
curl -s https://reader.partisiablockchain.com/blockchain/chainId
#Response
{
"chainId": "Partisia Blockchain"
}
To convert this to a valid CAIP-2 identifier one need only replace any characters not allowed by the specification and prefix with the namespace.
An example of the conversion using curl and jq:
curl -s https://reader.partisiablockchain.com/blockchain/chainId | jq -r '.chainId | "partisia:" +gsub("[^a-zA-Z0-9]"; "_")' # Outputs: partisia:Partisia_Blockchain
Backwards Compatibility
Not applicable
Test Cases
# Partisia Blockchain mainnet
partisia:Partisia_Blockchain
# Partisia Blockchain testnet
partisia:Partisia_Blockchain_Testnet
References
Copyright
Copyright and related rights waived via CC0.
Citation
Please cite this document as:
Partisia Blockchain Foundation, "namespaces/partisia-caip2: Partisia Blockchain - Networks [DRAFT]," Chain Agnostic Namespaces, partisia-caip2, October 2024 / . [Online serial]. Available: https://github.com/ChainAgnostic/namespaces/partisia-caip2.md