-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Casper network namespace (CAIP-2, CAIP-10) (#100)
Add Casper network namespace (CAIP-2, CAIP-10)
- Loading branch information
Showing
3 changed files
with
186 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
namespace-identifier: casper | ||
title: Casper network | ||
author: <["FirstName1 LastName1 (@GitHubUsername1)", "David Hernando <david.hernando@make.services>"]> | ||
status: Draft | ||
type: Informational | ||
created: 2024-01-12 | ||
requires: ["CAIP-2", "CAIP-10"] | ||
--- | ||
|
||
# Namespace for Casper chains | ||
|
||
This document defines the applicability of CAIP schemes to the blockchain of the Casper network ecosystem. | ||
|
||
## Syntax | ||
|
||
The namespace `casper` refers to the Casper network blockchain, its forks and testnets. | ||
|
||
## References | ||
|
||
[Casper network website]: https://casper.network/en-us/ | ||
[Casper Docs site]: https://docs.casper.network/ | ||
[Accounts and Keys]: https://docs.casper.network/concepts/accounts-and-keys | ||
[Deploys and the Deploy lifecycle]: https://docs.casper.network/deploy-and-deploy-lifecycle/ | ||
|
||
## Copyright | ||
|
||
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
--- | ||
namespace-identifier: casper-caip10 | ||
title: Casper - Addresses | ||
author: "FirstName1 LastName1 (@GitHubUsername1)", "David Hernando <david.hernando@make.services>" | ||
discussions-to: <URL of PR, mailing list, etc> | ||
status: Draft | ||
type: Standard | ||
created: 2024-01-12 | ||
requires: ["CAIP-10"] | ||
|
||
--- | ||
|
||
<!--You can leave these HTML comments in your merged CAIP and delete the | ||
visible duplicate text guides, they will not appear and may be helpful to | ||
refer to if you edit it again. This is the suggested template for new CAIPs. | ||
Note that an CAIP number will be assigned by an editor. When opening a pull | ||
request to submit your EIP, please use an abbreviated title in the | ||
filename, `caipX.md`, all lowercase, no `-` between the CAIP and its | ||
number.--> | ||
|
||
# CAIP-10 | ||
|
||
*For context, see the [CAIP-10][] specification.* | ||
|
||
## Rationale | ||
|
||
The Casper blockchain uses an on-chain account-based model, uniquely identified by an AccountHash derived from a specific PublicKey. The AccountHash is derived from any of the supported PublicKey variants below to standardize keys that can vary in length. | ||
|
||
Casper supports two types of keys for creating accounts and signing transactions: | ||
|
||
- Ed25519 keys, which use the Edwards-curve Digital Signature Algorithm (EdDSA). | ||
|
||
- Secp256k1 keys, which use the Elliptic Curve Digital Signature Algorithm (ECDSA) with the P-256 curve. | ||
|
||
|
||
## Syntax | ||
|
||
An Account hash is a 32-byte length hash derived from the public key by applying the `blake2b` hash function. | ||
|
||
Public key length depends on the key type: | ||
|
||
- For Ed25519, length is 66 bytes (the prefix 0x01 and the 64 bytes of the public key). | ||
|
||
- For Secp256k1, length is 68 bytes (the prefix 0x02 and the 66 bytes corresponding to the compressed form of the public key). | ||
|
||
Keys are usually represented with lowercase letters. However, [CEP-57] introduced an opt-in checksum scheme, based on EIP-55, to protect against copy errors by encoding a checksum in the capitalization of hexadecimal strings. | ||
|
||
## Test Cases | ||
|
||
Ed25519 public key - checksummed | ||
`01d51D4d7e1Dc8166405EC6fFb21C94434Cfd4D9021Ed6D94A1FF3d7D613046710` | ||
|
||
Ed25519 public key - without checksum | ||
`01cd4f2ed572ea555ca46c17c83c43e609d2e916871236f40faa9ba747478e8dee` | ||
|
||
AccountHash for previous public key | ||
`account-hash-79c9563deeb7bbd05e91c7dddddec9328717fea1ae846dd54ab9dfeaae015bc0` | ||
|
||
Secp256k1 public key - checksummed | ||
`02038a9932973F5632BcF31ff9Ba83e7eB3Bd7457F85af79258bd6b0A1FF06017B5a` | ||
|
||
Secp256k1 public key - not checksummed | ||
`02022ade9bd8e06033e99b1bfbf789db4e2db0349045818469bbcaf756996900e838` | ||
|
||
AccountHash for previous public key | ||
`account-hash-5b7e450d8b1e58de5f012db6c6e934431a6b6b063e5d4955914675e791797712` | ||
|
||
Ed25519 public key - invalid checksum | ||
`01D51D4d7e1Dc8166405EC6fFb21C94434Cfd4D9021Ed6D94a1FF3d7d613046710` | ||
|
||
Secp256k1 public key - invalid checksum | ||
`02038A9932973f5632BcF31ff9Ba83e7eB3Bd7457F85af79258bd6b0A1FF06017b5A` | ||
|
||
## References | ||
<!--Links to external resources that help understanding the CAIP better. This can e.g. be links to existing implementations.--> | ||
- [Accounts-and-Keys][] | ||
- [CEP-57][] | ||
- [Casper Docs site][] | ||
- [CAIP-10][] | ||
|
||
[CAIP-10]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md | ||
[CEP-57]: https://github.com/casper-network/ceps/blob/master/text/0057-checksummed-addresses.md | ||
[Accounts-and-Keys]: https://docs.casper.network/concepts/accounts-and-keys/ | ||
[Casper Docs site]: https://docs.casper.network/ | ||
|
||
## Copyright | ||
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
--- | ||
namespace-identifier: casper-caip2 | ||
title: Casper Chains | ||
author: "FirstName1 LastName1 (@GitHubUsername1)", "David Hernando <david.hernando@make.services>" | ||
status: Draft | ||
type: Standard | ||
created: 2024-01-12 | ||
requires: ["CAIP-2"] | ||
--- | ||
|
||
# CAIP-2 | ||
|
||
*For context, see the [CAIP-2][] specification.* | ||
|
||
## Rationale | ||
|
||
The Chain ID is a human-readable identifier for a Casper network blockchain. It should not be confused with the `genesis_hash`, which is the true and unique identifier of a chain. | ||
|
||
## Syntax | ||
|
||
It consists of the prefix `casper:` followed by the chainspec name of that network. Such name is a string that permits to easily identify the network and protect from replay attacks. | ||
|
||
### Resolution Method | ||
|
||
To resolve the [chainspec][] name for a given Casper network chain, send an RPC request with method `info_get_status` to a Casper node in that network. The result object in the RPC response will contain the property `chainspec_name` containing the [chainspec][] name corresponding to that network. | ||
|
||
For example: | ||
|
||
```jsonc | ||
// Command | ||
curl --request POST \ | ||
--header "Content-Type: application/json" \ | ||
--data '{"jsonrpc":"2.0", "id": 1, "method":"info_get_status", "params":{}}' \ | ||
http://52.35.59.254:7777/rpc | jq .result.chainspec_name | ||
|
||
// Result | ||
"casper-test" | ||
``` | ||
|
||
Append the prefix `"casper:"` to form the Chain Id for that chain. In the example above: `casper:casper-test`. | ||
|
||
## Test Cases | ||
|
||
This is a list of manually composed Chain Id examples | ||
|
||
``` | ||
# Casper Mainnet | ||
casper:casper | ||
# Casper Testnet | ||
casper:casper-test | ||
``` | ||
|
||
For testing purposes, the Casper Association maintains the following RPC endpoints: | ||
|
||
* Casper Mainnet: http://34.224.191.55:7777/rpc | ||
* Testnet: http://52.35.59.254:7777/rpc | ||
|
||
|
||
## References | ||
|
||
- [Casper Docs site][] | ||
- [Casper Chain Specification][Chainspec] | ||
- [CAIP-2][] | ||
|
||
[CAIP-2]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md | ||
[Casper Docs site]: https://docs.casper.network/ | ||
[Chainspec]: https://docs.casper.network/operators/setup-network/chain-spec/ | ||
|
||
## Copyright | ||
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). |