Convert Figma logo to code with AI

ethereum logofe

Emerging smart contract language for the Ethereum blockchain.

1,650
197
1,650
112

Top Related Projects

1,372

Polkadot's ink! to write smart contracts.

1,312

Solidity Compiler for Solana, Polkadot and Stellar

5,004

Pythonic Smart Contract Language for the EVM

Quick Overview

Fe is an emerging statically typed language for the Ethereum Virtual Machine (EVM). It aims to be simple and safe, drawing inspiration from Python and Rust while focusing on features specific to smart contract development. Fe is designed to make it easier for developers to write secure and efficient smart contracts for Ethereum and other EVM-compatible blockchains.

Pros

  • Statically typed, providing better safety and catching errors at compile-time
  • Syntax inspired by Python, making it easier for developers familiar with Python to transition
  • Built-in security features tailored for smart contract development
  • Compiles directly to EVM bytecode, potentially offering better performance than Solidity

Cons

  • Still in early development, not yet ready for production use
  • Limited ecosystem and tooling compared to more established languages like Solidity
  • Smaller community and fewer learning resources available
  • May require developers to learn a new language if they're already familiar with Solidity

Code Examples

  1. Basic contract structure:
contract SimpleStorage {
    value: u256

    pub fn set_value(self, new_value: u256) {
        self.value = new_value
    }

    pub fn get_value(self) -> u256 {
        return self.value
    }
}
  1. Event emission:
contract EventEmitter {
    pub event ValueChanged {
        old_value: u256
        new_value: u256
    }

    value: u256

    pub fn change_value(self, new_value: u256) {
        let old_value: u256 = self.value
        self.value = new_value
        emit ValueChanged(old_value, new_value)
    }
}
  1. Using structs and mappings:
struct User {
    pub name: String<100>
    pub balance: u256
}

contract UserRegistry {
    users: Map<address, User>

    pub fn register_user(self, name: String<100>) {
        let new_user: User = User(name, 0)
        self.users[msg.sender] = new_user
    }

    pub fn get_user(self, addr: address) -> User {
        return self.users[addr]
    }
}

Getting Started

To get started with Fe, follow these steps:

  1. Install Rust and Cargo (Fe is written in Rust)
  2. Install Fe using Cargo:
    cargo install fe
    
  3. Create a new Fe project:
    fe new my_project
    cd my_project
    
  4. Compile your Fe code:
    fe build
    

Note that Fe is still in development, so features and syntax may change. Always refer to the official documentation for the most up-to-date information.

Competitor Comparisons

1,372

Polkadot's ink! to write smart contracts.

Pros of ink

  • More mature and widely adopted in the Polkadot ecosystem
  • Extensive documentation and community support
  • Built-in testing framework for easier contract testing

Cons of ink

  • Limited to Substrate-based chains, less versatile than Fe
  • Steeper learning curve for developers not familiar with Rust
  • Smaller ecosystem compared to Ethereum-based smart contracts

Code Comparison

Fe:

contract Token:
    balances: map<address, u256>

    pub fn transfer(self, to: address, amount: u256):
        self.balances[msg.sender] -= amount
        self.balances[to] += amount

ink:

#[ink(storage)]
pub struct Token {
    balances: ink_storage::Mapping<AccountId, Balance>,
}

impl Token {
    #[ink(message)]
    pub fn transfer(&mut self, to: AccountId, amount: Balance) {
        let from = self.env().caller();
        self.balances.insert(from, self.balances.get(&from).unwrap_or(0) - amount);
        self.balances.insert(to, self.balances.get(&to).unwrap_or(0) + amount);
    }
}

The code comparison shows that Fe uses a more Python-like syntax, which may be easier for some developers to read and write. ink, being Rust-based, offers stronger type safety and memory management but may require more verbose code.

1,312

Solidity Compiler for Solana, Polkadot and Stellar

Pros of Solang

  • Supports multiple blockchain platforms (Ethereum, Solana, Substrate)
  • More mature project with a larger community and ecosystem
  • Better documentation and tooling support

Cons of Solang

  • Steeper learning curve due to more complex features
  • May introduce overhead for simpler smart contract projects
  • Less focus on Ethereum-specific optimizations

Code Comparison

Fe:

contract Counter {
    count: u256

    pub fn increment(mut self) {
        self.count += 1
    }

    pub fn get(self) -> u256 {
        return self.count
    }
}

Solang:

contract Counter {
    uint256 private count;

    function increment() public {
        count += 1;
    }

    function get() public view returns (uint256) {
        return count;
    }
}

Summary

Fe is a newer, Ethereum-focused language with a simpler syntax and potentially easier onboarding for Rust developers. Solang offers broader blockchain support and a more established ecosystem but may be more complex for beginners. Fe's syntax is more Rust-like, while Solang closely resembles Solidity. Both aim to improve smart contract development, with Fe focusing on Ethereum-specific optimizations and Solang providing cross-platform compatibility.

5,004

Pythonic Smart Contract Language for the EVM

Pros of Vyper

  • More mature and widely adopted in the Ethereum ecosystem
  • Simpler syntax, designed for readability and auditability
  • Stronger safety features, including bounds and overflow checking

Cons of Vyper

  • Limited support for complex data structures
  • Slower compilation times compared to Fe
  • Less flexible, with intentional restrictions on certain programming patterns

Code Comparison

Vyper:

@external
def transfer(to: address, amount: uint256) -> bool:
    self.balanceOf[msg.sender] -= amount
    self.balanceOf[to] += amount
    log Transfer(msg.sender, to, amount)
    return True

Fe:

pub fn transfer(self, to: address, amount: u256) -> bool {
    self.balance_of[msg.sender] -= amount;
    self.balance_of[to] += amount;
    emit Transfer(msg.sender, to, amount);
    true
}

Both languages aim to provide safer smart contract development for Ethereum. Vyper focuses on simplicity and readability, while Fe offers a more Rust-like syntax with additional features. Vyper has been around longer and has more adoption, but Fe is gaining traction with its modern language design. The choice between them often depends on the developer's preference and project requirements.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Fe

The Fe compiler is in the late stages of a major compiler rewrite, and the master branch isn't currently usable to compile contracts to evm bytecode. For the older version of the compiler, see the legacy branch.

Overview

Fe is a statically typed language for the Ethereum Virtual Machine (EVM). The syntax and type system is similar to rust's, with the addition of higher-kinded types. We're exploring additional type system, syntax, and semantic changes.

Community

  • Twitter: @official_fe
  • Chat:
    • We've recently moved to Zulip
    • The Discord server is still live, but our preference is zulip.

License

Licensed under Apache License, Version 2.0.