FIP-4: ENS Usernames #90
Replies: 4 comments 7 replies
-
Farcaster is designed so that users can use any namespace of their choice in clients. ENS names are one of the supported namespaces and Warpcast resolves them in messages. However, a lot of client backend work was needed to support this translation. Supporting ENS to fid resolution in Hubs could make this a lot easier for clients. Hub ChangesA Hub maintains a “valid ENS set” for each fid, where an ENS is valid for an fid if
Hubs change the verification logic on the Hubs expose an API that returns the valid ENS set for each fid. Hubs expose an API that returns the fid associated with a given ENS. Client ChangesClients already monitor the
MiscThis proposal will not support:
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
A problem with the approach above is that ENS names aren't always owned by the address that they resolve to. For example, wrapping an ENS to make it a valid 1155 can result in the wrapper contract being the owner, while the "resolved address" is the user's address. The best approach is likely to use the "two-way resolution" process either with text records or with addresses. For the sake of thoroughness a one-way resolution system is also described. 1. Two-Way Text Record ResolutionThe most reliable way to associate an ENS Name with a Farcaster ID is:
The downside of this approach is that setting a text record may be an on-chain activity that costs money, and requires users to leave Farcaster app to configure it. Off-chain resolvers may also be unreliable or unreachable resulting in invalidated ENS names and requiring logic to handle retries. L2 resolvers also require hubs to maintain direct connections to the L2 or use some kind of proxy. 2. Two-Way Address ResolutionAnother approach is to:
This approach is slightly better than the above, because it requires setting no new record and relies on address verification which we already encourage people to do to show off NFT's and on-chain activity. 3. One-Way ResolutionAn alternate approach is to just support unwrapped .ETH 2LD's like The main benefit is that users never need to interact with their ENS resolver. The downsides are:
|
Beta Was this translation helpful? Give feedback.
-
I prefer the Two-Way Address Resolution method. Giving it a try but not yet resolving. |
Beta Was this translation helpful? Give feedback.
-
Title: ENS Usernames
Type: Implementation FIP
Authors: @sanjay, @sds, @v, @horsefacts
Abstract
Farcaster supports ENS names issued on on-chain or off-chain. User can choose between free, off-chain ENS names (fnames) or on-chain decentralized ENS names, making registration less expensive and much faster. Applications can rely on Hubs to validate ownership of ENS names and let them know when ownership changes.
Problem
Farcasters issues human-readable usernames called fnames which can be used in applications. New users must make two on-chain transactions to acquire the name, and sign an off-chain message to instruct apps to use this name as their preferred name.
There are a few problems with this system:
We want to design a system that is:
Specification
We propose a two-tier naming system where users can choose between:
Overview
Users can own many types of ENS names in their custody and verified addresses, including L1 names and off-chain names. Users can prove ownership of these names to a Hub by submitting a
UsernameProof
message and select a primary name by submitting aUSER_DATA.USERNAME
message, which applications should respect.Off-Chain ENS Names (Fnames)
Fnames are free, ENS-compliant names that are issued to all users who own an fid. They are issued under the fcast.id ENS namespace using CCIP by a server operated by the Farcaster team. Applications should prefix off-chain names with an
@
and can truncate the domain name for brevity — e.g.@username
instead of@username.fcast.id
.On-Chain ENS Names
ENS names owned on Ethereum L1 can be used as valid Farcaster usernames as long as they meet certain criteria for length and characters used. Applications should prefix ENS usernames with a
@
like@username.eth
and while preserving the TLD label to avoid collisions.Managing Usernames
Hubs keep track of valid usernames for a given user and emit events when ownership of usernames change. This makes it easy for applications to quickly determine what the correct username is without having to write their own resolvers.
Fname Specification
ENS CCIP Contract
A CCIP ENSIP-10 contract will be deployed on L1 which resolves *.fcast.id names to owner addresses. It stores the URL of the nameserver and validates signatures provided by the nameserver. This resolver will support addr record lookups only. The address of the contract is ______ (to be filled on deployment).
Name Server
The server which resolves
*.fcast.id
names lives atfnames.facaster.xyz
. Fnames can be claimed by submitting an EIP-712 signed message that proves ownership of an fid that does not yet have an fname. The server also provides a method to transfer fnames to other fids by proving ownership of the fname.Usernames are also valid subdomains (e.g. foo.fcast.id ) though they do not currently resolve to anything. A future upgrade to the nameserver may allow the owner to set a redirect record here. The following usernames are not available for registration, since they collide with existing subdomains —
www
,fnames
Managing Fname Ownership
A POST request to the
/transfers
endpoint can be made register, move or deregister a username. The request body must contain :The request is rejected unless it meets the following criteria:
/^[a-z0-9][a-z0-9-]{0,15}$/
.2419200
seconds (28 days) ahead of that timestamp to prevent abuse. i.e. an fid can only change their name once every 28 daysThe domain and types for the EIP-712 signature are described below:
Verifying Fname Ownership
Anyone can verify that a user requested verification of a name by making a call to the server. usrs can make a GET request to
/transfers
which returns a paginated list of events with the following schema:Results can be filtered with these query string parameters:
Nameserver Keypair
The nameserver maintains its own ECDSA keypair to counter-sign messages or perform administrative actions. The
server_signature
will be signed by this key. The public key used to perform these signers can be fetched by performing a GET on/signer
which returns:Hub Modifications
Hubs must keep track of valid usernames proofs and a user’s preferred usernames. They must also continuously re-validate ownership of the username and gossip state to each other. They also expose APIs and emit events with the state of those names change.
UserData Message
USER_DATA.FNAME
type is renamed toUSER_DATA.USERNAME
UserDataAddBody
validation logic forUSER_DATA.USERNAME
must validate that a Username Proof exists for this username and this fid, otherwise the message is not accepted.If no value is set for the username, applications should default to showing the display name, profile picture and fid to represent that user.
Username Proof Message
A Username Proof demonstrates that a user owns a particular ENS name. The proof is established by creating a signature from an Ethereum address or Farcaster Signer along with additional metadata about the name and Farcaster user.
A
UsernameProofBody
VerificationRemoveBody in a messagem
is valid only if it passes these validations:timestamp
must be ≤ 10 mins ahead of current timefid
must be the fid that is claiming ownership of the nameIf the type is
ENS_FNAME:
name
must match the regular expression/^[a-z0-9][a-z0-9-]{0,15}$/
.owner
must be the custody address of the fid.signature
must be a valid ECDSA signature on the EIP-712 Username Proof message from the owner or the public key of the fname server, which is used for administrative actions.If the type is
ENS_L1
:name
must be a valid ENS name.eth
owner
owner
./^[a-z0-9][a-z0-9-]{0,15}$/
.owner
must be a valid eth address.owner
signature
must be a valid EIP-712 Username Proof signatureUsernameProof CRDT
The UsernameProof CRDT validates and accepts UsernameProof messages. The CRDT also ensures that a UsernameProof message
m
passes these validations:m.signer
must be a valid Signer in the add-set of the Signer CRDT formessage.fid
A conflict occurs if two messages that have the same value for
m.name
. Conflicts are resolved with the following rules:m.data.timestamp
values are distinct, discard the message with the lower timestamp.m.data.timestamp
values are identical, discard the message with the lower fidThe UsernameProof CRDT has a per-user size limit of 10.
Events
A
MergeUsernameProofBody
must be emitted whenever a new name is merged into the CRDT.API’s
Hubs must expose a
GetUsernameProof
endpoint which returns a proof associated with a username.Gossip Changes
Hubs must gossip all messages of type
USRENAME_TYPE_ENS_L1
but not messages of typeUSERNAME_TYPE_ENS_FNAME
.Name Validation Sync
A job is run periodically at 2am UTC to revalidate the ownership of all ENS L1 names and Fnames, and revokes
USER_DATA.USERNAME
messages if they aren’t correctly owned.Release
Off-chain name changes will be included as part of the
2023.7.12
protocol upgrade but the changes are backwards compatible and Hubs can safely launch the updates ahead of this date, but all Hubs must launch the update by this date.The protocol will then transition from mirroring the contract to requiring registrations to go through the fname server instead:
UserDataType.FNAME
against UserNameProof instead of NameRegistryEvent, though registration of fnames will still happen through the contract (patch release again)UserDataType.FNAME
will be renamed toUserDataType.USERNAME
andHubEventType.MERGE_NAME_REGISTRY_EVENT
will no longer be emitted (migrate toHubEventType.MERGE_USERNAME_PROOF
)Once this feature is live, and all hubs are upgraded, when a new
UserDataAdd
message of typeUSER_DATA_TYPE_USERNAME
is submitted, the hub will fetch the UserNameProof for the username and only merge the message if a valid proof exists matching the current custody address of the fid submitting the message. At this point, NameRegistryEvents are deprecated.Appendix: Fname Ownership Policy
Usernames are free to register and governed by a simple policy that prevents squatting and impersonation. The policy has two tenets:
@google
)Conflicts that arise will be handled with human intervention from the core team, since isn’t a way to automate this. For instance, you register
@elon
and Elon Musk signs up after you and wants the name. In such a case, we would ask three questions that guide the decision:This policy is will evolve outside of the scope of this FIP, and the latest version will be hosted with the fname repository.
Beta Was this translation helpful? Give feedback.
All reactions