Top Related Projects
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
- 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
}
}
- 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)
}
}
- 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:
- Install Rust and Cargo (Fe is written in Rust)
- Install Fe using Cargo:
cargo install fe
- Create a new Fe project:
fe new my_project cd my_project
- 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
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.
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.
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
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
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:
License
Licensed under Apache License, Version 2.0.
Top Related Projects
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot