Flow Community Rewards are here. Earn points for engaging in the ecosystem, spend points on prizes. Learn more.
Education
August 6, 2024
Part 2: Supercharging EVM apps on Flow
Sean Robb
Part 2: Supercharging EVM apps on Flow

Welcome back to our dive into Supercharging EVM apps on Flow. If you missed the first part, where we explored the foundational aspects of Flow’s unique multi-role architecture and its advantages for EVM developers, you can read Part 1 here.

Crescendo, live on Testnet this August 14th and Mainnet September 4th, culminates a symphony of efforts to harmonize two blockchain ecosystems. With Crescendo, Flow introduces full support for the Ethereum Virtual Machine (EVM). Soon developers can import any Solidity-based application seamlessly to Flow and enjoy the best of both worlds.

With the Crescendo network upgrade, all ERC-20 and ERC-721 compatible tokens on Flow can be used in Cadence smart contracts without special handling and all Cadence tokens on Flow will be ERC-20 or ERC-721 compatible. This will ensure that all Flow applications—whether they are built with Solidity, Cadence, or some mix of both—are fully interoperable with the wider web3 ecosystem. Flow additionally boosts app functionality and scales with growth allowing builders to create incredible consumer apps that are open and composable across web3.

Evolve EVM Apps With Flow’s Transaction Model

Launching any existing EVM app on Flow is as straightforward as continuing development on Ethereum, with the same code and tools. However, Flow also offers unique advantages, with a transaction model that surpasses Ethereum’s constraints in maintaining decentralization and scalability.

Each transaction comprises three separate roles that securely and flexibly manage permissions:

The authorizer: Authorizers introduce greater sophistication to transactions while maintaining security without necessitating a smart contract. An app developer may designate one or more authorizers across multiple accounts to sign a transaction before approving it. This ability enables many new ways for transactions to run on chain-like admin transactions without an allowlist or state changes across accounts without a middleman smart contract.

The payer: The payer pays the gas fee for a transaction. It’s possible for a user to designate a specific address to pay for these fees, and Flow remains secure and flexible by allowing for apps or wallets  to pay this fee, so users won’t need to spend to simply transact.

The proposer: The proposer creates and submits a transaction to the network. Flow accounts can hold multiple keys, and each key may propose transactions through an app interface on that account’s behalf. A user can submit numerous transactions simultaneously, and Flow keeps pace, handling multiple parallel transactions without slowing down, for an all-around smooth experience.

With its dynamic transaction model, Flow scales rapidly with app use and stays optimized around performance and user experience, even at peak usage.

Scriptable Interactions Without Smart Contracts

Delve a little deeper into Flow after importing your EVM app and you’ll find that transactions also support scriptable interactions. Set pre- and post-condition checks based on the network state before execution, or create custom logic with if/then checks and loops—all without deploying smart contracts. Transactions fail or succeed automatically without requiring code to live on-chain indefinitely.

Pre- and post-condition-based transactions check the network state before executing. For example, a grocery app can use pre-conditions to check inventory for item pairs like salsa and chips before purchase. Post-conditions ensure both items are bought together, or not at all. This building block is a major unlock for apps wanting to do more with transactions.

Scripted Transactions support loops and if statements allowing for sophisticated actions to happen simply.

Flow also supports more complex logic processes within a transaction with if/then checks and loops. Flow engineer Navid TehraniFar found an arbitrage bot running on Flow Mainnet that demonstrates these processes. The bot employs three functions, each attempting an arbitrage strategy across a 50-transaction loop. If the bot detects profit in a simulated loop then it executes the strategy with the logic built into the transaction—if not then it does nothing.

These features exist within transactions without requiring smart contracts to be deployed. The code in such transactions can’t be queried as that of a smart contract; it only executes during the transaction if the predefined criteria are met. This diminishes on-chain risks and opens up the possibility for more complex interactions without the cost of deploying additional on-chain logic.

The Benefits Of the Flow Account Model For EVM Integration

With your EVM code now running smoothly on Flow you enjoy the benefits of a reliable and sophisticated transaction structure that scales with your growth. Meanwhile, your users can appreciate the secure streamlined experience of Flow account setup and management.

Flow accounts integrate secure element technology for key management, via Android’s Keystore and Apple’s Secure Enclave, making modern mobile devices effective cold storage. Cryptography for these elliptic curves is supported directly within the protocol, with no external bundler needed. Isolated cryptography in Flow account creation also allows the accounts to support several types of cryptographic methods, including quantum-resistance ones—it only takes a small update to integrate the new protocol.

Final_Illustra_3_V2_1_iteration_2.gif [optimize output image]
Key Lifecycle for Flow Accounts

Accounts on Flow are able to hold multiple keys with varying weights, or signing power, unlike Ethereum’s account model built around a single keypair. If a key is lost or compromised, this function accommodates social or devices-based recovery measures for Flow accounts.

Crescendo also introduces Cadence Owned Accounts (COAs), which act as NFTs and full EVM accounts, capable of holding assets and calling smart contracts. COAs may be traded, sold, swapped, or used as lending collateral within Flow. It’s possible to delegate multiple accounts access to a COA, just as with any other Flow asset.

Experience The Difference With EVM On Flow

Crescendo launches on Testnet on August 14th and Mainnet on September 4th. Join us and see how Flow’s features can enhance your EVM app, provide us with your feedback, and shape the next generation of decentralized applications and operations on Flow.