forked from arein/dapp-smart-account
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Aleo: Add CAIP-2 and CAIP-10 specs (ethereum#90)
- Loading branch information
Showing
3 changed files
with
181 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: aleo | ||
title: Aleo Network | ||
author: Jonathan Gonzalez (@jonandgon, [email protected]) | ||
discussions-to: <URL of PR, mailing list, etc> | ||
status: Draft | ||
type: Standard | ||
created: 2023-09-12 | ||
requires: ["CAIP-2", "CAIP-10"] | ||
--- | ||
|
||
# Namespace for Aleo Network Blockchains | ||
|
||
This document defines the applicability of CAIP schemes to the networks of the Aleo Network blockchain ecosystem. | ||
|
||
# Syntax | ||
|
||
The `aleo` namespace profiles CAIP scheme and behaviors for referring to networks and other objects within the Aleo Network blockchain ecosystem. | ||
|
||
# References | ||
|
||
- [Aleo Network Documentation][]: Developer docs for the Aleo Network. | ||
|
||
[Aleo Network Documentation]: https://developer.aleo.org | ||
|
||
## 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: aleo-caip10 | ||
title: Aleo Network - Namespace Accounts | ||
author: Jonathan Gonzalez (@jonandgon, [email protected]) | ||
discussions-to: <URL of PR, mailing list, etc> | ||
status: Draft | ||
type: Standard | ||
created: 2023-09-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.* | ||
<!--"If you can't explain it simply, you don't understand it well enough." Provide a simplified and layman-accessible explanation of the CAIP.--> | ||
|
||
## Rationale | ||
<!--A short (~200 word) description of the technical issue being addressed.--> | ||
An Aleo account address is a unique identifier that allows users to transfer value and record data to one another in transactions. | ||
|
||
The account address is comprised of a public key for the account encryption scheme. | ||
|
||
## Syntax | ||
|
||
Address Format Example | ||
`aleo1dg722m22fzpz6xjdrvl9tzu5t68zmypj5p74khlqcac0gvednygqxaax0j` | ||
|
||
An account address is formatted as a `Bech32` string, comprised of 63 characters. The account address is encoded with an address prefix that reads `aleo1`. | ||
|
||
A regular expression for validating an Aleo address can be defined as: | ||
|
||
`^aleo1[a-z0-9]{58}$` | ||
|
||
## Test Cases | ||
|
||
```env | ||
# Aleo Testnet3 | ||
aleo:3:aleo1ml2xr6fawppd6uaf8gn95uy2fpqqg8gk74k0lu8na7uvayk64v8qu8hw5u | ||
# Aleo Mainnet | ||
aleo:0:aleo1ml2xr6fawppd6uaf8gn95uy2fpqqg8gk74k0lu8na7uvayk64v8qu8hw5u | ||
``` | ||
|
||
## Additional Considerations (*OPTIONAL) | ||
|
||
Account addresses / keys are chain-agnostic. | ||
|
||
Mainnet will release sometime at the end of 2023 / beginning of 2024. The API is subject to change. | ||
|
||
## References | ||
<!--Links to external resources that help understanding the CAIP better. This can e.g. be links to existing implementations.--> | ||
- [Aleo Network Documentation][]: Developer docs for the Aleo Network. | ||
- [Aleo Account Documentation][]: Developer docs for account creation. | ||
|
||
[Aleo Network Documentation]: https://developer.aleo.org | ||
[Aleo Account Documentation]: https://developer.aleo.org/concepts/accounts | ||
[CAIP-2]: https://chainAgnostic.org/CAIPS/caip-2 | ||
[CAIP-10]: https://chainAgnostic.org/CAIPS/caip-10 | ||
[aleo CAIP-2]: aleo/caip2 | ||
|
||
## 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,82 @@ | ||
--- | ||
namespace-identifier: aleo-caip2 | ||
title: Aleo Network - Namespace Chains | ||
author: Jonathan Gonzalez (@jonandgon, [email protected]) | ||
discussions-to: <URL of PR, mailing list, etc> | ||
status: Draft | ||
type: Standard | ||
created: 2023-09-12 | ||
requires (*optional): <["CAIP-2"]> | ||
replaces (*optional): <CAIP-2> | ||
--- | ||
|
||
<!--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-2 | ||
|
||
*For context, see the [CAIP-2][] specification.* | ||
|
||
## Rationale | ||
|
||
The namespace `aleo` refers to the Aleo Network Layer 1 blockchain. | ||
|
||
To date, Aleo consists of a single network: a testnet network (Testnet3). | ||
|
||
An identifier for a Aleo chain consists of the namespace prefix "aleo:" followed by the chain id. | ||
|
||
## Syntax | ||
|
||
The Aleo chain ID system maps between a human-readabe string (used to discriminate networks in the paths of [node endpoints][], for example) and an unsigned 16-bit binary integer, known colloquially as an "`u16` number", ranging from 0 to 65535 which is used internally. | ||
For example, at time or writing, the u16 number `3` maps to `testnet3` and `0` will map to `mainnet` once the latter has been released. | ||
The canonical location of the mapping of u16 integers to network name strings is still to be determined by the community, but in the case of conflicts between the community documentation and this document, the former should be taken as canonical. | ||
|
||
### Backwards Compatibility | ||
|
||
n/a | ||
|
||
### Resolution Method | ||
|
||
To resolve a reference for the Aleo namespace, get the latest block information from the chain you are interested in from an Aleo API node. An example using Javascript: | ||
|
||
```env | ||
fetch('https://api.explorer.aleo.org/v1/testnet3/latest/block') | ||
.then(response => response.json()) | ||
.then(response => console.log(response.header.metadata.network)) | ||
``` | ||
|
||
will log `3`. | ||
|
||
## Test Cases | ||
|
||
This is a manually composed example. | ||
|
||
```env | ||
# Aleo Testnet3 | ||
aleo:3 | ||
# Aleo mainnet | ||
aleo:0 | ||
``` | ||
|
||
## Additional Considerations (*OPTIONAL) | ||
|
||
Mainnet will release sometime Q1 2024. | ||
The API is subject to change and the example above (particularly other properties) may become inaccurate over time. | ||
|
||
## References | ||
<!--Links to external resources that help understanding the CAIP better. This can e.g. be links to existing implementations.--> | ||
- [Aleo Network Documentation][]: Developer docs for the Aleo Network. | ||
|
||
[Aleo Network Documentation]: https://developer.aleo.org | ||
[node endpoints]: https://developer.aleo.org/testnet/getting_started/overview/#query-the-network | ||
[CAIP-2]: https://chainAgnostic.org/CAIPS/caip-2 | ||
|
||
## Copyright | ||
|
||
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). |