# A new home for our contracts Farcaster's identity layer comprises two contracts: a fully decentralized **Id Registry** and a moderated **Name Registry**. These contracts are on Goerli but must be deployed to a secure and stable network soon. Which one of the many L1 and L2's is the right home for our contracts? ### Requirements Farcaster Id Registry issues fids which are unique, numeric identifiers like `12398`. It is important that: - Registration is very affordable (< $1 in tx fees). - Ownership is fully decentralized and cannot be revoked. - Ownership is secure against motivated attackers. Farcaster Name Registry issues fnames which are unique, himan readable ERC-721s like `bob`. It is important that: - Registration is affordable (<$10 in tx fees) - Names cannot be duplicated (there is only one bob) - Assets exist on a chain with a liquid NFT marketplace Fnames, unlike fids, are governed and not fully decentrazlied and the security guarantees of the network matter less. ## Strategies ### 1. Use Eth L1 Ethereum L1 is secure and has liquid NFT marketplaces. The main downside is the gas costs, which are likely to make registrations unaffordable. ### 2. Use Eth L2 Ethereum L2's like Polygon, Optimism, Arbitrum handle transactions but don't have the robust security guarantees that the L1 does. This is a challenge for the Id Registry, which must be secure in the face of adversarial operators. All of them are working towards their own solutions (zkEVMs, fraud proofs etc), but they are not in production. ### 3. Use Eth L1 now, migrate to L2 later Launch on L1 and re-deploy the contracts on L2 once they meet our requirements. Farcaster will re-register all the fids and fnames exactly to their current owners to "seed" the initial state on the L2 to match the L1. The main problem is that it can be time consuming and expensive to migrate. Some L2's don't share the same keypairs making migrating state harder. There is also the inherent timing risk where L1 gets too expensive for registrations before a viable L2 emerges. *Extension*: instead of re-registering fids, we could just register future fids on the L2 and keep existing fids on the L1. ### 4. Use L2 for fnames, L1 for fids with path to L2 Launch the fnames on L2 and fids on L1. Since fnames are governed, its ok if the L2 has some security risk since that can be mitigated with governance controls. This keeps fname transaction fees very low for now. Fids can be migrated to the L2 at a later date when the security guarantees are sound. The main downside is that we might bet on the wrong L2 and this introduces additional complexity to hubs that are dependent on two chains. ### 5. Use L2 for fnames, multiple chains for fids Launch the fnames on an L2 (for reasons described previously) and launch an fid on L1 and an L2 chain. Hub would support identifies from both chains and delineate them like `fid:l1:1` vs `fid:l2:2`. The main downside is that it increases complexity significantly for the hubs and for users. It also has mixed security guarantees for identifies. ### 6. Use our own L2 Launch our own EVM L2 which has both the fid and fnames, periodically publishing state back to the L1 in a fully reconstructable manner. Any abuse of power by us can be countered by forking and restarting the contracts elsehwere. The upside is that this has very low costs of operation and a great user experience. The downside is that it is a lot of work to operate and true decentralization requires a lot of vigilance from the community to ensure the L2 doesn't "cheat". *Extension*: This could be a centralized server that packages and publishes state to an L1 periodically. But if the first server operated by Farcaster "cheats", no one would be trusted to operate another server. *Extension*: Have a contract that allows some sort of cheap, permissioned registration with the ability to degrade to regular, permissionless registration. Control of this contract could be handed to an independent party which provides overslight. ## Appendix: Gas Costs - Registering an fid costs ~50k gas. - Registering an fname costs ~90k gas.