Skip to content

Proposal Bend-PVM #2534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 173 additions & 0 deletions applications/bend-pvm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# Bend-PVM: A Next-Generation Smart Contract Language for PolkaVM

- **Team Name:** bend-pvm
- **Payment Address:** DOT/AssetHub address 13eJfzT8u1qKYkFDW6o7Ta19eGi9X8Y74cWLDComEVxbKGMa
- **[Level]**: 2

## Project Overview

Bend-PVM is a new smart contract programming language specifically optimized for PolkaVM. It combines the familiarity of Solidity with the power and safety of functional programming paradigms to create a secure, efficient, and developer-friendly language for the Polkadot ecosystem.

Our language provides a compelling migration path for Ethereum developers while leveraging the advanced capabilities of PolkaVM's RISC-V architecture and Polkadot's sophisticated resource model.

**Project Website**: [https://bend-pvm.aipop.fun/](https://bend-pvm.aipop.fun/)

### Project Details

The smart contract development space faces several critical challenges:
- High gas costs limiting complex application development
- Security vulnerabilities costing billions in exploits
- Difficult tradeoffs between security and usability
- Steep learning curves for new blockchain developers

Bend-PVM addresses these challenges by:
- Implementing a multi-dimensional resource model aligned with Substrate's weight system
- Incorporating functional programming features that enhance security
- Maintaining high compatibility with Solidity for easy developer migration
- Optimizing specifically for the PolkaVM runtime environment

### Ecosystem Fit

Bend-PVM fits perfectly within the Polkadot ecosystem:

1. **Problem solved**: Provides a secure and efficient smart contract language specifically designed for PolkaVM, bridging the gap between Ethereum developers and Polkadot's architecture.

2. **Target audience**:
- Ethereum developers looking to migrate to Polkadot
- New blockchain developers seeking a secure yet approachable language
- Polkadot parachain teams needing efficient smart contract capabilities

3. **Similar projects**:
- ink! - Rust-based smart contracts for Substrate
- Solang - Solidity compiler for Substrate

Bend-PVM differentiates by:
- Offering better Solidity compatibility than ink!
- Providing stronger functional programming features than Solang
- Being specifically optimized for PolkaVM's RISC-V architecture

## Team

### Team members
- **Lead Developer**: Codingsh

### Contact
- **Contact Name**: Codingsh
- **Contact Email**: [email protected]

### Legal Structure
- Individual contributor

### Team's experience
I have over 10 years of experience in programming language design and implementation, with a focus on compiler architecture and type systems. My background includes:

- Designing and implementing domain-specific languages for financial applications
- Contributing to open-source compiler infrastructure projects
- Developing static analysis tools for smart contract verification
- Deep understanding of the Polkadot ecosystem and its technical architecture

### Team Code Repos
- [https://github.com./developerfred/Bend-PVM](https://github.com./developerfred/Bend-PVM)
- [https://github.com./codingsh](https://github.com./codingsh)

## Development Status

We have completed initial research and design for Bend-PVM, including:

- Language specification draft (available in our GitHub repository: [language_reference.md](https://github.com./developerfred/Bend-PVM/blob/main/docs/language_reference.md))
- Solidity migration guide (available in our GitHub repository: [solidity_migration_guide.md](https://github.com./developerfred/Bend-PVM/blob/main/docs/solidity_migration_guide.md))
- Architecture planning document (available in our GitHub repository: [plan.md](https://github.com./developerfred/Bend-PVM/blob/main/plan.md))
- Prototype lexer and parser components
- Initial community discussions:
- [Polkadot Forum Discussion](https://forum.polkadot.network/t/bend-pvm-revolutionizing-smart-contract-development-for-polkadots-ecosystem/12283)
- [Gitcoin Governance Discussion](https://gov.gitcoin.co/t/proposal-bend-pvm-a-revolutionary-smart-contract-language-for-polkavm/20232)

## Development Roadmap

### Overview
- **Total Estimated Duration**: 6 months
- **Full-Time Equivalent (FTE)**: 1
- **Total Costs**: 30,000 USD

### Milestone 1: Language Core and Compiler Frontend
- **Estimated Duration**: 2 months
- **FTE**: 1
- **Costs**: 10,000 USD

| Number | Deliverable | Specification |
| --- | --- | --- |
| 0a. | License | Apache 2.0 |
| 0b. | Documentation | We will provide comprehensive documentation explaining the language design, compiler architecture, and how to use the toolchain. |
| 0c. | Testing Guide | The code will include unit tests covering all core components. We'll provide instructions for running these tests. |
| 0d. | Article | We will publish an article introducing Bend-PVM, explaining its benefits, and showcasing simple examples. |
| 1. | Language Specification | Complete formal specification of the Bend-PVM language, including syntax, type system, and semantics. |
| 2. | Lexer & Parser | Implementation of the lexer and parser components, converting source code to abstract syntax tree (AST). |
| 3. | Type Checker | Implementation of the static type system, ensuring type safety during compilation. |
| 4. | Semantic Analyzer | Implementation of semantic analysis phase, validating program correctness beyond syntax. |

### Milestone 2: Compiler Backend and PolkaVM Integration
- **Estimated Duration**: 2 months
- **FTE**: 1
- **Costs**: 10,000 USD

| Number | Deliverable | Specification |
| --- | --- | --- |
| 0a. | License | Apache 2.0 |
| 0b. | Documentation | Updated documentation covering the compiler backend and code generation process. |
| 0c. | Testing Guide | Comprehensive tests for the compiler backend, including integration tests with PolkaVM. |
| 0d. | Article | Technical article detailing how Bend-PVM integrates with PolkaVM and the benefits of this approach. |
| 1. | IR Generator | Implementation of an intermediate representation (IR) generator, preparing AST for optimization. |
| 2. | Optimization Pipeline | Implementation of compiler optimizations targeting the PolkaVM environment. |
| 3. | Code Generator | Implementation of the RISC-V code generator, producing executable bytecode for PolkaVM. |
| 4. | PolkaVM Integration | Integration with the PolkaVM runtime, including resource model implementation. |

### Milestone 3: Developer Tooling and Documentation
- **Estimated Duration**: 2 months
- **FTE**: 1
- **Costs**: 10,000 USD

| Number | Deliverable | Specification |
| --- | --- | --- |
| 0a. | License | Apache 2.0 |
| 0b. | Documentation | Complete user manual, language reference, and migration guides for Solidity developers. |
| 0c. | Testing Guide | End-to-end testing guide, including examples of writing and deploying real smart contracts. |
| 0d. | Article | Article focusing on developer experience and showcasing real-world smart contract examples. |
| 1. | Standard Library | Implementation of a comprehensive standard library with common data structures and utilities. |
| 2. | VS Code Extension | Development of a VS Code extension providing syntax highlighting, code completion, and error reporting. |
| 3. | Build System | Creation of a build system for compiling and deploying Bend-PVM contracts. |
| 4. | Example Contracts | Development of example contracts showcasing language features and best practices. |

## Future Plans

### Short-term plans (6-12 months)
- Develop a Solidity-to-Bend-PVM migration tool for automated code conversion
- Create educational resources to help developers learn Bend-PVM
- Build a community of early adopters to provide feedback and contribute to the ecosystem
- Implement additional optimizations for common smart contract patterns

### Long-term plans (12+ months)
- Develop specialized libraries for DeFi, NFTs, and DAOs
- Create formal verification tools integrated with the compiler
- Build a repository of verified, reusable contract components
- Integrate with parachain development tools and frameworks
- Potentially expand to other RISC-V based blockchain environments

## Additional Information

### What work has been done so far?
We have completed the initial research phase, including:
- Language design and syntax specification
- Resource model design aligned with Substrate's weight system
- Prototype lexer and parser implementation
- Documentation drafts including language reference and migration guide
- Community engagement through the [Polkadot Forum](https://forum.polkadot.network/t/bend-pvm-revolutionizing-smart-contract-development-for-polkadots-ecosystem/12283) and [Gitcoin Governance](https://gov.gitcoin.co/t/proposal-bend-pvm-a-revolutionary-smart-contract-language-for-polkavm/20232)

### Are there any other projects similar to yours in the Substrate/Polkadot/Kusama ecosystem?
While ink! and Solang exist as smart contract languages for Substrate, Bend-PVM differentiates itself by:
1. Being specifically designed for PolkaVM's RISC-V architecture
2. Offering a hybrid approach that combines Solidity familiarity with functional programming features
3. Implementing a multi-dimensional resource model that aligns perfectly with Substrate's weight system
4. Focusing on developer experience and migration path from Ethereum

### Why did you not apply for a grant previously?
This project was conceptualized recently as a response to the growing interest in PolkaVM and the need for specialized developer tools that can leverage its RISC-V architecture while providing a smooth migration path for Ethereum developers.
Loading