-
Couldn't load subscription status.
- Fork 71
Add smart contract functionality page #1130
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
base: staging/product-ia
Are you sure you want to change the base?
Conversation
|
|
||
| For a real-world example of how these pallets are implemented in production, you can check Moonbeam's implementation of [`pallet-evm`](https://github.com/moonbeam-foundation/moonbeam/blob/9e2ddbc9ae8bf65f11701e7ccde50075e5fe2790/runtime/moonbeam/src/lib.rs#L532){target=\_blank} and [`pallet-ethereum`](https://github.com/moonbeam-foundation/moonbeam/blob/9e2ddbc9ae8bf65f11701e7ccde50075e5fe2790/runtime/moonbeam/src/lib.rs#L698){target=\_blank}. | ||
| **Essential Pallet:** | ||
| - **[`pallet-revive`](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/revive){target=\_blank}** - Provides the core smart contract execution environment with PolkaVM and REVM backends |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue: External link missing backslash in target attribute.
| - **[`pallet-revive`](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/revive){target=\_blank}** - Provides the core smart contract execution environment with PolkaVM and REVM backends | |
| [`pallet-revive`](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/revive){target=\_blank} | |
| **[`pallet-revive`](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/revive){target=\_blank}** - Provides the core smart contract execution environment with PolkaVM and REVM backends |
|
|
||
| ## Wasm Smart Contracts | ||
| **Optional RPC Adapter:** | ||
| - **[`pallet-revive-eth-rpc`](https://crates.io/crates/pallet-revive-eth-rpc){target=\_blank}** - Adds full Ethereum RPC compatibility for Ethereum tooling integration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue: External link missing backslash in target attribute.
| - **[`pallet-revive-eth-rpc`](https://crates.io/crates/pallet-revive-eth-rpc){target=\_blank}** - Adds full Ethereum RPC compatibility for Ethereum tooling integration | |
| **[`pallet-revive-eth-rpc`](https://crates.io/crates/pallet-revive-eth-rpc){target=\_blank}** - Adds full Ethereum RPC compatibility for Ethereum tooling integration |
| **Dual Execution Model:** | ||
|
|
||
| <div class="grid cards" markdown> | ||
| 1. **PolkaVM Backend**: Executes PolkaVM bytecode with native performance optimization, precise gas metering, and enhanced security features |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue: Missing period at end of full sentence list item.
| 1. **PolkaVM Backend**: Executes PolkaVM bytecode with native performance optimization, precise gas metering, and enhanced security features | |
| 1. **PolkaVM Backend**: Executes PolkaVM bytecode with native performance optimization, precise gas metering, and enhanced security features. |
|
|
||
| <div class="grid cards" markdown> | ||
| 1. **PolkaVM Backend**: Executes PolkaVM bytecode with native performance optimization, precise gas metering, and enhanced security features | ||
| 2. **REVM Backend**: Executes EVM bytecode for compatibility with existing Ethereum contracts, ensuring seamless migration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue: Missing period at end of full sentence list item.
| 2. **REVM Backend**: Executes EVM bytecode for compatibility with existing Ethereum contracts, ensuring seamless migration | |
| 2. **REVM Backend**: Executes EVM bytecode for compatibility with existing Ethereum contracts, ensuring seamless migration. |
|
|
||
| ## pallet-contracts (Legacy) | ||
|
|
||
| [`pallet-contracts`](https://docs.rs/pallet-contracts/latest/pallet_contracts/index.html#contracts-pallet){target=\_blank} is the original Wasm-based smart contract pallet for Polkadot SDK chains. While still functional, it's considered legacy as development efforts have shifted to pallet-revive. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue: External link missing backslash in target attribute.
| [`pallet-contracts`](https://docs.rs/pallet-contracts/latest/pallet_contracts/index.html#contracts-pallet){target=\_blank} is the original Wasm-based smart contract pallet for Polkadot SDK chains. While still functional, it's considered legacy as development efforts have shifted to pallet-revive. | |
| [pallet-contracts](https://docs.rs/pallet-contracts/latest/pallet_contracts/index.html#contracts-pallet){target=\_blank} is the original Wasm-based smart contract pallet for Polkadot SDK chains. While still functional, it's consider... |
| - **[`pallet-revive`](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/revive){target=\_blank}** - Provides the core smart contract execution environment with PolkaVM and REVM backends | ||
|
|
||
| ## Wasm Smart Contracts | ||
| **Optional RPC Adapter:** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say this isn't optional. More importantly, it's crucial because otherwise you'll only be able to send Substrate-type transactions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove the "Optional".
| ### Supported Languages and Compilers | ||
|
|
||
| - **[`pallet-contracts`](https://docs.rs/pallet-contracts/latest/pallet_contracts/index.html#contracts-pallet){target=\_blank}**: Provides the Wasm smart contract execution environment. | ||
| pallet-revive accepts smart contracts from multiple languages and compilation paths: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I'd say that it supports any language that can be compiled down to RISC-V
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine here especially because we want to focus on Solidity (REVM/PVM). Later on in this page on line 41 I state: "Any language that can compile to PolkaVM bytecode and utilize pallet-revive's host functions (via pallet-revive-uapi) is supported."
| | Language | Compiler | Output Bytecode | Execution Backend | Performance | | ||
| |----------|----------|-----------------|-------------------|-------------| | ||
| | Solidity | `resolc` | PolkaVM | PolkaVM | Optimal | | ||
| | Solidity | `solc` | EVM | REVM | Compatible | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if "performance/compatible" makes sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the "Performance" column.
| | Rust (ink!) | `cargo-contract` | PolkaVM | PolkaVM | Optimal | | ||
|
|
||
| For a real-world example of how this pallet is implemented in production, you can check Astar's implementation of [`pallet-contracts`](https://github.com/AstarNetwork/Astar/blob/b6f7a408d31377130c3713ed52941a06b5436402/runtime/astar/src/lib.rs#L693){target=\_blank}. | ||
| Any language that can compile to PolkaVM bytecode and utilize pallet-revive's host functions (via `pallet-revive-uapi`) is supported. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a link for pallet-revive-uapi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| **Dual Execution Model:** | ||
|
|
||
| <div class="grid cards" markdown> | ||
| 1. **PolkaVM Backend**: Executes PolkaVM bytecode with native performance optimization, precise gas metering, and enhanced security features |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha, I would definitely NOT say that the gas metering is precise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay haha. We can say: "Executes PolkaVM bytecode with native performance optimization."
| ### Implementation Examples | ||
|
|
||
| [:octicons-arrow-right-24: Reference](/smart-contracts/get-started/) | ||
| See real-world implementation in the [Asset Hub system parachain runtime](https://github.com/polkadot-fellows/runtimes/blob/8914a1c70ce2a821f1d4646feaab462204e01b26/system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs#L1180-L1209){target=\_blank} in the Polkadot Fellows repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this should be "Polkadot Hub TestNet", and be pointed to passet hub
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the passet hub runtime is just the asset hub runtime:
And yes we can say "Polkadot Hub TestNet" and replace with the following link:
|
|
||
| For a real-world example of how these pallets are implemented in production, you can check Moonbeam's implementation of [`pallet-evm`](https://github.com/moonbeam-foundation/moonbeam/blob/9e2ddbc9ae8bf65f11701e7ccde50075e5fe2790/runtime/moonbeam/src/lib.rs#L532){target=\_blank} and [`pallet-ethereum`](https://github.com/moonbeam-foundation/moonbeam/blob/9e2ddbc9ae8bf65f11701e7ccde50075e5fe2790/runtime/moonbeam/src/lib.rs#L698){target=\_blank}. | ||
| **Essential Pallet:** | ||
| - **[`pallet-revive`](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/revive){target=\_blank}** - Provides the core smart contract execution environment with PolkaVM and REVM backends |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could briefly explain or add a reference for both, polkavm and revm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| Frontier offers flexible integration depending on your compatibility needs: | ||
|
|
||
| #### EVM Execution Only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be deferred to the regulators, but I believe we tend to avoid using 4 hashtags "####".
|
|
||
| - **[`pallet-evm`](https://github.com/polkadot-evm/frontier/tree/master/frame/evm){target=\_blank}** - Provides the core EVM execution environment | ||
|
|
||
| This configuration allows EVM contract execution but requires using Polkadot SDK-specific APIs for interaction. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, what's the reason of this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is if you want to create a Substrate chain with an EVM and use extrinsics instead of Eth RPC style transactions. Basically you want an EVM but you don't care about Eth compatibility.
| ### Key Benefits of Full Integration | ||
|
|
||
| - **Ethereum tooling compatibility**: Full compatibility with MetaMask, Hardhat, Remix, Truffle, and other Ethereum development tools | ||
| - **Zero-friction migration**: Deploy existing Ethereum dapps with minimal or no modifications |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of "Zero", I'd say "Minimal". WDYT? just to be safe haha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed!
π Description
Resolves #1045
π Review Preference
Choose one:
π€ AI-Ready Docs
If content changed, regenerate AI files:
python3 scripts/generate_llms.pyβ Checklist