Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

ENS resolver for the DApp layer #58

Closed
pedroargento opened this issue May 30, 2023 · 19 comments
Closed

ENS resolver for the DApp layer #58

pedroargento opened this issue May 30, 2023 · 19 comments
Assignees
Labels
A-contracts Area: contracts T-feature Type: feature
Milestone

Comments

@pedroargento
Copy link

馃摎 Context

Allow DApps to interact with decentralized identities leveraging services like Ethereum Naming Service (ENS).

Decentralized identities allow users to take ownership of their identifications on chain without relying on centralized parties.

鉁旓笍 Solution

Build a Input Relay to inform the DApp about ENS domains and its related addresses, allowing the ENS domains to be used as identifiers on the DApp layer.

@ZzzzHui ZzzzHui self-assigned this Jun 7, 2023
@ZzzzHui ZzzzHui linked a pull request Jun 7, 2023 that will close this issue
@ZzzzHui ZzzzHui transferred this issue from cartesi/rollups Aug 30, 2023
@ZzzzHui ZzzzHui added T-feature Type: feature D-average A-contracts Area: contracts labels Aug 30, 2023
@tuler
Copy link
Member

tuler commented Aug 30, 2023

Keep in mind ENS supports changing names any time.
Just resolving a name and sending an input is dangerous, because the DApp will only have a vision from when the input was sent.

@ZzzzHui
Copy link
Contributor

ZzzzHui commented Aug 30, 2023

Agree!
ENS resolution is probably better to be done on the front end.

@xdaniortega
Copy link

Agree!
ENS resolution is probably better to be done on the front end.

Agree as well.

@guidanoli
Copy link
Collaborator

guidanoli commented Sep 5, 2023

So, here's an update of our view on this feature:

Relaying ENS name-address pairs to the execution layer is prone to leaving the DApp running in the execution layer with an outdated view of the registrar. Whenever an ENS name expires or is transferred to some other address, someone would need to inform the DApp running in the execution layer through an input.

To solve this problem, we let the DApp running on the execution layer store only the ENS name, and resolve it only on the base layer. Through the current version of vouchers, however, the resolution would occur in the context of the called address. We could shoehorn this feature by adding functions to CartesiDApp (like we did for ETH withdrawals), but we would like to avoid going in this direction, since it increases the bytecode code, and, therefore, the deployment cost of all DApps (even those that wouldn't even adopt ENS).

The ideal solution would be through DELEGATECALL vouchers, which are not yet implemented, and depend on the Output Unification. This instruction allows a contract to execute foreign code, while preserving context. This is exactly what we would need to resolve ENS names and perform subsequent calls still in the context of the DApp contract (like asset transfers).

In my opinion, the most thrilling application of ENS on Cartesi applications would be the ability to use an ENS name you own instead of your address to interact with DApps. More specifically, in games, you would be able to sell your account simply by selling your ENS name, instead of giving away your private key. The main differences are:

  • Private keys control base layer accounts: allows signing transaction, messages, etc.
  • ENS names control execution layer accounts: allows interacting with DApps registered with ENS names.
  • A private key can be known by multiple people: one cannot guarantee they are the only one to know it.
  • Each ENS name is owned by one person: this is guaranteed by ENS smart contracts.

@pedroargento
Copy link
Author

Just to complement @guidanoli update, the resolve on the base layer happens when adding an input. So inputs are added in the name of the ENS name, provided that the msg sender is its current owner.

Note that ENSInputRelay only cares about the owner of the ENS at the time an input is added. The consequences of the input will affect whomever owns the name in the future (at voucher execution, for example); from the DApp point of view, only the name exists and all history of inputs/outputs refers to this name ignoring any base layer ownership tranfers.

@tuler
Copy link
Member

tuler commented Sep 5, 2023

  1. the ability to use an ENS name you own instead of your address to interact with DApps.
  2. you would be able to sell your account simply by selling your ENS name, instead of giving away your private keys.

I didn't understand the correlation of these two statements.

You can already do (1). If you own a name you can just set the (forward) address of the name to the DApp address, and thus use the name instead of the address.

ps: reverse resolution, address to name, is a different story, subject of PR #70

I didn't understand what you mean in (2).
The ENS name is already a NFT. So you can transfer/sell just like an NFT. The owner of the name has the power of (1).

Maybe you are talking about making the DApp contract implement NFT (ERC-721)?

@pedroargento
Copy link
Author

@tuler I think you are talking about ENS owning a DApp. This discussion is about users of the DApp interacting as an ENS name instead of an address.

Lets say there is a DApp that is a game. I create the user xxxx.eth and play the game for a while. I now can decide to sell my game account, with all its history with respect to the DApp, through selling the xxxxx.eth ENS. This sale will include all future side effects of current unprocessed inputs. And I can do that without giving away my EOA private key.

@guidanoli
Copy link
Collaborator

guidanoli commented Sep 5, 2023

Sorry for the confusion, @tuler. There are two separate discussions going on related to ENS.

  1. The CartesiDApp contract having an ENS name (see feat: DApp ENS integration聽#70)
  2. DApp users being able to interact with a DApp through ENS names they own (no open PR yet)

@tuler
Copy link
Member

tuler commented Sep 5, 2023

I don't see the technical feasibility of integrating with L1 ENS for that.
You need a name resolving system inside the DApp (L2 ENS, not to be confused with THE ENS at https://ens.domains).

@tuler
Copy link
Member

tuler commented Sep 5, 2023

DApp users being able to interact with a DApp

Ok. It's because this sentence is very confusing.

@pedroargento
Copy link
Author

You dont need resolving inside the DApp. You only need resolving when adding inputs and when executing vouchers.

@tuler
Copy link
Member

tuler commented Sep 5, 2023

You dont need resolving inside the DApp. You only need resolving when adding inputs and when executing vouchers.

I mean, you can already do what you want by implementing a simple naming system in the DApp.
Your DApp can define the registration input to accept a name, like:

Register input: I want to register an account, and my username is "pedro"

In the DApp, you store that the msg_sender "0x123" is registering an account with username "pedro".

Later you Pedro (0x123) send another input for account transfer.

Account transfer input: I want to transfer my account "pedro" to user "0x345".

After that all inputs coming from 0x345 will have power over the "pedro" account.
And vouchers to pedro will go to 0x345.

@pedroargento
Copy link
Author

I suppose this is true, but ENS allows me to auction, sell, transfer the account in any platform that supports NFTs, both onchain and offchain. Its more composable and flexible to this outside the DApp.

Otherwise, we are putting the burden on the DApp developer to build a transfer system inside the DApp and it will not be compatible with names on other applications.

@xdaniortega
Copy link

xdaniortega commented Sep 5, 2023

I agree with @tuler that L2 ENS could have a good role here. I commented in the channel of our team the possibility to use a DID project deployed on Cartesi for this. (You could query a Cartesi DApp for the username of an address.)

@guidanoli
Copy link
Collaborator

Although a naming server in the execution layer may have its advantages, ENS may be more familiar to developers and, certainly, to users. Besides, there is a whole ecosystem around it, like marketplaces, libraries, etc.

@tuler
Copy link
Member

tuler commented Sep 5, 2023

Although a naming server in the execution layer may have its advantages, ENS may be more familiar to developers and, certainly, to users. Besides, there is a whole ecosystem around it, like marketplaces, libraries, etc.

I totally get the motivation. I just don't see how. Not without dehashing device.

@guidanoli
Copy link
Collaborator

I totally get the motivation. I just don't see how. Not without dehashing device.

We can hop on a call later if you want. :-)

@xdaniortega
Copy link

I totally get the motivation. I just don't see how. Not without dehashing device.

We can hop on a call later if you want. :-)

Ping me, I'll love to join.

@guidanoli guidanoli added this to the 2.0.0 milestone Sep 20, 2023
@guidanoli guidanoli removed a link to a pull request Sep 26, 2023
@guidanoli
Copy link
Collaborator

Shall we close this issue, given that we'll no longer be caching address-name pairs in the execution layer anymore?

@guidanoli guidanoli removed this from the 2.0.0 milestone Oct 5, 2023
@guidanoli guidanoli added this to the 3.0.0 milestone Oct 5, 2023
@ZzzzHui ZzzzHui closed this as completed Oct 9, 2023
@guidanoli guidanoli closed this as not planned Won't fix, can't repro, duplicate, stale Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-contracts Area: contracts T-feature Type: feature
Projects
Archived in project
Development

No branches or pull requests

5 participants