Skip to content

Commit

Permalink
Add MultiversX namespace (ethereum#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
bumblefudge authored Dec 13, 2023
2 parents 1de24f4 + a247fd3 commit 02614b8
Show file tree
Hide file tree
Showing 3 changed files with 211 additions and 0 deletions.
39 changes: 39 additions & 0 deletions mvx/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
namespace-identifier: mvx
title: MultiversX Namespace
author: MultiversX Team <[email protected]>
discussions-to: https://github.com/ChainAgnostic/namespaces/issues/89
status: Draft
type: Informational
created: 2023-09-11
---

# Namespace for MultiversX Blockchains

This document defines the applicability of CAIP schemes to the networks of the MultiversX blockchain ecosystem.

## Syntax

The namespace `mvx` refers to the MultiversX open-source blockchain platform.

## References


- [MultiversX Documentation][MultiversX Docs]
- [MultiversX Specifications][]
- [MultiversX governance][]
- [Integrators Guide][]

[MultiversX governance]: https://agora.multiversx.com/c/governance/9
[MultiversX Docs]: https://docs.multiversx.com/
[MultiversX Specifications]: https://github.com/multiversx/mx-specs
[MultiversX Constants]: https://docs.multiversx.com/developers/constants
[MultiversX REST API]: https://docs.multiversx.com/sdk-and-tools/rest-api
[Integrators Guide]: https://docs.multiversx.com/integrators/overview
[BIP_0173]: https://en.bitcoin.it/wiki/BIP_0173
[CAIP-2]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md
[CAIP-10]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md

## Rights

Copyright and related rights waived via CC0.
67 changes: 67 additions & 0 deletions mvx/caip10.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
namespace-identifier: mvx-caip10
title: MultiversX Namespace - Addresses
author: MultiversX Team <[email protected]>
discussions-to: https://github.com/ChainAgnostic/namespaces/issues/89
status: Draft
type: Standard
created: 2023-09-11
requires: ["CAIP-2", "CAIP-10"]
---

# CAIP-10

_For context, see the [CAIP-10][] specification._

## Rationale

The MultiversX Address format is bech32, specified by the [BIP_0173][].
The human-readable-part of the bech32 addresses is "erd" and the universal separator `1`, which means that the MultiversX address always starts with an `erd1`, e.g.:
`erd1sea63y47u569ns3x5mqjf4vnygn9whkk7p6ry4rfpqyd6rd5addqyd9lf2`.

The MultiversX network defines the address of an account as the bech32 representation of the public key of its corresponding pair of keys (the secret key remains known only to the user that owns the key pair). The public key is 32 bytes in length (64 hex characters), while the address (bech32) is 62 characters long.

On MultiversX, deployed Smart Contracts and only deployed Smart Contracts have their hex (raw) addresses prefixed with 8 zero bytes (meaning that their bech32 address will begin with `erd1qqqqqqqqqqqq` )

## Syntax

```
caip10-like address: namespace + ":" chainId + ":" + address
namespace: mvx
chain Id: 1, D or T
address: bech32-formatted MultiversX address (erd1...)
```

## Test Cases

```
#Wallet address on MultiversX Mainnet
mvx:1:erd1uapegx64zk6yxa9kxd2ujskkykdnvzlla47uawh7sh0rhwx6y60sv68me9
#Deployed Smart Contract on MultiversX Mainnet
mvx:1:erd1qqqqqqqqqqqqqpgqhe8t5jewej70zupmh44jurgn29psua5l2jps3ntjj3
MultiversX Devnet
mvx:D:erd1devnet6uy8xjusvusfy3q83qadfhwrtty5fwa8ceh9cl60q2p6ysra7aaa
MultiversX Testnet
mvx:T:erd1sea63y47u569ns3x5mqjf4vnygn9whkk7p6ry4rfpqyd6rd5addqyd9lf2
```

## References

- [MultiversX Documentation][MultiversX Docs]
- [MultiversX Specifications][]
- [Integrators Guide][]
- [BIP_0173][], the Bitcoin Improvement Proposal that includes the bech32 algorithm and python code

[MultiversX Docs]: https://docs.multiversx.com/
[MultiversX Specifications]: https://github.com/multiversx/mx-specs
[Integrators Guide]: https://docs.multiversx.com/integrators/overview
[BIP_0173]: https://en.bitcoin.it/wiki/BIP_0173
[CAIP-2]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md
[CAIP-10]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md

## Copyright

Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
105 changes: 105 additions & 0 deletions mvx/caip2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
namespace-identifier: mvx-caip2
title: MultiversX Namespace - Chains
author: MultiversX Team <[email protected]>
discussions-to: https://github.com/ChainAgnostic/namespaces/issues/89
status: Draft
type: Standard
created: 2023-09-11
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 the MultiversX network.

### MultiversX Namespace

The namespace `mvx` refers to the wider MultiversX ecosystem.

## Rationale

MultiversX consists of multiple networks: a production network (Mainnet), a development testing network (Devnet)
and a testing network (Testnet). More may be canonically addressed in the future.

## Syntax

An identifier for an MultiversX chain consists of the namespace prefix "mvx:"
followed by the chain's `chainId`.

### Reference Definition

The reference to the MultiversX chain is identical the MultiversX community's native one-character representation for each chain:
`1` for `Mainnet`,
`D` for `Devnet`, or
`T` for `Testnet`

### Resolution Method

To resolve a blockchain reference for the MultiversX namespace, you can query the `network/config` endpoint on either the [lower level layer](https://gateway.multiversx.com) or the public [higher level layer](https://api.multiversx.com) that uses the gateway level underneath.

```jsonc
// Request
curl -X GET "https://api.multiversx.com/network/config" -H "accept: application/json"

// Response (formatted)
{
"data": {
"config": {
"erd_chain_id": "1",
// ... other fields
}
},
"code": "successful"
}
```

The response will return a JSON object which will include the network configuration information and
the `erd_chain_id` defined above can be retrieved from the `config` property of the
response object.
This can be used directly as the `reference` section of a CAIP-2 or CAIP-10.

## Backwards Compatibility

Not applicable.

## Test Cases

```
This is a list of manually composed examples
# MultiversX Mainnet
mvx:1
# MultiversX Devnet
mvx:D
# MultiversX Testnet
mvx:T
```

## References

- [MultiversX Constants][] is where chainIds in their native, one-character representation are canonically published to date by the community
- [MultiversX REST API][]
- [MultiversX Specifications][]
- [Integrators Guide][]

[MultiversX Docs]: https://docs.multiversx.com/
[MultiversX Specifications]: https://github.com/multiversx/mx-specs
[MultiversX Constants]: https://docs.multiversx.com/developers/constants
[MultiversX governance]: https://agora.multiversx.com/c/governance/9
[MultiversX REST API]: https://docs.multiversx.com/sdk-and-tools/rest-api
[Integrators Guide]: https://docs.multiversx.com/integrators/overview
[BIP_0173]: https://en.bitcoin.it/wiki/BIP_0173
[CAIP-2]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md
[CAIP-10]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md

## Rights

Copyright and related rights waived via CC0.

0 comments on commit 02614b8

Please sign in to comment.