---
# System prepended metadata

title: farcaster.frame.degenchain

---

# Enhancing DegenChain with Verified Frame Interactions

> Disclaimer: please note that this proposal is just an idea currently at an early conceptual stage.

Frames are becoming a central piece to the Farcaster ecosystem, an expanding technology platform. The Degen Chain, developed by the Farcaster community, supports the Degen ecosystem operating on a EVM compatible network, based on Arbitrum Orbit. On this proposal we aim to further merge both ecosystems.

Integrating Frames with Degen Chain opens a new realm of possibilities for both the DegenChain and Farcaster communities. 

- **Increase Security:** By verifying frame packages directly on the blockchain, we ensure all interactions are trustless and tamper-proof.
- **Expand Functionality:** Enabling complex operations like token transfers, voting, and gaming to be managed securely and efficiently through Frames.
- **Enhance User Experience:** Users can interact with smart contracts seamlessly without needing external wallet integrations, simplifying processes and reducing barriers to entry.

We propose the development of a Precompiled Verifier for Frame packages on the Degen Chain. This verifier will allow the EVM chain to serve as a backend for Frames, enabling secure interactions with any deployed smart contract.

## Frame Packages
Frame packages are Protobuf-signed messages that capture user interactions, such as button presses or text inputs. These packages are secured using ED25519 keys, which are held by Farcaster clients. The keys, or signers, are registered on the Optimism network within a smart contract that links Farcaster IDs to their corresponding signers.

## Implementation Steps

1. **Key Registry Extraction**: First, extract information from the Optimism network's KeyRegistry smart contract and construct an offchain Merkle tree. The Merkle root, a 32-byte data element, will be updated and transmitted to the Degen Chain by an Oracle, ideally every hour, to accommodate new keys and users.

2. **Adding Precompiles**: Given that DegenChain is based on Arbitrum Orbit, it facilitates the addition of new precompiles written in Go. We will develop a precompile that fetches the Protobuf serialized content of a Frame package and verifies it using the KeyRegistry Merkle-Root provided by the Oracle.

3. **VerifyFrame Function**: The new precompile will introduce a `VerifyFrame()` function to the DegenChain EVM. This function will allow any smart contract to extract and validate a Frame package. Subsequently, the smart contract can securely use this verified data to perform operations.

By implementing these steps, we enhance the security and functionality of interactions between Farcaster's Frames and the Degen Chain, fostering a more robust and efficient environment.


![farcaster.frame.degenchain](https://hackmd.io/_uploads/ByWlvm2eR.png)

## Use cases

This approach allows the execution of various activities such as token transfers, voting, gaming, and more, all through verified frame interactions. Directly onchain and binding, directly by a Farcaster Frame without external wallet interaction for the user.

##### Frame fields that can be utilized by the smart contract:
- **buttonIndex**: Identifies which button was pressed.
- **inputText**: Captures text input by the user.
- **state**: Records the state of the frame at the time of interaction.
- **timestamp**: Logs when the interaction occurred.

These fields are signed and verified to ensure that the sender is legitimate and holds a Farcaster ID (FID).

The following simple example demonstrates how frame package verification on DegenChain can securely facilitate user-driven transactions within smart contracts.


![example_degenchain](https://hackmd.io/_uploads/HJAT5pJZA.png)


## Components

At Vocdoni, thanks to the implementation of our poll frame https://farcaster.vote, we have some of the components validated and almost ready.

- Farcaster keyRegistry offchain merkle-tree ✅
- Go implementation of Frame validation and signatures ✅
- DegenChain keyRegistry Oracle smart contract 🏗️
- DegenChain frame verification precompile and new Solidity function VerifyFrame() 🏗️
- DegenChain fraud-proof for the frame verification precompile 🏗️

## Why and what do we need?

We want to implement it so we can fully execute our Roadmap on https://farcaster.vote to allow communities to create new farcaster native DAOs and execute binding votes with smooth experience. 

But we believe, we can do this generic enough so anyone can use it for anything related to frames.

- **Understand if this makes sense for Degen Chain ecosystem**
- Funding
- Access to the DegenChain source code
- A Testnet
- Collaborate with Syndicate