From 6b62f1e0f335546f1afad2dd265ab86778cada8e Mon Sep 17 00:00:00 2001 From: Qi Zhou Date: Mon, 10 Apr 2023 15:19:29 -0700 Subject: [PATCH 01/17] Add more details for the examples --- EIPS/eip-4804.md | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/EIPS/eip-4804.md b/EIPS/eip-4804.md index 4a86e99ee83a78..80c78d92294ac6 100644 --- a/EIPS/eip-4804.md +++ b/EIPS/eip-4804.md @@ -53,7 +53,7 @@ where ### Resolve Mode -Once the "To" address and chainid are determined, the protocol will check the resolver mode of contract by calling "resolveMode" method. The protocol currently supports two resolve modes: +Once the "To" address and chainid are determined, the protocol will check the resolver mode of contract by calling "resolveMode() returns (bytes32)" method. The protocol currently supports two resolve modes: #### Manual Mode @@ -74,57 +74,72 @@ The auto mode is the default mode to resolve (also applies when the "resolveMode Note that if **method** does not exist, i.e., **path** is empty or "/", then the contract will be called with empty calldata. -- **returns** attribute in **query** tells the format of the returned data. If not specified, the returned message data will be parsed in "(bytes32)" and MIME will be set based on the suffix of the last argument. If **returns** is "()", the returned data will be parsed in raw bytes in JSON. Otherwise, the returned message will be parsed in the specified **returns** attribute in JSON. If multiple **returns** attributes are present, the value of the last **returns** attribute will be applied. Note that **returnTypes** is the alias of **returns**, but it is not recommended to use and is mainly for backward-compatible purpose. +- **returns** attribute in **query** tells the format of the returned data. If not specified, the returned message data will be treated in ABI-type "(bytes)" and the decoded bytes will be returned to the frontend. The MIME will be set based on the suffix of the last argument. If **returns** is "()", the returned data will be parsed in raw bytes in JSON format. Otherwise, the returned message data will be parsed in the specified **returns** attribute in JSON format. If multiple **returns** attributes are present, the value of the last **returns** attribute will be applied. Note that **returnTypes** is the alias of **returns**, but it is not recommended to use and is mainly for backward-compatible purpose. ### Examples -#### Example 1 +#### Example 1a ``` web3://w3url.eth/ ``` +where the contract of **w3url.eth** is in manual mode. -The protocol will find the address of **w3url.eth** from ENS in chainid 1 (Mainnet), and then the protocol will call the address with "From" = "0x..." and "Calldata" = "0x2F". +The protocol will find the address of **w3url.eth** from ENS in chainid 1 (Mainnet). Then the protocol will call the address with "Calldata" = `keccak("resolveMode()")[0:4]` = "0xDD473FAE", which returns "manual" in ABI-type "(bytes32)". After determining the manual mode of the contract, the protocol will call the address with "To" = **contractAddress** and "Calldata" = "0x2F". The returned data will be treated as ABI-type "(bytes)", and the decoded bytes will be returned to the frontend. + +#### Example 1b + +``` +web3://w3url.eth/ +``` +where the contract of **w3url.eth** is in auto mode. + +The protocol will find the address of **w3url.eth** from ENS in chainid 1 (Mainnet). Then the protocol will call the address with "Calldata" = `keccak("resolveMode()")[0:4]` = "0xDD473FAE", which returns "", i.e., the contract is in auto mode. After determining the auto mode of the contract, the protocol will call the address with "To" = **contractAddress** and "Calldata" = "". The returned data will be treated as ABI-type "(bytes)", and the decoded bytes will be returned to the frontend. #### Example 2 ``` web3://cyberbrokers-meta.eth/renderBroker/9999 ``` +where the contract of **cyberbrokers-meta.eth** is in auto mode. -The protocol will find the address of **cyberbrokers-meta.eth** from ENS on chainid 1 (Mainnet), and then call the address with "To" = "0x..." and "Calldata" = "0x" + `keccak("view(uint256)")[0:4] + abi.encode(uint256(9999))`. +The protocol will find the address of **cyberbrokers-meta.eth** from ENS on chainid 1 (Mainnet). Then the protocol will call the address with "Calldata" = `keccak("resolveMode()")[0:4]` = "0xDD473FAE", which returns "", i.e., the contract is in auto mode. After determining the auto mode of the contract, the protocol will call the address with "To" = **contractAddress** and "Calldata" = "0x" + `keccak("renderBroker(uint256)")[0:4] + abi.encode(uint256(9999))`. The returned data will be treated as ABI-type "(bytes)", and the decoded bytes will be returned to the frontend. #### Example 3 ``` web3://vitalikblog.eth:5/ ``` +where the contract of **vitalikblog.eth:5** is in manual mode. -The protocol will find the address of **vitalikblog.eth** from ENS on chainid 5 (Goerli), and then call the address with "From" = "0x..." and "Calldata" = "0x2F" with chainid = 5. +The protocol will find the address of **vitalikblog.eth** from ENS on chainid 5 (Goerli). Then after determing the contract is in manual mode, the protocol will call the address with "To" = **contractAddress** and "Calldata" = "0x2F" with chainid = 5. The returned data will be treated as ABI-type "(bytes)", and the decoded bytes will be returned to the frontend. #### Example 4 ``` web3://0xe4ba0e245436b737468c206ab5c8f4950597ab7f:42170/ ``` +where the contract "0xe4ba0e245436b737468c206ab5c8f4950597ab7f:42170" is in manual mode. -The protocol will call the address with "To" = "0x9e081Df45E0D167636DB9C61C7ce719A58d82E3b" and "Calldata" = "0x" with chainid = 42170 (Arbitrum Nova). +After determing the contract is in manual mode, the protocol will call the address with "To" = "0xe4ba0e245436b737468c206ab5c8f4950597ab7f" and "Calldata" = "0x2F" with chainid = 42170 (Arbitrum Nova). The returned data will be treated as ABI-type "(bytes)", and the decoded bytes will be returned to the frontend. #### Example 5 ``` web3://0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/balanceOf/vitalik.eth?returns=(uint256) ``` +where the contract "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" is in auto mode. -The protocol will find the addresses of **vitalik.eth** from ENS on chainid 1 (Mainnet) and then call the method "balanceOf(address)" of the contract with the **charles.eth**'s address. The returned data will be parsed as uint256 like `[ "10000000000000" ]`. +The protocol will find the addresses of **vitalik.eth** from ENS on chainid 1 (Mainnet) and then call the method "balanceOf(address)" of the contract with the **vitalik.eth**'s address. The returned data from the call of the contract will be treated as ABI-type "(uint256)", and the decoded data will be returned to the frontend in JSON format like `[ "10000000000000" ]`. #### Example 6 ``` web3://0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/balanceOf/vitalik.eth?returns=() ``` +where the contract ”0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48“ is in auto mode. -The protocol will find the address of **vitalik.eth** from ENS on chainid 1 (Mainnet) and then call the method "balanceOf(address)" of the address. The returned data will be parsed as raw bytes like `["0x000000000000000000000000000000000000000000000000000009184e72a000"]`. +The protocol will find the address of **vitalik.eth** from ENS on chainid 1 (Mainnet) and then call the method "balanceOf(address)" of the address. The returned data from the call of the contract will be parsed as raw bytes in JSON format like `["0x000000000000000000000000000000000000000000000000000009184e72a000"]`. ## Rationale From 9cd23156aba895663f76d796079739905b6be704 Mon Sep 17 00:00:00 2001 From: Qi Zhou Date: Mon, 10 Apr 2023 17:32:26 -0700 Subject: [PATCH 02/17] Update eip-4804.md --- EIPS/eip-4804.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/EIPS/eip-4804.md b/EIPS/eip-4804.md index 80c78d92294ac6..50a81cd08a4265 100644 --- a/EIPS/eip-4804.md +++ b/EIPS/eip-4804.md @@ -83,6 +83,7 @@ Note that if **method** does not exist, i.e., **path** is empty or "/", then the ``` web3://w3url.eth/ ``` + where the contract of **w3url.eth** is in manual mode. The protocol will find the address of **w3url.eth** from ENS in chainid 1 (Mainnet). Then the protocol will call the address with "Calldata" = `keccak("resolveMode()")[0:4]` = "0xDD473FAE", which returns "manual" in ABI-type "(bytes32)". After determining the manual mode of the contract, the protocol will call the address with "To" = **contractAddress** and "Calldata" = "0x2F". The returned data will be treated as ABI-type "(bytes)", and the decoded bytes will be returned to the frontend. @@ -92,6 +93,7 @@ The protocol will find the address of **w3url.eth** from ENS in chainid 1 (Mainn ``` web3://w3url.eth/ ``` + where the contract of **w3url.eth** is in auto mode. The protocol will find the address of **w3url.eth** from ENS in chainid 1 (Mainnet). Then the protocol will call the address with "Calldata" = `keccak("resolveMode()")[0:4]` = "0xDD473FAE", which returns "", i.e., the contract is in auto mode. After determining the auto mode of the contract, the protocol will call the address with "To" = **contractAddress** and "Calldata" = "". The returned data will be treated as ABI-type "(bytes)", and the decoded bytes will be returned to the frontend. @@ -101,6 +103,7 @@ The protocol will find the address of **w3url.eth** from ENS in chainid 1 (Mainn ``` web3://cyberbrokers-meta.eth/renderBroker/9999 ``` + where the contract of **cyberbrokers-meta.eth** is in auto mode. The protocol will find the address of **cyberbrokers-meta.eth** from ENS on chainid 1 (Mainnet). Then the protocol will call the address with "Calldata" = `keccak("resolveMode()")[0:4]` = "0xDD473FAE", which returns "", i.e., the contract is in auto mode. After determining the auto mode of the contract, the protocol will call the address with "To" = **contractAddress** and "Calldata" = "0x" + `keccak("renderBroker(uint256)")[0:4] + abi.encode(uint256(9999))`. The returned data will be treated as ABI-type "(bytes)", and the decoded bytes will be returned to the frontend. @@ -110,6 +113,7 @@ The protocol will find the address of **cyberbrokers-meta.eth** from ENS on chai ``` web3://vitalikblog.eth:5/ ``` + where the contract of **vitalikblog.eth:5** is in manual mode. The protocol will find the address of **vitalikblog.eth** from ENS on chainid 5 (Goerli). Then after determing the contract is in manual mode, the protocol will call the address with "To" = **contractAddress** and "Calldata" = "0x2F" with chainid = 5. The returned data will be treated as ABI-type "(bytes)", and the decoded bytes will be returned to the frontend. @@ -119,6 +123,7 @@ The protocol will find the address of **vitalikblog.eth** from ENS on chainid 5 ``` web3://0xe4ba0e245436b737468c206ab5c8f4950597ab7f:42170/ ``` + where the contract "0xe4ba0e245436b737468c206ab5c8f4950597ab7f:42170" is in manual mode. After determing the contract is in manual mode, the protocol will call the address with "To" = "0xe4ba0e245436b737468c206ab5c8f4950597ab7f" and "Calldata" = "0x2F" with chainid = 42170 (Arbitrum Nova). The returned data will be treated as ABI-type "(bytes)", and the decoded bytes will be returned to the frontend. @@ -128,6 +133,7 @@ After determing the contract is in manual mode, the protocol will call the addre ``` web3://0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/balanceOf/vitalik.eth?returns=(uint256) ``` + where the contract "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" is in auto mode. The protocol will find the addresses of **vitalik.eth** from ENS on chainid 1 (Mainnet) and then call the method "balanceOf(address)" of the contract with the **vitalik.eth**'s address. The returned data from the call of the contract will be treated as ABI-type "(uint256)", and the decoded data will be returned to the frontend in JSON format like `[ "10000000000000" ]`. @@ -137,6 +143,7 @@ The protocol will find the addresses of **vitalik.eth** from ENS on chainid 1 (M ``` web3://0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/balanceOf/vitalik.eth?returns=() ``` + where the contract ”0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48“ is in auto mode. The protocol will find the address of **vitalik.eth** from ENS on chainid 1 (Mainnet) and then call the method "balanceOf(address)" of the address. The returned data from the call of the contract will be parsed as raw bytes in JSON format like `["0x000000000000000000000000000000000000000000000000000009184e72a000"]`. From e6096667b100eb119ca7accc0cc27fdc5dea91a0 Mon Sep 17 00:00:00 2001 From: Qi Zhou Date: Wed, 19 Apr 2023 10:27:00 -0700 Subject: [PATCH 03/17] Update EIPS/eip-4804.md Co-authored-by: Sam Wilson <57262657+SamWilsn@users.noreply.github.com> --- EIPS/eip-4804.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/EIPS/eip-4804.md b/EIPS/eip-4804.md index 50a81cd08a4265..46cc889d30ade6 100644 --- a/EIPS/eip-4804.md +++ b/EIPS/eip-4804.md @@ -53,7 +53,13 @@ where ### Resolve Mode -Once the "To" address and chainid are determined, the protocol will check the resolver mode of contract by calling "resolveMode() returns (bytes32)" method. The protocol currently supports two resolve modes: +Once the "To" address and chainid are determined, the protocol will check the resolver mode of contract by calling the `resolveMode` method of the "To" address. The Solidity signature of `resolveMode` is: + +```solidity +function resolveMode() external returns (bytes32); +``` + +The protocol currently supports two resolve modes: auto and manual. #### Manual Mode From 8073a0fd27724b4535927b46928051a8d61d2fd5 Mon Sep 17 00:00:00 2001 From: Qi Zhou Date: Wed, 19 Apr 2023 11:38:23 -0700 Subject: [PATCH 04/17] Update eip-4804.md --- EIPS/eip-4804.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/EIPS/eip-4804.md b/EIPS/eip-4804.md index 46cc889d30ade6..f1ccc7cb293a49 100644 --- a/EIPS/eip-4804.md +++ b/EIPS/eip-4804.md @@ -61,9 +61,13 @@ function resolveMode() external returns (bytes32); The protocol currently supports two resolve modes: auto and manual. +- The `resolveMode` return value indicating manual mode MUST be `0x6d616e75616c0000000000000000000000000000000000000000000000000000`, i.e., "manual" in bytes32; or +- The `resolveMode` return value indicating auto mode MUST be either `0x6175746f00000000000000000000000000000000000000000000000000000000`, i.e, "auto" in bytes32, `0x0000000000000000000000000000000000000000000000000000000000000000`, or throwing an error from the contract; or +- Otherwise, the protocol will fail to the request with error "unsupported resolve mode". + #### Manual Mode -The manual mode will not do any interpretation of **path** and **query**, and put **path** [ "?" **query** ] as the calldata of the message directly. +The manual mode will not do any interpretation of path and query, with the exception of the determination of MIME type based on the suffix of the path, and put path [ "?" query ] as calldata of the message directly. #### Auto Mode @@ -80,7 +84,7 @@ The auto mode is the default mode to resolve (also applies when the "resolveMode Note that if **method** does not exist, i.e., **path** is empty or "/", then the contract will be called with empty calldata. -- **returns** attribute in **query** tells the format of the returned data. If not specified, the returned message data will be treated in ABI-type "(bytes)" and the decoded bytes will be returned to the frontend. The MIME will be set based on the suffix of the last argument. If **returns** is "()", the returned data will be parsed in raw bytes in JSON format. Otherwise, the returned message data will be parsed in the specified **returns** attribute in JSON format. If multiple **returns** attributes are present, the value of the last **returns** attribute will be applied. Note that **returnTypes** is the alias of **returns**, but it is not recommended to use and is mainly for backward-compatible purpose. +- **returns** attribute in **query** tells the format of the returned data. If not specified, the returned message data will be treated in ABI-type "(bytes)" and the decoded bytes will be returned to the frontend. The MIME will be set based on the suffix of the last argument or if there is no argument, the suffix of the method. If **returns** is "()", the returned data will be parsed in raw bytes in JSON format. Otherwise, the returned message data will be parsed in the specified **returns** attribute in JSON format. If multiple **returns** attributes are present, the value of the last **returns** attribute will be applied. Note that **returnTypes** is the alias of **returns**, but it is not recommended to use and is mainly for backward-compatible purpose. ### Examples From 6a64db6c77bcd165ee0d85ec61238c8af2f3f423 Mon Sep 17 00:00:00 2001 From: nand Date: Tue, 10 Oct 2023 09:41:25 +0200 Subject: [PATCH 05/17] Revert EIP-4804 to original, copy it to EIP-6860 prior to modifications. --- EIPS/eip-4804.md | 52 ++++------------- EIPS/eip-6860.md | 147 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 157 insertions(+), 42 deletions(-) create mode 100644 EIPS/eip-6860.md diff --git a/EIPS/eip-4804.md b/EIPS/eip-4804.md index f1ccc7cb293a49..4a86e99ee83a78 100644 --- a/EIPS/eip-4804.md +++ b/EIPS/eip-4804.md @@ -53,21 +53,11 @@ where ### Resolve Mode -Once the "To" address and chainid are determined, the protocol will check the resolver mode of contract by calling the `resolveMode` method of the "To" address. The Solidity signature of `resolveMode` is: - -```solidity -function resolveMode() external returns (bytes32); -``` - -The protocol currently supports two resolve modes: auto and manual. - -- The `resolveMode` return value indicating manual mode MUST be `0x6d616e75616c0000000000000000000000000000000000000000000000000000`, i.e., "manual" in bytes32; or -- The `resolveMode` return value indicating auto mode MUST be either `0x6175746f00000000000000000000000000000000000000000000000000000000`, i.e, "auto" in bytes32, `0x0000000000000000000000000000000000000000000000000000000000000000`, or throwing an error from the contract; or -- Otherwise, the protocol will fail to the request with error "unsupported resolve mode". +Once the "To" address and chainid are determined, the protocol will check the resolver mode of contract by calling "resolveMode" method. The protocol currently supports two resolve modes: #### Manual Mode -The manual mode will not do any interpretation of path and query, with the exception of the determination of MIME type based on the suffix of the path, and put path [ "?" query ] as calldata of the message directly. +The manual mode will not do any interpretation of **path** and **query**, and put **path** [ "?" **query** ] as the calldata of the message directly. #### Auto Mode @@ -84,29 +74,17 @@ The auto mode is the default mode to resolve (also applies when the "resolveMode Note that if **method** does not exist, i.e., **path** is empty or "/", then the contract will be called with empty calldata. -- **returns** attribute in **query** tells the format of the returned data. If not specified, the returned message data will be treated in ABI-type "(bytes)" and the decoded bytes will be returned to the frontend. The MIME will be set based on the suffix of the last argument or if there is no argument, the suffix of the method. If **returns** is "()", the returned data will be parsed in raw bytes in JSON format. Otherwise, the returned message data will be parsed in the specified **returns** attribute in JSON format. If multiple **returns** attributes are present, the value of the last **returns** attribute will be applied. Note that **returnTypes** is the alias of **returns**, but it is not recommended to use and is mainly for backward-compatible purpose. +- **returns** attribute in **query** tells the format of the returned data. If not specified, the returned message data will be parsed in "(bytes32)" and MIME will be set based on the suffix of the last argument. If **returns** is "()", the returned data will be parsed in raw bytes in JSON. Otherwise, the returned message will be parsed in the specified **returns** attribute in JSON. If multiple **returns** attributes are present, the value of the last **returns** attribute will be applied. Note that **returnTypes** is the alias of **returns**, but it is not recommended to use and is mainly for backward-compatible purpose. ### Examples -#### Example 1a +#### Example 1 ``` web3://w3url.eth/ ``` -where the contract of **w3url.eth** is in manual mode. - -The protocol will find the address of **w3url.eth** from ENS in chainid 1 (Mainnet). Then the protocol will call the address with "Calldata" = `keccak("resolveMode()")[0:4]` = "0xDD473FAE", which returns "manual" in ABI-type "(bytes32)". After determining the manual mode of the contract, the protocol will call the address with "To" = **contractAddress** and "Calldata" = "0x2F". The returned data will be treated as ABI-type "(bytes)", and the decoded bytes will be returned to the frontend. - -#### Example 1b - -``` -web3://w3url.eth/ -``` - -where the contract of **w3url.eth** is in auto mode. - -The protocol will find the address of **w3url.eth** from ENS in chainid 1 (Mainnet). Then the protocol will call the address with "Calldata" = `keccak("resolveMode()")[0:4]` = "0xDD473FAE", which returns "", i.e., the contract is in auto mode. After determining the auto mode of the contract, the protocol will call the address with "To" = **contractAddress** and "Calldata" = "". The returned data will be treated as ABI-type "(bytes)", and the decoded bytes will be returned to the frontend. +The protocol will find the address of **w3url.eth** from ENS in chainid 1 (Mainnet), and then the protocol will call the address with "From" = "0x..." and "Calldata" = "0x2F". #### Example 2 @@ -114,9 +92,7 @@ The protocol will find the address of **w3url.eth** from ENS in chainid 1 (Mainn web3://cyberbrokers-meta.eth/renderBroker/9999 ``` -where the contract of **cyberbrokers-meta.eth** is in auto mode. - -The protocol will find the address of **cyberbrokers-meta.eth** from ENS on chainid 1 (Mainnet). Then the protocol will call the address with "Calldata" = `keccak("resolveMode()")[0:4]` = "0xDD473FAE", which returns "", i.e., the contract is in auto mode. After determining the auto mode of the contract, the protocol will call the address with "To" = **contractAddress** and "Calldata" = "0x" + `keccak("renderBroker(uint256)")[0:4] + abi.encode(uint256(9999))`. The returned data will be treated as ABI-type "(bytes)", and the decoded bytes will be returned to the frontend. +The protocol will find the address of **cyberbrokers-meta.eth** from ENS on chainid 1 (Mainnet), and then call the address with "To" = "0x..." and "Calldata" = "0x" + `keccak("view(uint256)")[0:4] + abi.encode(uint256(9999))`. #### Example 3 @@ -124,9 +100,7 @@ The protocol will find the address of **cyberbrokers-meta.eth** from ENS on chai web3://vitalikblog.eth:5/ ``` -where the contract of **vitalikblog.eth:5** is in manual mode. - -The protocol will find the address of **vitalikblog.eth** from ENS on chainid 5 (Goerli). Then after determing the contract is in manual mode, the protocol will call the address with "To" = **contractAddress** and "Calldata" = "0x2F" with chainid = 5. The returned data will be treated as ABI-type "(bytes)", and the decoded bytes will be returned to the frontend. +The protocol will find the address of **vitalikblog.eth** from ENS on chainid 5 (Goerli), and then call the address with "From" = "0x..." and "Calldata" = "0x2F" with chainid = 5. #### Example 4 @@ -134,9 +108,7 @@ The protocol will find the address of **vitalikblog.eth** from ENS on chainid 5 web3://0xe4ba0e245436b737468c206ab5c8f4950597ab7f:42170/ ``` -where the contract "0xe4ba0e245436b737468c206ab5c8f4950597ab7f:42170" is in manual mode. - -After determing the contract is in manual mode, the protocol will call the address with "To" = "0xe4ba0e245436b737468c206ab5c8f4950597ab7f" and "Calldata" = "0x2F" with chainid = 42170 (Arbitrum Nova). The returned data will be treated as ABI-type "(bytes)", and the decoded bytes will be returned to the frontend. +The protocol will call the address with "To" = "0x9e081Df45E0D167636DB9C61C7ce719A58d82E3b" and "Calldata" = "0x" with chainid = 42170 (Arbitrum Nova). #### Example 5 @@ -144,9 +116,7 @@ After determing the contract is in manual mode, the protocol will call the addre web3://0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/balanceOf/vitalik.eth?returns=(uint256) ``` -where the contract "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" is in auto mode. - -The protocol will find the addresses of **vitalik.eth** from ENS on chainid 1 (Mainnet) and then call the method "balanceOf(address)" of the contract with the **vitalik.eth**'s address. The returned data from the call of the contract will be treated as ABI-type "(uint256)", and the decoded data will be returned to the frontend in JSON format like `[ "10000000000000" ]`. +The protocol will find the addresses of **vitalik.eth** from ENS on chainid 1 (Mainnet) and then call the method "balanceOf(address)" of the contract with the **charles.eth**'s address. The returned data will be parsed as uint256 like `[ "10000000000000" ]`. #### Example 6 @@ -154,9 +124,7 @@ The protocol will find the addresses of **vitalik.eth** from ENS on chainid 1 (M web3://0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/balanceOf/vitalik.eth?returns=() ``` -where the contract ”0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48“ is in auto mode. - -The protocol will find the address of **vitalik.eth** from ENS on chainid 1 (Mainnet) and then call the method "balanceOf(address)" of the address. The returned data from the call of the contract will be parsed as raw bytes in JSON format like `["0x000000000000000000000000000000000000000000000000000009184e72a000"]`. +The protocol will find the address of **vitalik.eth** from ENS on chainid 1 (Mainnet) and then call the method "balanceOf(address)" of the address. The returned data will be parsed as raw bytes like `["0x000000000000000000000000000000000000000000000000000009184e72a000"]`. ## Rationale diff --git a/EIPS/eip-6860.md b/EIPS/eip-6860.md new file mode 100644 index 00000000000000..4a86e99ee83a78 --- /dev/null +++ b/EIPS/eip-6860.md @@ -0,0 +1,147 @@ +--- +eip: 4804 +title: Web3 URL to EVM Call Message Translation +description: A translation of an HTTP-style Web3 URL to an EVM call message +author: Qi Zhou (@qizhou), Chao Pi (@pichaoqkc), Sam Wilson (@SamWilsn) +discussions-to: https://ethereum-magicians.org/t/eip-4804-web3-url-to-evm-call-message-translation/8300 +status: Final +type: Standards Track +category: ERC +created: 2022-02-14 +requires: 137 +--- + +## Abstract + +This standard translates an RFC 2396 URI like `web3://uniswap.eth/` to an EVM message such as: + +``` +EVMMessage { + To: 0xaabbccddee.... // where uniswap.eth's address registered at ENS + Calldata: 0x + ... +} +``` + +## Motivation + +Currently, reading data from Web3 generally relies on a translation done by a Web2 proxy to Web3 blockchain. The translation is mostly done by the proxies such as dApp websites/node service provider/etherscan, which are out of the control of users. The standard here aims to provide a simple way for Web2 users to directly access the content of Web3, especially on-chain Web contents such as SVG/HTML. Moreover, this standard enables interoperability with other standards already compatible with URIs, like SVG/HTML. + +## Specification + +This specification only defines read-only (i.e. Solidity's `view` functions) semantics. State modifying functions may be defined as a future extension. + +A Web3 URL is in the following form + +``` +web3URL = web3Schema [userinfo "@"] contractName [":" chainid] path ["?" query] +web3Schema = [ "ethereum-web3://" | "eth-web3://" | "web3://" ] +contractName = address | [name "." [ subDomain0 "." ... ]] nsProviderSuffix +path = ["/" method ["/" argument_0 ["/" argument_1 ... ]]] +argument = [type "!"] value +query = "attribute_1=value_1 [ "&" attribute_2=value_2 ... ] +attribute = "returns" | "returnTypes" | other_attribute +``` + +where + +- **web3Schema** indicates the schema of the URL, which is `web3://` or `w3://` for short. +- **userinfo** indicates which user is calling the EVM, i.e., "From" field in EVM call message. If not specified, the protocol will use 0x0 as the sender address. +- **contractName** indicates the contract to be called, i.e., "To" field in the EVM call message. If the **contractName** is an **address**, i.e., 0x + 20-byte-data hex, then "To" will be the address. Otherwise, the name is from a name service. In the second case, **nsProviderSuffix** will be the suffix from name service providers such as "eth", etc. The way to translate the name from a name service to an address will be discussed in later EIPs. +- **chainid** indicates which chain to resolve **contractName** and call the message. If not specified, the protocol will use the same chain as the name service provider, e.g., 1 for eth. If no name service provider is available, the default chainid is 1. +- **query** is an optional component containing a sequence of attribute-value pairs separated by "&". + +### Resolve Mode + +Once the "To" address and chainid are determined, the protocol will check the resolver mode of contract by calling "resolveMode" method. The protocol currently supports two resolve modes: + +#### Manual Mode + +The manual mode will not do any interpretation of **path** and **query**, and put **path** [ "?" **query** ] as the calldata of the message directly. + +#### Auto Mode + +The auto mode is the default mode to resolve (also applies when the "resolveMode" method is unavailable in the target contract). In the auto mode, if **path** is empty, then the protocol will call the target contract with empty calldata. Otherwise, the calldata of the EVM message will use standard Solidity contract ABI, where + +- **method** is a string of function method be called +- **argument_i** is the ith argument of the method. If **type** is specified, the value will be translated to the corresponding type. The protocol currently supports the basic types such as uint256, bytes32, address, bytes, and string. If **type** is not specified, then the type will be automatically detected using the following rule in a sequential way: + +1. **type**="uint256", if **value** is numeric; or +2. **type**="bytes32", if **value** is in the form of 0x+32-byte-data hex; or +3. **type**="address", if **value** is in the form of 0x+20-byte-data hex; or +4. **type**="bytes", if **value** is in the form of 0x followed by any number of bytes besides 20 or 32; or +5. else **type**="address" and parse the argument as a domain name in the form of `[name "." [ subDomain0 "." ... ]] nsProviderSuffix`. In this case, the actual value of the argument will be obtained from **nsProviderSuffix**, e.g., eth. If **nsProviderSuffix** is not supported, an unsupported NS provider error will be returned. + +Note that if **method** does not exist, i.e., **path** is empty or "/", then the contract will be called with empty calldata. + +- **returns** attribute in **query** tells the format of the returned data. If not specified, the returned message data will be parsed in "(bytes32)" and MIME will be set based on the suffix of the last argument. If **returns** is "()", the returned data will be parsed in raw bytes in JSON. Otherwise, the returned message will be parsed in the specified **returns** attribute in JSON. If multiple **returns** attributes are present, the value of the last **returns** attribute will be applied. Note that **returnTypes** is the alias of **returns**, but it is not recommended to use and is mainly for backward-compatible purpose. + +### Examples + +#### Example 1 + +``` +web3://w3url.eth/ +``` + +The protocol will find the address of **w3url.eth** from ENS in chainid 1 (Mainnet), and then the protocol will call the address with "From" = "0x..." and "Calldata" = "0x2F". + +#### Example 2 + +``` +web3://cyberbrokers-meta.eth/renderBroker/9999 +``` + +The protocol will find the address of **cyberbrokers-meta.eth** from ENS on chainid 1 (Mainnet), and then call the address with "To" = "0x..." and "Calldata" = "0x" + `keccak("view(uint256)")[0:4] + abi.encode(uint256(9999))`. + +#### Example 3 + +``` +web3://vitalikblog.eth:5/ +``` + +The protocol will find the address of **vitalikblog.eth** from ENS on chainid 5 (Goerli), and then call the address with "From" = "0x..." and "Calldata" = "0x2F" with chainid = 5. + +#### Example 4 + +``` +web3://0xe4ba0e245436b737468c206ab5c8f4950597ab7f:42170/ +``` + +The protocol will call the address with "To" = "0x9e081Df45E0D167636DB9C61C7ce719A58d82E3b" and "Calldata" = "0x" with chainid = 42170 (Arbitrum Nova). + +#### Example 5 + +``` +web3://0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/balanceOf/vitalik.eth?returns=(uint256) +``` + +The protocol will find the addresses of **vitalik.eth** from ENS on chainid 1 (Mainnet) and then call the method "balanceOf(address)" of the contract with the **charles.eth**'s address. The returned data will be parsed as uint256 like `[ "10000000000000" ]`. + +#### Example 6 + +``` +web3://0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/balanceOf/vitalik.eth?returns=() +``` + +The protocol will find the address of **vitalik.eth** from ENS on chainid 1 (Mainnet) and then call the method "balanceOf(address)" of the address. The returned data will be parsed as raw bytes like `["0x000000000000000000000000000000000000000000000000000009184e72a000"]`. + +## Rationale + +The purpose of the proposal is to add a decentralized presentation layer for Ethereum. With the layer, we are able to render any web content (including HTML/CSS/JPG/PNG/SVG, etc) on-chain using human-readable URLs, and thus EVM can be served as decentralized Backend. The design of the standard is based on the following principles: + +- **Human-readable**. The Web3 URL should be easily recognized by human similar to Web2 URL (`http://`). As a result, we support names from name services to replace address for better readability. In addition, instead of using calldata in hex, we use human-readable method + arguments and translate them to calldata for better readability. + +- **Maximum-Compatible with HTTP-URL standard**. The Web3 URL should be compatible with HTTP-URL standard including relative pathing, query, fragment, etc so that the support of existing HTTP-URL (e.g., by browser) can be easily extended to Web3 URL with minimal modification. This also means that existing Web2 users can easily migrate to Web3 with minimal extra knowledge of this standard. + +- **Simple**. Instead of providing explicit types in arguments, we use a "maximum likelihood" principle of auto-detecting the types of the arguments such as address, bytes32, and uint256. This could greatly minimize the length of URL, while avoiding confusion. In addition, explicit types are also supported to clear the confusion if necessary. + +- **Flexible**. The contract is able to override the encoding rule so that the contract has fine-control of understanding the actual Web resources that the users want to locate. + +## Security Considerations + +No security considerations were found. + +## Copyright + +Copyright and related rights waived via [CC0](../LICENSE.md). From e689e74bc49eb03c62072b7e6f30e09f06262e9b Mon Sep 17 00:00:00 2001 From: nand Date: Tue, 10 Oct 2023 10:19:28 +0200 Subject: [PATCH 06/17] ERC-6860: Changes vs ERC-4804 --- EIPS/eip-6860.md | 131 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 106 insertions(+), 25 deletions(-) diff --git a/EIPS/eip-6860.md b/EIPS/eip-6860.md index 4a86e99ee83a78..53c58db6578e1b 100644 --- a/EIPS/eip-6860.md +++ b/EIPS/eip-6860.md @@ -1,13 +1,13 @@ --- -eip: 4804 +eip: 6860 title: Web3 URL to EVM Call Message Translation description: A translation of an HTTP-style Web3 URL to an EVM call message author: Qi Zhou (@qizhou), Chao Pi (@pichaoqkc), Sam Wilson (@SamWilsn) discussions-to: https://ethereum-magicians.org/t/eip-4804-web3-url-to-evm-call-message-translation/8300 -status: Final +status: Draft type: Standards Track category: ERC -created: 2022-02-14 +created: 2023-09-29 requires: 137 --- @@ -22,6 +22,7 @@ EVMMessage { ... } ``` +⚠️ This proposal updates EIP-4804 with minor corrections, clarifications and modifications. ## Motivation @@ -31,11 +32,11 @@ Currently, reading data from Web3 generally relies on a translation done by a We This specification only defines read-only (i.e. Solidity's `view` functions) semantics. State modifying functions may be defined as a future extension. -A Web3 URL is in the following form +A Web3 URL is an ASCII string in the following form ``` web3URL = web3Schema [userinfo "@"] contractName [":" chainid] path ["?" query] -web3Schema = [ "ethereum-web3://" | "eth-web3://" | "web3://" ] +web3Schema = [ "w3://" | "web3://" ] contractName = address | [name "." [ subDomain0 "." ... ]] nsProviderSuffix path = ["/" method ["/" argument_0 ["/" argument_1 ... ]]] argument = [type "!"] value @@ -53,38 +54,91 @@ where ### Resolve Mode -Once the "To" address and chainid are determined, the protocol will check the resolver mode of contract by calling "resolveMode" method. The protocol currently supports two resolve modes: +Once the "To" address and chainid are determined, the protocol will check the resolver mode of contract by calling the `resolveMode` method of the "To" address. The Solidity signature of `resolveMode` is: + +```solidity +function resolveMode() external returns (bytes32); +``` + +The protocol currently supports two resolve modes: auto and manual. + +- The manual mode will be used if the `resolveMode` return value is `0x6d616e75616c0000000000000000000000000000000000000000000000000000`, i.e., "manual" in bytes32 +- The auto mode will be used if : + - the `resolveMode` return value is `0x6175746f00000000000000000000000000000000000000000000000000000000`, i.e, "auto" in bytes32, or + - the `resolveMode` return value is `0x0000000000000000000000000000000000000000000000000000000000000000`, or + - the call to `resolveMode` throws an error (method not implemented or error thrown from the method) +- Otherwise, the protocol will fail to the request with error "unsupported resolve mode". #### Manual Mode -The manual mode will not do any interpretation of **path** and **query**, and put **path** [ "?" **query** ] as the calldata of the message directly. +The manual mode will use ``path [ "?" query ]`` as calldata of the message directly. Path cannot be empty and must be at least ``/``. + +The returned message data will be treated as ABI-encoded bytes and the decoded bytes will be returned to the frontend. + +The MIME type returned to the frontend is ``text/html`` by default, but will be overriden if the **path** has a filename extension suffix : +``` +path = path_part [ "." filename_extension ] +``` +In this case, the MIME type will be deduced from the filename extension. #### Auto Mode -The auto mode is the default mode to resolve (also applies when the "resolveMode" method is unavailable in the target contract). In the auto mode, if **path** is empty, then the protocol will call the target contract with empty calldata. Otherwise, the calldata of the EVM message will use standard Solidity contract ABI, where +In the auto mode, if **path** is empty or "/", then the protocol will call the target contract with empty calldata. Otherwise, the calldata of the EVM message will use standard Solidity contract ABI, where + +- **method** is a string of the function method to be called +- **argument_i** is the i-th argument of the method. If **type** is specified, the value will be translated to the corresponding type. The protocol currently supports these basic types: bool, int, uint, int<X>, uint<X> (with X ranging from 8 to 256 in steps of 8), address, bytes<X> (with X ranging from 1 to 32), bytes, and string. If **type** is not specified, then the type will be automatically detected using the following rule in a sequential way: + 1. **type**="uint256", if **value** is numeric; or + 2. **type**="bytes32", if **value** is in the form of 0x+32-byte-data hex; or + 3. **type**="address", if **value** is in the form of 0x+20-byte-data hex; or + 4. **type**="bytes", if **value** is in the form of 0x followed by any number of bytes besides 20 or 32; or + 5. else **type**="address" and parse the argument as a domain name in the form of `[name "." [ subDomain0 "." ... ]] nsProviderSuffix`. In this case, the actual value of the argument will be obtained from **nsProviderSuffix**, e.g., eth. If **nsProviderSuffix** is not supported, an unsupported NS provider error will be returned. + + The format of **value** should be : + - If **type** is "string", then **value** is URI-percent-encoded (RFC 3986) for all non-ASCII characters and for the following characters: ``!``, ``/``, ``?``, ``%``. + - If **type** is "bool", then **value** must be either ``true`` or ``false``. + - If **type** is "bytes<X>" or "bytes", then **value** must be in hexadecimal form prefixed by "0x". + - If **type** is "address", then **value** is either in hedadecimal form prefixed by "0x", or a domain name string. + +- **returns** attribute in **query** tells the format of the returned data. Its value syntax is : + ``` + value = ["(" [types] ")"] + types = type_1 [ "," type_2 ... ] + type = basic_type [ "[]" [ "[]" ... ] | "[size]" [ "[size_2]" ... ] ] + ``` + ``basic_type`` can be any of the types listed as supported as argument. + - If the **returns** attribute is undefined or empty, the returned message data will be treated as ABI-encoded bytes and the decoded bytes will be returned to the frontend. The MIME type returned to the frontend will be undefined by default, but will be overriden if the last argument has a filename extension : + ``` + last_argument = last_argument_part [ "." filename_extension ] + ``` + - If **returns** is equal to "()", the raw bytes of the returned message data will be returned, encoded as a "0x"-prefixed hex string in an array in JSON format: ``["0xXXXXX"]`` + - Otherwise, the returned message data will be ABI-decoded in the data types specified in the **returns** value and encoded in JSON format. The encoding of the data will follow the Ethereum JSON-RPC format: + - Unformatted data (bytes, address) will be encoded as hex, prefixed with "0x", two hex digits per byte + - Quantities (integers) will be encoded as hex, prefix with "0x", the most compact representation (slight exception: zero should be represented as "0x0") + - Boolean and strings will be native JSON boolean and strings + + If multiple **returns** attributes are present, the value of the last **returns** attribute will be applied. Note that **returnTypes** is the alias of **returns**, but it is not recommended to use and is mainly for ERC-4804 backward-compatible purpose. -- **method** is a string of function method be called -- **argument_i** is the ith argument of the method. If **type** is specified, the value will be translated to the corresponding type. The protocol currently supports the basic types such as uint256, bytes32, address, bytes, and string. If **type** is not specified, then the type will be automatically detected using the following rule in a sequential way: +### Examples -1. **type**="uint256", if **value** is numeric; or -2. **type**="bytes32", if **value** is in the form of 0x+32-byte-data hex; or -3. **type**="address", if **value** is in the form of 0x+20-byte-data hex; or -4. **type**="bytes", if **value** is in the form of 0x followed by any number of bytes besides 20 or 32; or -5. else **type**="address" and parse the argument as a domain name in the form of `[name "." [ subDomain0 "." ... ]] nsProviderSuffix`. In this case, the actual value of the argument will be obtained from **nsProviderSuffix**, e.g., eth. If **nsProviderSuffix** is not supported, an unsupported NS provider error will be returned. +#### Example 1a -Note that if **method** does not exist, i.e., **path** is empty or "/", then the contract will be called with empty calldata. +``` +web3://w3url.eth/ +``` -- **returns** attribute in **query** tells the format of the returned data. If not specified, the returned message data will be parsed in "(bytes32)" and MIME will be set based on the suffix of the last argument. If **returns** is "()", the returned data will be parsed in raw bytes in JSON. Otherwise, the returned message will be parsed in the specified **returns** attribute in JSON. If multiple **returns** attributes are present, the value of the last **returns** attribute will be applied. Note that **returnTypes** is the alias of **returns**, but it is not recommended to use and is mainly for backward-compatible purpose. +where the contract of **w3url.eth** is in manual mode. -### Examples +The protocol will find the address of **w3url.eth** from ENS in chainid 1 (Mainnet). Then the protocol will call the address with "Calldata" = `keccak("resolveMode()")[0:4]` = "0xDD473FAE", which returns "manual" in ABI-type "(bytes32)". After determining the manual mode of the contract, the protocol will call the address with "To" = **contractAddress** and "Calldata" = "0x2F". The returned data will be treated as ABI-type "(bytes)", and the decoded bytes will be returned to the frontend, with the information that the MIME type is ``text/html``. -#### Example 1 +#### Example 1b ``` web3://w3url.eth/ ``` -The protocol will find the address of **w3url.eth** from ENS in chainid 1 (Mainnet), and then the protocol will call the address with "From" = "0x..." and "Calldata" = "0x2F". +where the contract of **w3url.eth** is in auto mode. + +The protocol will find the address of **w3url.eth** from ENS in chainid 1 (Mainnet). Then the protocol will call the address with "Calldata" = `keccak("resolveMode()")[0:4]` = "0xDD473FAE", which returns "", i.e., the contract is in auto mode. After determining the auto mode of the contract, the protocol will call the address with "To" = **contractAddress** and "Calldata" = "". The returned data will be treated as ABI-type "(bytes)", and the decoded bytes will be returned to the frontend, with the information that the MIME type is undefined. #### Example 2 @@ -92,7 +146,9 @@ The protocol will find the address of **w3url.eth** from ENS in chainid 1 (Mainn web3://cyberbrokers-meta.eth/renderBroker/9999 ``` -The protocol will find the address of **cyberbrokers-meta.eth** from ENS on chainid 1 (Mainnet), and then call the address with "To" = "0x..." and "Calldata" = "0x" + `keccak("view(uint256)")[0:4] + abi.encode(uint256(9999))`. +where the contract of **cyberbrokers-meta.eth** is in auto mode. + +The protocol will find the address of **cyberbrokers-meta.eth** from ENS on chainid 1 (Mainnet). Then the protocol will call the address with "Calldata" = `keccak("resolveMode()")[0:4]` = "0xDD473FAE", which returns "", i.e., the contract is in auto mode. After determining the auto mode of the contract, the protocol will call the address with "To" = **contractAddress** and "Calldata" = "0x" + `keccak("renderBroker(uint256)")[0:4] + abi.encode(uint256(9999))`. The returned data will be treated as ABI-type "(bytes)", and the decoded bytes will be returned to the frontend, with the information that the MIME type is undefined. #### Example 3 @@ -100,7 +156,9 @@ The protocol will find the address of **cyberbrokers-meta.eth** from ENS on chai web3://vitalikblog.eth:5/ ``` -The protocol will find the address of **vitalikblog.eth** from ENS on chainid 5 (Goerli), and then call the address with "From" = "0x..." and "Calldata" = "0x2F" with chainid = 5. +where the contract of **vitalikblog.eth:5** is in manual mode. + +The protocol will find the address of **vitalikblog.eth** from ENS on chainid 5 (Goerli). Then after determing the contract is in manual mode, the protocol will call the address with "To" = **contractAddress** and "Calldata" = "0x2F" with chainid = 5. The returned data will be treated as ABI-type "(bytes)", and the decoded bytes will be returned to the frontend, with the information that the MIME type is ``text/html``. #### Example 4 @@ -108,7 +166,9 @@ The protocol will find the address of **vitalikblog.eth** from ENS on chainid 5 web3://0xe4ba0e245436b737468c206ab5c8f4950597ab7f:42170/ ``` -The protocol will call the address with "To" = "0x9e081Df45E0D167636DB9C61C7ce719A58d82E3b" and "Calldata" = "0x" with chainid = 42170 (Arbitrum Nova). +where the contract "0xe4ba0e245436b737468c206ab5c8f4950597ab7f:42170" is in manual mode. + +After determing the contract is in manual mode, the protocol will call the address with "To" = "0xe4ba0e245436b737468c206ab5c8f4950597ab7f" and "Calldata" = "0x2F" with chainid = 42170 (Arbitrum Nova). The returned data will be treated as ABI-type "(bytes)", and the decoded bytes will be returned to the frontend, with the information that the MIME type is ``text/html``. #### Example 5 @@ -116,7 +176,9 @@ The protocol will call the address with "To" = "0x9e081Df45E0D167636DB9C61C7ce71 web3://0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/balanceOf/vitalik.eth?returns=(uint256) ``` -The protocol will find the addresses of **vitalik.eth** from ENS on chainid 1 (Mainnet) and then call the method "balanceOf(address)" of the contract with the **charles.eth**'s address. The returned data will be parsed as uint256 like `[ "10000000000000" ]`. +where the contract "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" is in auto mode. + +The protocol will find the addresses of **vitalik.eth** from ENS on chainid 1 (Mainnet) and then call the method "balanceOf(address)" of the contract with the **vitalik.eth**'s address. The returned data from the call of the contract will be treated as ABI-type "(uint256)", and the decoded data will be returned to the frontend in JSON format like `[ "0x9184e72a000" ]`, with the information that the MIME type is ``application/json``. #### Example 6 @@ -124,7 +186,9 @@ The protocol will find the addresses of **vitalik.eth** from ENS on chainid 1 (M web3://0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/balanceOf/vitalik.eth?returns=() ``` -The protocol will find the address of **vitalik.eth** from ENS on chainid 1 (Mainnet) and then call the method "balanceOf(address)" of the address. The returned data will be parsed as raw bytes like `["0x000000000000000000000000000000000000000000000000000009184e72a000"]`. +where the contract ”0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48“ is in auto mode. + +The protocol will find the address of **vitalik.eth** from ENS on chainid 1 (Mainnet) and then call the method "balanceOf(address)" of the address. The returned data from the call of the contract will be treated as raw bytes and will be encoded in JSON format like `["0x000000000000000000000000000000000000000000000000000009184e72a000"]` and returned to the frontend, with the information that the MIME type is ``application/json``. ## Rationale @@ -142,6 +206,23 @@ The purpose of the proposal is to add a decentralized presentation layer for Eth No security considerations were found. +## Changes versus ERC-4804 + +Corrections +- Manual mode : ERC-4804 stipulates that there is no interpretation of the path [ "?" query ]. This ERC indicates that there is in fact an interpretation of the path, for MIME type determination purpose. +- Auto mode : If there is no **returns** attribute in **query**, ERC-4804 stipulates that the returned data is treated as ABI-encoded bytes32. This ERC indicates that in fact the returned data is treated as ABI-encoded bytes. + +Clarifications +- URL format: This ERC indicates that the URL should be in ASCII format. +- Resolve mode: This ERC indicates more details on how the resolve mode is determined. +- Manual mode : This ERC indicates how to deal with the return data, and how the MIME type is determined. +- Auto mode : This ERC indicates in more details the encoding of the argument values, as well as the format and handling of the **returns** value. +- Examples : This ERC add more details to the examples. + +Modifications +- Protocol name: ERC-4804 mentionned ``ethereum-web3://`` and ``eth-web3://``, these are removed. +- Auto mode: Supported types: ERC-4804 supported only uint256, bytes32, address, bytes, and string. This ERC add more types. + ## Copyright Copyright and related rights waived via [CC0](../LICENSE.md). From 740de6ea54ef315dc2bd6705a03b5e667b09fdcb Mon Sep 17 00:00:00 2001 From: nand Date: Tue, 10 Oct 2023 10:40:56 +0200 Subject: [PATCH 07/17] ERC-6860: Fix lint warnings. --- EIPS/eip-6860.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/EIPS/eip-6860.md b/EIPS/eip-6860.md index 53c58db6578e1b..05c5d284c4e545 100644 --- a/EIPS/eip-6860.md +++ b/EIPS/eip-6860.md @@ -22,7 +22,7 @@ EVMMessage { ... } ``` -⚠️ This proposal updates EIP-4804 with minor corrections, clarifications and modifications. +⚠️ This proposal updates [ERC-4804](./eip-4804.md) with minor corrections, clarifications and modifications. ## Motivation @@ -116,7 +116,7 @@ In the auto mode, if **path** is empty or "/", then the protocol will call the t - Quantities (integers) will be encoded as hex, prefix with "0x", the most compact representation (slight exception: zero should be represented as "0x0") - Boolean and strings will be native JSON boolean and strings - If multiple **returns** attributes are present, the value of the last **returns** attribute will be applied. Note that **returnTypes** is the alias of **returns**, but it is not recommended to use and is mainly for ERC-4804 backward-compatible purpose. + If multiple **returns** attributes are present, the value of the last **returns** attribute will be applied. Note that **returnTypes** is the alias of **returns**, but it is not recommended to use and is mainly for [ERC-4804](./eip-4804.md) backward-compatible purpose. ### Examples @@ -190,6 +190,23 @@ where the contract ”0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48“ is in auto m The protocol will find the address of **vitalik.eth** from ENS on chainid 1 (Mainnet) and then call the method "balanceOf(address)" of the address. The returned data from the call of the contract will be treated as raw bytes and will be encoded in JSON format like `["0x000000000000000000000000000000000000000000000000000009184e72a000"]` and returned to the frontend, with the information that the MIME type is ``application/json``. +### Changes versus [ERC-4804](./eip-4804.md) + +Corrections +- Manual mode : [ERC-4804](./eip-4804.md) stipulates that there is no interpretation of the path [ "?" query ]. This ERC indicates that there is in fact an interpretation of the path, for MIME type determination purpose. +- Auto mode : If there is no **returns** attribute in **query**, [ERC-4804](./eip-4804.md) stipulates that the returned data is treated as ABI-encoded bytes32. This ERC indicates that in fact the returned data is treated as ABI-encoded bytes. + +Clarifications +- URL format: This ERC indicates that the URL should be in ASCII format. +- Resolve mode: This ERC indicates more details on how the resolve mode is determined. +- Manual mode : This ERC indicates how to deal with the return data, and how the MIME type is determined. +- Auto mode : This ERC indicates in more details the encoding of the argument values, as well as the format and handling of the **returns** value. +- Examples : This ERC add more details to the examples. + +Modifications +- Protocol name: [ERC-4804](./eip-4804.md) mentionned ``ethereum-web3://`` and ``eth-web3://``, these are removed. +- Auto mode: Supported types: [ERC-4804](./eip-4804.md) supported only uint256, bytes32, address, bytes, and string. This ERC add more types. + ## Rationale The purpose of the proposal is to add a decentralized presentation layer for Ethereum. With the layer, we are able to render any web content (including HTML/CSS/JPG/PNG/SVG, etc) on-chain using human-readable URLs, and thus EVM can be served as decentralized Backend. The design of the standard is based on the following principles: @@ -206,23 +223,6 @@ The purpose of the proposal is to add a decentralized presentation layer for Eth No security considerations were found. -## Changes versus ERC-4804 - -Corrections -- Manual mode : ERC-4804 stipulates that there is no interpretation of the path [ "?" query ]. This ERC indicates that there is in fact an interpretation of the path, for MIME type determination purpose. -- Auto mode : If there is no **returns** attribute in **query**, ERC-4804 stipulates that the returned data is treated as ABI-encoded bytes32. This ERC indicates that in fact the returned data is treated as ABI-encoded bytes. - -Clarifications -- URL format: This ERC indicates that the URL should be in ASCII format. -- Resolve mode: This ERC indicates more details on how the resolve mode is determined. -- Manual mode : This ERC indicates how to deal with the return data, and how the MIME type is determined. -- Auto mode : This ERC indicates in more details the encoding of the argument values, as well as the format and handling of the **returns** value. -- Examples : This ERC add more details to the examples. - -Modifications -- Protocol name: ERC-4804 mentionned ``ethereum-web3://`` and ``eth-web3://``, these are removed. -- Auto mode: Supported types: ERC-4804 supported only uint256, bytes32, address, bytes, and string. This ERC add more types. - ## Copyright Copyright and related rights waived via [CC0](../LICENSE.md). From d3472895a63d2f0e3e57662d82b65a8d8e618244 Mon Sep 17 00:00:00 2001 From: nand Date: Tue, 10 Oct 2023 10:47:38 +0200 Subject: [PATCH 08/17] ERC-6860: Fix lint warnings. --- EIPS/eip-6860.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/EIPS/eip-6860.md b/EIPS/eip-6860.md index 05c5d284c4e545..524225bdbd9a8a 100644 --- a/EIPS/eip-6860.md +++ b/EIPS/eip-6860.md @@ -22,6 +22,7 @@ EVMMessage { ... } ``` + ⚠️ This proposal updates [ERC-4804](./eip-4804.md) with minor corrections, clarifications and modifications. ## Motivation @@ -76,9 +77,11 @@ The manual mode will use ``path [ "?" query ]`` as calldata of the message direc The returned message data will be treated as ABI-encoded bytes and the decoded bytes will be returned to the frontend. The MIME type returned to the frontend is ``text/html`` by default, but will be overriden if the **path** has a filename extension suffix : + ``` path = path_part [ "." filename_extension ] ``` + In this case, the MIME type will be deduced from the filename extension. #### Auto Mode @@ -100,16 +103,20 @@ In the auto mode, if **path** is empty or "/", then the protocol will call the t - If **type** is "address", then **value** is either in hedadecimal form prefixed by "0x", or a domain name string. - **returns** attribute in **query** tells the format of the returned data. Its value syntax is : + ``` value = ["(" [types] ")"] types = type_1 [ "," type_2 ... ] type = basic_type [ "[]" [ "[]" ... ] | "[size]" [ "[size_2]" ... ] ] ``` + ``basic_type`` can be any of the types listed as supported as argument. - If the **returns** attribute is undefined or empty, the returned message data will be treated as ABI-encoded bytes and the decoded bytes will be returned to the frontend. The MIME type returned to the frontend will be undefined by default, but will be overriden if the last argument has a filename extension : + ``` last_argument = last_argument_part [ "." filename_extension ] ``` + - If **returns** is equal to "()", the raw bytes of the returned message data will be returned, encoded as a "0x"-prefixed hex string in an array in JSON format: ``["0xXXXXX"]`` - Otherwise, the returned message data will be ABI-decoded in the data types specified in the **returns** value and encoded in JSON format. The encoding of the data will follow the Ethereum JSON-RPC format: - Unformatted data (bytes, address) will be encoded as hex, prefixed with "0x", two hex digits per byte @@ -192,18 +199,21 @@ The protocol will find the address of **vitalik.eth** from ENS on chainid 1 (Mai ### Changes versus [ERC-4804](./eip-4804.md) -Corrections +#### Corrections + - Manual mode : [ERC-4804](./eip-4804.md) stipulates that there is no interpretation of the path [ "?" query ]. This ERC indicates that there is in fact an interpretation of the path, for MIME type determination purpose. - Auto mode : If there is no **returns** attribute in **query**, [ERC-4804](./eip-4804.md) stipulates that the returned data is treated as ABI-encoded bytes32. This ERC indicates that in fact the returned data is treated as ABI-encoded bytes. -Clarifications +#### Clarifications + - URL format: This ERC indicates that the URL should be in ASCII format. - Resolve mode: This ERC indicates more details on how the resolve mode is determined. - Manual mode : This ERC indicates how to deal with the return data, and how the MIME type is determined. - Auto mode : This ERC indicates in more details the encoding of the argument values, as well as the format and handling of the **returns** value. - Examples : This ERC add more details to the examples. -Modifications +#### Modifications + - Protocol name: [ERC-4804](./eip-4804.md) mentionned ``ethereum-web3://`` and ``eth-web3://``, these are removed. - Auto mode: Supported types: [ERC-4804](./eip-4804.md) supported only uint256, bytes32, address, bytes, and string. This ERC add more types. From 066b3319da55e46dbd89a2323d7ce492dd7027e4 Mon Sep 17 00:00:00 2001 From: nand Date: Tue, 10 Oct 2023 13:33:47 +0200 Subject: [PATCH 09/17] ERC-6860: More clarifications on URI-percent-encoding. --- EIPS/eip-6860.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/EIPS/eip-6860.md b/EIPS/eip-6860.md index 524225bdbd9a8a..8fd35ada56c63f 100644 --- a/EIPS/eip-6860.md +++ b/EIPS/eip-6860.md @@ -53,6 +53,8 @@ where - **chainid** indicates which chain to resolve **contractName** and call the message. If not specified, the protocol will use the same chain as the name service provider, e.g., 1 for eth. If no name service provider is available, the default chainid is 1. - **query** is an optional component containing a sequence of attribute-value pairs separated by "&". +All non-ASCII characters must be encoded with URI percent-encoding (RFC 3986). + ### Resolve Mode Once the "To" address and chainid are determined, the protocol will check the resolver mode of contract by calling the `resolveMode` method of the "To" address. The Solidity signature of `resolveMode` is: @@ -72,7 +74,7 @@ The protocol currently supports two resolve modes: auto and manual. #### Manual Mode -The manual mode will use ``path [ "?" query ]`` as calldata of the message directly. Path cannot be empty and must be at least ``/``. +The manual mode will use the raw ``path [ "?" query ]`` as calldata of the message directly (no URI-percent-encoding decoding will be done). Path cannot be empty and must be at least ``/``. The returned message data will be treated as ABI-encoded bytes and the decoded bytes will be returned to the frontend. @@ -208,7 +210,7 @@ The protocol will find the address of **vitalik.eth** from ENS on chainid 1 (Mai - URL format: This ERC indicates that the URL should be in ASCII format. - Resolve mode: This ERC indicates more details on how the resolve mode is determined. -- Manual mode : This ERC indicates how to deal with the return data, and how the MIME type is determined. +- Manual mode : This ERC indicates how to deal with URI-percent-encoding, the return data, and how the MIME type is determined. - Auto mode : This ERC indicates in more details the encoding of the argument values, as well as the format and handling of the **returns** value. - Examples : This ERC add more details to the examples. From 3924322e25ae0dc3813e662785bfdab0352e4d44 Mon Sep 17 00:00:00 2001 From: nand Date: Tue, 10 Oct 2023 14:17:12 +0200 Subject: [PATCH 10/17] ERC-6860: Add in the modification section information about the change of encoding of integers in auto mode. --- EIPS/eip-6860.md | 1 + 1 file changed, 1 insertion(+) diff --git a/EIPS/eip-6860.md b/EIPS/eip-6860.md index 8fd35ada56c63f..3e93b81b1b0af8 100644 --- a/EIPS/eip-6860.md +++ b/EIPS/eip-6860.md @@ -218,6 +218,7 @@ The protocol will find the address of **vitalik.eth** from ENS on chainid 1 (Mai - Protocol name: [ERC-4804](./eip-4804.md) mentionned ``ethereum-web3://`` and ``eth-web3://``, these are removed. - Auto mode: Supported types: [ERC-4804](./eip-4804.md) supported only uint256, bytes32, address, bytes, and string. This ERC add more types. +- Auto mode: Encoding of returned integers when a **returns** attribute is specified: [ERC-4804](./eip-4804.md) suggested in example 5 to encode integers as strings. This ERC indicates to follow the ethereum JSON RPC spec and encode integers as a hex string, prefix with "0x". ## Rationale From 9c57f98eaf10d82f3a7c240663a8eea48d12befe Mon Sep 17 00:00:00 2001 From: nand Date: Tue, 10 Oct 2023 16:30:03 +0200 Subject: [PATCH 11/17] ERC-6860: Auto mode: bytes type: Clarify the length of the argument value. --- EIPS/eip-6860.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EIPS/eip-6860.md b/EIPS/eip-6860.md index 3e93b81b1b0af8..68c250de90d459 100644 --- a/EIPS/eip-6860.md +++ b/EIPS/eip-6860.md @@ -101,7 +101,7 @@ In the auto mode, if **path** is empty or "/", then the protocol will call the t The format of **value** should be : - If **type** is "string", then **value** is URI-percent-encoded (RFC 3986) for all non-ASCII characters and for the following characters: ``!``, ``/``, ``?``, ``%``. - If **type** is "bool", then **value** must be either ``true`` or ``false``. - - If **type** is "bytes<X>" or "bytes", then **value** must be in hexadecimal form prefixed by "0x". + - If **type** is "bytes<X>" or "bytes", then **value** must be in hexadecimal form prefixed by "0x". If X is specified, then **value** must be made of 2 + 2 * X chars. - If **type** is "address", then **value** is either in hedadecimal form prefixed by "0x", or a domain name string. - **returns** attribute in **query** tells the format of the returned data. Its value syntax is : From 74e02e0d522d5e491988e3f82c9ae7f6494a08ff Mon Sep 17 00:00:00 2001 From: nand2 Date: Thu, 12 Oct 2023 08:40:52 +0200 Subject: [PATCH 12/17] Update EIPS/eip-6860.md Co-authored-by: Qi Zhou --- EIPS/eip-6860.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EIPS/eip-6860.md b/EIPS/eip-6860.md index 68c250de90d459..d39de56a479ebb 100644 --- a/EIPS/eip-6860.md +++ b/EIPS/eip-6860.md @@ -70,7 +70,7 @@ The protocol currently supports two resolve modes: auto and manual. - the `resolveMode` return value is `0x6175746f00000000000000000000000000000000000000000000000000000000`, i.e, "auto" in bytes32, or - the `resolveMode` return value is `0x0000000000000000000000000000000000000000000000000000000000000000`, or - the call to `resolveMode` throws an error (method not implemented or error thrown from the method) -- Otherwise, the protocol will fail to the request with error "unsupported resolve mode". +- Otherwise, the protocol will fail the request with the error "unsupported resolve mode". #### Manual Mode From 01f3d2d309e79268f01895b9ead0fd70c71e4e51 Mon Sep 17 00:00:00 2001 From: nand2 Date: Thu, 12 Oct 2023 08:42:40 +0200 Subject: [PATCH 13/17] Update EIPS/eip-6860.md Co-authored-by: Qi Zhou --- EIPS/eip-6860.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EIPS/eip-6860.md b/EIPS/eip-6860.md index d39de56a479ebb..9dc05a670e90f9 100644 --- a/EIPS/eip-6860.md +++ b/EIPS/eip-6860.md @@ -99,7 +99,7 @@ In the auto mode, if **path** is empty or "/", then the protocol will call the t 5. else **type**="address" and parse the argument as a domain name in the form of `[name "." [ subDomain0 "." ... ]] nsProviderSuffix`. In this case, the actual value of the argument will be obtained from **nsProviderSuffix**, e.g., eth. If **nsProviderSuffix** is not supported, an unsupported NS provider error will be returned. The format of **value** should be : - - If **type** is "string", then **value** is URI-percent-encoded (RFC 3986) for all non-ASCII characters and for the following characters: ``!``, ``/``, ``?``, ``%``. + - If **type** is "string", then **value** is URI-percent-encoded for all characters except unreserved characters defined in RFC 3986. - If **type** is "bool", then **value** must be either ``true`` or ``false``. - If **type** is "bytes<X>" or "bytes", then **value** must be in hexadecimal form prefixed by "0x". If X is specified, then **value** must be made of 2 + 2 * X chars. - If **type** is "address", then **value** is either in hedadecimal form prefixed by "0x", or a domain name string. From 2457b065bf10b74176b4ed1e3d3f5d05d7856abb Mon Sep 17 00:00:00 2001 From: nand2 Date: Thu, 12 Oct 2023 08:43:02 +0200 Subject: [PATCH 14/17] Update EIPS/eip-6860.md Co-authored-by: Qi Zhou --- EIPS/eip-6860.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EIPS/eip-6860.md b/EIPS/eip-6860.md index 9dc05a670e90f9..74a2d01d86a07e 100644 --- a/EIPS/eip-6860.md +++ b/EIPS/eip-6860.md @@ -218,7 +218,7 @@ The protocol will find the address of **vitalik.eth** from ENS on chainid 1 (Mai - Protocol name: [ERC-4804](./eip-4804.md) mentionned ``ethereum-web3://`` and ``eth-web3://``, these are removed. - Auto mode: Supported types: [ERC-4804](./eip-4804.md) supported only uint256, bytes32, address, bytes, and string. This ERC add more types. -- Auto mode: Encoding of returned integers when a **returns** attribute is specified: [ERC-4804](./eip-4804.md) suggested in example 5 to encode integers as strings. This ERC indicates to follow the ethereum JSON RPC spec and encode integers as a hex string, prefix with "0x". +- Auto mode: Encoding of returned integers when a **returns** attribute is specified: [ERC-4804](./eip-4804.md) suggested in example 5 to encode integers as strings. This ERC indicates to follow the Ethereum JSON RPC spec and encode integers as a hex string, prefixed with "0x". ## Rationale From e4eb876b6fae1cc9e5ba33e298be9c704b600feb Mon Sep 17 00:00:00 2001 From: nand2 Date: Thu, 12 Oct 2023 08:43:22 +0200 Subject: [PATCH 15/17] Update EIPS/eip-6860.md Co-authored-by: Qi Zhou --- EIPS/eip-6860.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EIPS/eip-6860.md b/EIPS/eip-6860.md index 74a2d01d86a07e..1ab66e1816f40f 100644 --- a/EIPS/eip-6860.md +++ b/EIPS/eip-6860.md @@ -226,7 +226,7 @@ The purpose of the proposal is to add a decentralized presentation layer for Eth - **Human-readable**. The Web3 URL should be easily recognized by human similar to Web2 URL (`http://`). As a result, we support names from name services to replace address for better readability. In addition, instead of using calldata in hex, we use human-readable method + arguments and translate them to calldata for better readability. -- **Maximum-Compatible with HTTP-URL standard**. The Web3 URL should be compatible with HTTP-URL standard including relative pathing, query, fragment, etc so that the support of existing HTTP-URL (e.g., by browser) can be easily extended to Web3 URL with minimal modification. This also means that existing Web2 users can easily migrate to Web3 with minimal extra knowledge of this standard. +- **Maximum-Compatible with HTTP-URL standard**. The Web3 URL should be compatible with HTTP-URL standard including relative pathing, query, fragment, percent-encoding, etc so that the support of existing HTTP-URL (e.g., by browser) can be easily extended to Web3 URL with minimal modification. This also means that existing Web2 users can easily migrate to Web3 with minimal extra knowledge of this standard. - **Simple**. Instead of providing explicit types in arguments, we use a "maximum likelihood" principle of auto-detecting the types of the arguments such as address, bytes32, and uint256. This could greatly minimize the length of URL, while avoiding confusion. In addition, explicit types are also supported to clear the confusion if necessary. From 5572ee86b7b32f47b2cee4dac2a611b07e1c78bc Mon Sep 17 00:00:00 2001 From: nand2 Date: Thu, 12 Oct 2023 08:43:50 +0200 Subject: [PATCH 16/17] Update EIPS/eip-6860.md Co-authored-by: Qi Zhou --- EIPS/eip-6860.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EIPS/eip-6860.md b/EIPS/eip-6860.md index 1ab66e1816f40f..38876bb94489e2 100644 --- a/EIPS/eip-6860.md +++ b/EIPS/eip-6860.md @@ -222,7 +222,7 @@ The protocol will find the address of **vitalik.eth** from ENS on chainid 1 (Mai ## Rationale -The purpose of the proposal is to add a decentralized presentation layer for Ethereum. With the layer, we are able to render any web content (including HTML/CSS/JPG/PNG/SVG, etc) on-chain using human-readable URLs, and thus EVM can be served as decentralized Backend. The design of the standard is based on the following principles: +The purpose of the proposal is to add a decentralized presentation layer for Ethereum. With the layer, we are able to render any web content (including HTML/CSS/JPG/PNG/SVG, etc) on-chain using human-readable URLs, and thus EVM can be served as a decentralized backend. The design of the standard is based on the following principles: - **Human-readable**. The Web3 URL should be easily recognized by human similar to Web2 URL (`http://`). As a result, we support names from name services to replace address for better readability. In addition, instead of using calldata in hex, we use human-readable method + arguments and translate them to calldata for better readability. From cec1561220c1e55dffeb4f34dc3b5c046c3d9dec Mon Sep 17 00:00:00 2001 From: nand Date: Thu, 12 Oct 2023 09:47:43 +0200 Subject: [PATCH 17/17] ERC-6860: Formalize the percent-encoding rules. --- EIPS/eip-6860.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/EIPS/eip-6860.md b/EIPS/eip-6860.md index 38876bb94489e2..30f7b2fe49574f 100644 --- a/EIPS/eip-6860.md +++ b/EIPS/eip-6860.md @@ -53,7 +53,12 @@ where - **chainid** indicates which chain to resolve **contractName** and call the message. If not specified, the protocol will use the same chain as the name service provider, e.g., 1 for eth. If no name service provider is available, the default chainid is 1. - **query** is an optional component containing a sequence of attribute-value pairs separated by "&". -All non-ASCII characters must be encoded with URI percent-encoding (RFC 3986). +The URL must be encoded with URI percent-encoding (RFC 3968) with rules very similar to the RFC. Per component, the rules are : +- **userinfo** : Identical to **userinfo** as defined in RFC 3986 Appendix A. +- **contractName** : Identical to **reg-name** as defined in RFC 3986 Appendix A. +- **chainid** : Identical to **port** as defined in RFC 3986 Appendix A. +- **path** : Identical to **path-abempty** as defined in RFC 3986 Appendix A, except the character "!" that needs to be percent-encoded. +- **query** : Identical to **query** as defined in RFC 3986 Appendix A. ### Resolve Mode @@ -99,7 +104,6 @@ In the auto mode, if **path** is empty or "/", then the protocol will call the t 5. else **type**="address" and parse the argument as a domain name in the form of `[name "." [ subDomain0 "." ... ]] nsProviderSuffix`. In this case, the actual value of the argument will be obtained from **nsProviderSuffix**, e.g., eth. If **nsProviderSuffix** is not supported, an unsupported NS provider error will be returned. The format of **value** should be : - - If **type** is "string", then **value** is URI-percent-encoded for all characters except unreserved characters defined in RFC 3986. - If **type** is "bool", then **value** must be either ``true`` or ``false``. - If **type** is "bytes<X>" or "bytes", then **value** must be in hexadecimal form prefixed by "0x". If X is specified, then **value** must be made of 2 + 2 * X chars. - If **type** is "address", then **value** is either in hedadecimal form prefixed by "0x", or a domain name string.