From e9300a00c5ef388814b4dc039aa0d8bbae75a375 Mon Sep 17 00:00:00 2001 From: silverpill Date: Thu, 27 Apr 2023 20:36:17 +0000 Subject: [PATCH 1/6] Add monero namespace --- monero/README.md | 27 +++++++++++ monero/caip2.md | 113 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 monero/README.md create mode 100644 monero/caip2.md diff --git a/monero/README.md b/monero/README.md new file mode 100644 index 00000000..bb068205 --- /dev/null +++ b/monero/README.md @@ -0,0 +1,27 @@ +--- +namespace-identifier: monero +title: Monero +author: silverpill (@silverpill) +status: Draft +type: Informational +created: 2023-04-27 +requires: ["CAIP-2"] +--- + +# Namespace for Monero chains + +This document defines the applicability of CAIP schemes to the blockchains of the Monero ecosystem. + +## Syntax + +The namespace "monero" refers to the Monero blockchain, its forks and testnets. + +## References + +- [Website][] + +[Website]: https://www.getmonero.org/ + +## Copyright + +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). diff --git a/monero/caip2.md b/monero/caip2.md new file mode 100644 index 00000000..3d5db98a --- /dev/null +++ b/monero/caip2.md @@ -0,0 +1,113 @@ +--- +namespace-identifier: monero-caip2 +title: Monero - Chains +author: silverpill (@silverpill) +discussions-to: https://github.com/ChainAgnostic/namespaces/issues/41 +status: Draft +type: Informational +created: 2023-04-27 +requires: ["CAIP-2"] +--- + +# CAIP-2 + +*For context, see the [CAIP-2][] specification.* + +## Rationale + +CAIP-2 defines a way to identify a blockchain. Monero blockchain, its forks and testnets can be uniquely identified by their genesis blocks. + +## Syntax + +Monero chain ID is a hash of its genesis block, truncated to the first 32 characters. + +### Resolution Mechanics + +To obtain the genesis block hash, make a JSON-RPC request to the Monero daemon with method [get_block_header_by_height]. + +Request: + +```json +{ + "jsonrpc": "2.0", + "id": "0", + "method": "get_block_header_by_height", + "params": { + "height": 0 + } +} +``` + +Response example (Monero mainnet): + +```json +{ + "id": "0", + "jsonrpc": "2.0", + "result": { + "block_header": { + "block_size": 80, + "block_weight": 80, + "cumulative_difficulty": 1, + "cumulative_difficulty_top64": 0, + "depth": 2873685, + "difficulty": 1, + "difficulty_top64": 0, + "hash": "418015bb9ae982a1975da7d79277c2705727a56894ba0fb246adaabb1f4632e3", + "height": 0, + "long_term_weight": 80, + "major_version": 1, + "miner_tx_hash": "c88ce9783b4f11190d7b9c17a69c1c52200f9faaee8e98dd07e6811175177139", + "minor_version": 0, + "nonce": 10000, + "num_txes": 0, + "orphan_status": false, + "pow_hash": "", + "prev_hash": "0000000000000000000000000000000000000000000000000000000000000000", + "reward": 17592186044415, + "timestamp": 0, + "wide_cumulative_difficulty": "0x1", + "wide_difficulty": "0x1" + }, + "credits": 0, + "status": "OK", + "top_hash": "", + "untrusted": false + } +} +``` + +## Test Cases + +This is a list of manually composed examples: + +``` +# Monero mainnet +monero:418015bb9ae982a1975da7d79277c270 + +# Monero stagenet +monero:76ee3cc98646292206cd3e86f74d88b4 + +# Monero testnet +monero:48ca7cd3c8de5b6a4d53d2861fbdaedc + +# Wownero mainnet +monero:a3fd635dd5cb55700317783469ba749b +``` + +## Additional Considerations + +Private testnet (also known as **regtest** or **fakechain**) has the same genesis block hash as Monero mainnet. +To avoid conflicts, implementers should use chain ID `monero:00000000000000000000000000000000` to identify this chain. + +## References + +- [Monero Networks][] + +[CAIP-2]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md +[get_block_header_by_height]: https://www.getmonero.org/resources/developer-guides/daemon-rpc.html#get_block_header_by_height +[Monero Networks]: https://monerodocs.org/infrastructure/networks/ + +## Copyright + +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). From b3833ffc22b772ea440a23c94a6e60cf165be296 Mon Sep 17 00:00:00 2001 From: Bumblefudge Date: Fri, 19 May 2023 14:14:39 +0200 Subject: [PATCH 2/6] make fakechain special case more explicit --- monero/caip2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monero/caip2.md b/monero/caip2.md index 3d5db98a..8792db8a 100644 --- a/monero/caip2.md +++ b/monero/caip2.md @@ -98,7 +98,7 @@ monero:a3fd635dd5cb55700317783469ba749b ## Additional Considerations Private testnet (also known as **regtest** or **fakechain**) has the same genesis block hash as Monero mainnet. -To avoid conflicts, implementers should use chain ID `monero:00000000000000000000000000000000` to identify this chain. +To avoid conflicts, implementers should use chain ID `monero:00000000000000000000000000000000` to identify this chain, as above, and implementers are advised to take care in disambiguating this special case in their code. ## References From 6e3014a2cfade6de60a6f78a8ab82020ecf464e7 Mon Sep 17 00:00:00 2001 From: Bumblefudge Date: Fri, 19 May 2023 14:14:58 +0200 Subject: [PATCH 3/6] Add fakechain to examples --- monero/caip2.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/monero/caip2.md b/monero/caip2.md index 8792db8a..bbddf24d 100644 --- a/monero/caip2.md +++ b/monero/caip2.md @@ -88,9 +88,11 @@ monero:418015bb9ae982a1975da7d79277c270 # Monero stagenet monero:76ee3cc98646292206cd3e86f74d88b4 -# Monero testnet +# Monero testnet monero:48ca7cd3c8de5b6a4d53d2861fbdaedc +# Monero Private testnet (special case) +monero:00000000000000000000000000000000 # Wownero mainnet monero:a3fd635dd5cb55700317783469ba749b ``` From 3a147445d644faab8267b0dbae1b4008686dd5cf Mon Sep 17 00:00:00 2001 From: Bumblefudge Date: Fri, 19 May 2023 14:15:28 +0200 Subject: [PATCH 4/6] Minor editorial - describe community website link --- monero/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monero/README.md b/monero/README.md index bb068205..709ae7f8 100644 --- a/monero/README.md +++ b/monero/README.md @@ -18,9 +18,9 @@ The namespace "monero" refers to the Monero blockchain, its forks and testnets. ## References -- [Website][] +- [Community, End-user, and Developer Onboarding Website][communitysite] -[Website]: https://www.getmonero.org/ +[communitysite]: https://www.getmonero.org/ ## Copyright From ec7f4f9cadabd7e7d23a798c07c114a07dd1c456 Mon Sep 17 00:00:00 2001 From: Bumblefudge Date: Fri, 19 May 2023 14:16:02 +0200 Subject: [PATCH 5/6] minor formatting --- monero/caip2.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/monero/caip2.md b/monero/caip2.md index bbddf24d..915e8bd3 100644 --- a/monero/caip2.md +++ b/monero/caip2.md @@ -91,7 +91,8 @@ monero:76ee3cc98646292206cd3e86f74d88b4 # Monero testnet monero:48ca7cd3c8de5b6a4d53d2861fbdaedc -# Monero Private testnet (special case) +# Monero Private testnet (special case; see below) + monero:00000000000000000000000000000000 # Wownero mainnet monero:a3fd635dd5cb55700317783469ba749b From c8f69e4448cd012f69821b920f1eb9e780bfa73a Mon Sep 17 00:00:00 2001 From: Bumblefudge Date: Fri, 19 May 2023 14:16:30 +0200 Subject: [PATCH 6/6] minor formatting --- monero/caip2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monero/caip2.md b/monero/caip2.md index 915e8bd3..3f478394 100644 --- a/monero/caip2.md +++ b/monero/caip2.md @@ -92,8 +92,8 @@ monero:76ee3cc98646292206cd3e86f74d88b4 monero:48ca7cd3c8de5b6a4d53d2861fbdaedc # Monero Private testnet (special case; see below) - monero:00000000000000000000000000000000 + # Wownero mainnet monero:a3fd635dd5cb55700317783469ba749b ```