Replies: 1 comment 1 reply
-
Shouldn't we keep the discussion in #154 ? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Proposal is deprecated in favor of #154.
Registry
The registry is a contract on NEAR blockchain that allows storing arbitrary information on chain, where each entry can be "endorsed" by one (or more) accounts on NEAR. The main goal of the registry is to allow each account/contract to provide extra information that is not available in the contract itself. Entries posted in the registry are endorsed by accounts, and this can be used by off-chain or on-chain tools to verify the validity of the data.
The main goal of the registry is to provide a secure and standard way for all contracts to expose information, that can be consumed by 3rd party tools.
Design
Each account can endorse entries of the type:
On addition to this information, it is also stored the account that is doing the endorsement and the number of times an account has modified the value for a fixed (scope, key) pair.
Use cases
Use Case 1: Account metadata
There are existing tools like the explorer and the wallet, that shows basic on chain information about contracts, tokens and accounts in general. However the information it can shows is limited, even if the author of the contract wants to show more information (like website, contact email or twitter hanlde of the project/author) there is currently no way this can be done in a trustless way (this is not done at all today).
But having access to this information is both useful for the user interacting with the contract, and the author of the contract.
The explorer can establish the following criteria:
If there is an entry in the registry with scope
"social"
and key"twitter"
, endorsed byaccount.near
, then when showing information foraccount.near
, there will be a link to the twitter page of this account, pointing to the value of this entry in the registry.It will be the same of several services defined by the explorer before hand, for example telegram:
The registry will provide an interface to iterate over all keys endorsed by a an account on a given scope, this way information can be discovered easily.
Contracts that can't endorse by themselves
There are some accounts that can't endorse entries in the registry by themselves. This is the case for example when a contract doesn't have any key associated with it.
In this case, applications using trusted processes can verify the information and endorse entries using a trusted account. The explorer team can use the account
official-explorer.near
, and endorse the entry:Notice this will require an endorsement from an account controlled by the explorer team, so it is up to them how and whom will be paying the fees for storage and gas.
Use Case 2: Custom bridged NFT/FT
The bridge allows moving assets from Ethereum to NEAR. However, the equivalent NEP-141 on NEAR has only vanilla features (transfers and withdrawals). NFT(ERC-721) or FT(ERC-20) that has custom features on ethereum, can't use them on NEAR. (*)
The proposed solution is to deploy the extended contract on NEAR with all the customs features. When tokens are sent to NEAR network, they are automatically swapped 1:1 between the vanilla contract and the extended contract.
To discover this contracts, and supports this swaps automatically from each contract (like rainbow-bridge), there will be an entry in the registry endorsed by
aurora
account with the format:This will tell each application that vanilla
nDAI
should be swapped forcustom_dai.near
on arrival, and treat this new contract as the realnDAI
. Aurora team is responsible in this case for doing the dilligence of reviewing and endorsing each account.Notice that other account can endorse differen keys/values, it is up to each application for trusting on each endorser.
(*) This is done this way, since we aim to have a trustless bridge, where anyone can move/deploy a token from Ethereum on NEAR, and custom implementations can't be trusted.
Use Case 3: Proposals acceptance / Signature collection
When there is proposal for a protocol upgrade, it is required that it is accepted by the majority of the nodes. The proposal can be stored in the registry, and can be automatically activated after more than 80% of all the validators endorsed it in the registry. So this contract can have a close role to consensus itself.
Notice this is not limited to consensus/on-chain proposals. But also for proposals off-chain, DAOs, or in real live signature collection.
Pseudo code
Basic implementation of registry.
Note: official-registry.near was saved in case we decide to use it, but a different account can be used as well.
Nonces
For each tuple
(scope, key, account_id)
there will be a nonce associated with it indicating how many time the entry has been modified so far. This nonce will increase each time the value changes, or the endorsement is removed. The nonce can be used to detect if a value has potentially changed since the last time it was retrieved.Security
Upgrades
Upgrades shouldn't be necessary. There are two major scenarios where upgrades can be required:
New interface to access the data
We should brainstorm different use cases of this registry, so efficient interfaces for accessing data is available on-chain. This is important for other contracts and off-chain tools that can't afford downloading the whole state of the contract.
Bug in the contract
Contract should be simple enough so it is easy to audit, and determine bugs are not present.
Economics
There is no economic model around this contract. No fee will be charged, and no deposit will be accepted on function calls, other than 1 yoctoNEAR for tx that requires signatures in the wallet.
Storage management
Each user/application is responsible for depositing enough balance to pay for storage. In general the registry will accept donations for paying for storage, though should be notice that this can be easily abused by accounts endorsing useless entries.
Other features
Beta Was this translation helpful? Give feedback.
All reactions