Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mina: Add namespace / CAIP-2 #91

Merged
merged 14 commits into from
Mar 16, 2024
34 changes: 34 additions & 0 deletions mina/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
namespace-identifier: mina
title: Mina Namespace
author: Mina Foundation
status: Draft
type: Informational
created: 2023-09-15
requires: ["CAIP-2"]
---

# Namespace for Mina chains

This document defines the applicability of CAIP schemes to the blockchains of
the Mina ecosystem.

## Syntax

The namespace "mina" refers to the Mina blockchain, its forks, devnets and testnets.

## References

- [Mina Protocol Website][]
- [Mina Protocol Developer Documentation][]
- [Mina Rosetta Implementation][]

[CAIP-2]: https://ChainAgnostic.org/CAIPs/caip-2
[Mina Protocol Website]: https://minaprotocol.com/
[Mina Protocol Developer Documentation]: https://docs.minaprotocol.com/
[Mina Rosetta Implementation]: https://docs.minaprotocol.com/node-operators/rosetta

## Copyright

Copyright and related rights waived
via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
127 changes: 127 additions & 0 deletions mina/caip2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
---
namespace-identifier: mina-caip2
title: Mina Namespace - Chains
author: Mina Foundation
discussions-to: https://github.com/ChainAgnostic/namespaces/pull/91
status: Draft
type: Standard
created: 2023-09-15
requires: CAIP-2
---

# CAIP-2

*For context, see the [CAIP-2][] specification.*

## Abstract

In CAIP-2 a general blockchain identification scheme is defined. This is the implementation of CAIP-2 for Mina network.

### Mina Namespace

The namespace "mina" refers to the wider Mina ecosystem.

## Rationale

Mina consists of multiple networks: a production network `mainnet`, a testing network `testnet` and networks where new features are trialed.
Networks trialing new features are identified by a codename, for example `berkeley`.

An identifier for a Mina chain consists of the namespace prefix "mina:" followed by human readable reference identifying each network.
These identifiers may be extended to include codenames and prefixed to include the type of network. These names are separated by "-".

The type of network may be:
- devnet, indicating a stable copy of the network used for developer testing.
- testnet, indicating a less stable copy of the network where new features can be deployed and tested.

The names chosen above are taken from the signature schema's for each blockchain.

## Syntax

The blockchain namespace and blockchain identifiers will be in lowercase [a-z] and contain no whitespaces and have a miximum length of 30 characters.

The human readable identifier for a network may be one of the following strings:

- `mainnet`
- `testnet`
- `devnet`
- `berkeley`

Note that new human readable identifiers may be created for new networks by concatenating existing ones using `-` as a separator, i.e. `berkeley-testnet`.

A regular expression for validating the above or any other theoretically possible Mina network identifier string (that fits under the CAIP-20 limit of 32 characters) can be defined as:

```
^mina:[a-z]{1,12}?(-[a-z]{1,12})?$
```

See [Test Cases](#test-cases).

### Resolution Method

Use a graphQL query to obtain the identifier after connecting to a network:

```
query MyQuery {
networkID
}
```

The response will be:

```
{
"data": {
"networkID": "mina:mainnet"
}
}
```

Use the value provided in the `networkID` field.

Click here for more information on the [Mina GraphQL API][].

## Backwards Compatibility

Not applicable.

## Test Cases

This is a list of manually composed examples

```
# Mina Mainnet
mina:mainnet

# Mina Devnet
mina:devnet

# Mina Testnet
mina:testnet

# Mina Berkeley
mina:berkeley

# Mina Devnet Berkeley
mina:devnet-berkeley

# Mina Testnet Berkeley
mina:testnet-berkeley

```

## References

- [Mina Protocol Website][]
- [Mina Protocol Developer Documentation][]
- [Mina GraphQL API][] documentation
- [Mina Rosetta Implementation][]

[CAIP-2]: https://ChainAgnostic.org/CAIPs/caip-2
[Mina GraphQL API]: https://docs.minaprotocol.com/node-developers/graphql-api
[Mina Protocol Website]: https://minaprotocol.com/
[Mina Protocol Developer Documentation]: https://docs.minaprotocol.com/
[Mina Rosetta Implementation]: https://docs.minaprotocol.com/node-operators/rosetta

## Rights

Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).