Fluent 백서

Fluent

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 13쪽 중 13쪽

s the Solidity contract gets from the Rust contract. # From project root: node js-client/solidity.js 4.3 Test ethers.js script to call Rust contract ​ Add the following script to the js-client/rust.js file that was created in the step above. This script calls the Rust contract directly with the IRustEvmTypes Solidity interface. Note: update string variable contractAddress with your deployed Rust contract address const ethers = require ( "ethers" ) // npm i ethers@5.7.2 https://github.com/smartcontractkit/full-blockchain-solidity-course-js/discussions/5139#discussioncomment-5444517 const rpcURL = "https://rpc.testnet.fluent.xyz/" // Your RPC URL goes here const provider = new ethers . providers . JsonRpcProvider ( rpcURL ) const contractAddress = "<INPUT_RUST_CONTRACT_ADDRESS_HERE>" const contractABI = [ { "inputs" : [ ] , "name" : "rustAddress" , "outputs" : [ { "internalType" : "address" , "name" : "" , "type" : "address" } ] , "stateMutability" : "view" , "type" : "function" } , { "inputs" : [ ] , "name" : "rustBool" , "outputs" : [ { "internalType" : "bool" , "name" : "" , "type" : "bool" } ] , "stateMutability" : "view" , "type" : "function" } , { "inputs" : [ ] , "name" : "rustBytes" , "outputs" : [ { "internalType" : "bytes" , "name" : "" , "type" : "bytes" } ] , "stateMutability" : "view" , "type" : "function" } , { "inputs" : [ ] , "name" : "rustBytes32" , "outputs" : [ { "internalType" : "bytes32" , "name" : "" , "type" : "bytes32" } ] , "stateMutability" : "view" , "type" : "function" } , { "inputs" : [ ] , "name" : "rustInt256" , "outputs" : [ { "internalType" : "int256" , "name" : "" , "type" : "int256" } ] , "stateMutability" : "view" , "type" : "function" } , { "inputs" : [ ] , "name" : "rustString" , "outputs" : [ { "internalType" : "string" , "name" : "" , "type" : "string" } ] , "stateMutability" : "view" , "type" : "function" } , { "inputs" : [ ] , "name" : "rustUint256" , "outputs" : [ { "internalType" : "uint256" , "name" : "" , "type" : "uint256" } ] , "stateMutability" : "view" , "type" : "function" } ] const contractDeployed = new ethers . Contract ( contractAddress , contractABI , provider ) ; let fluent_sepolia_chain_id = 20994 ; testRustContractRead ( ) async function testRustContractRead ( ) { const connectedNetworkObject = await provider . getNetwork ( ) ; const chainIdConnected = connectedNetworkObject . chainId ; console . log ( "chainIdConnected: " + chainIdConnected ) if ( chainIdConnected != fluent_sepolia_chain_id ) { console . log ( "RPC endpoint not connected to Fluent Sepolia (chainId: " + fluent_sepolia_chain_id + ")." ) ; console . log ( "Switch to Fluent Sepolia then try again." ) ; return ; } const rustString = await contractDeployed . rustString ( ) console . log ( "rustString: " + rustString ) const rustUint256 = await contractDeployed . rustUint256 ( ) console . log ( "rustUint256: " + rustUint256 ) const rustInt256 = await contractDeployed . rustInt256 ( ) console . log ( "rustInt256: " + rustInt256 ) const rustAddress = await contractDeployed . rustAddress ( ) console . log ( "rustAddress: " + rustAddress ) const rustBytes = await contractDeployed . rustBytes ( ) console . log ( "rustBytes: " + rustBytes ) const rustBytes32 = await contractDeployed . rustBytes32 ( ) console . log ( "rustBytes32: " + rustBytes32 ) const rustBool = await contractDeployed . rustBool ( ) console . log ( "rustBool: " + rustBool ) } This script should return the expected values directly from the Rust contract. # From project root: node js-client/rust.js 🎉 Congratulations! ​ You've successfully built and deployed your first blended application to Fluent Testnet! 🚀 🎨 Summary ✅ Rust Contract Development - Created a Rust/WASM contract with multiple data types ✅ Solidity Contract Integration - Built a Solidity contract that seamlessly calls your Rust contract ✅ Blended Deployment - Deployed both contracts to Fluent Testnet using gblend ✅ Frontend Integration - Connected your contracts to a JavaScript frontend using ethers.js ✅ Cross-Contract Communication - Demonstrated Solidity calling Rust functions with different data types Next Steps: ​ Now that you have a working blended application, you can: Explore Advanced Features - Try more complex data structures and contract interactions Build User Interfaces - Create web apps, mobile apps, or CLI tools Join the Community - Share your projects and get help from other developers Thank you for being part of the Era of Expressivity ! 🌟 Step 4: Integrate Blended Contracts 4.1 Add ethers.js to the Foundry project 4.2 Test ethers.js script to call Solidity contract 4.3 Test ethers.js script to call Rust contract 🎉 Congratulations! Next Steps: ## /developer-guides/account-abstraction/eip-7702 On this page Smart-Account Evolution at a Glance ​ Date What it introduced What devs gained EOA (2015) Single secp256k1 key, nonce, ETH gas Simple, but no batching, no paymasters, no custom logic EIP-4337 (2021) UserOperation , EntryPoint , bundlers, paymasters Batching, pay for gas in tokens, plug-in validation — but required deploying a new contract ERC-7579 (2023) Standard module slots (validator, executor, hook…) Drop-in extensions: session keys, spending caps, guardians EIP-7702 (2024) SetCodeTransaction (type 0x04 ) — permanent delegate pointer Turn any existing EOA into a 4337 wallet with one tx Key idea: 7702 is the missing bridge — it lets legacy EOAs join today’s 4337/7579 ecosystem without moving funds or changing address . Overview ​ EIP‑7702 lets a plain Externally Owned Account behave like a programmable wallet—without changing its address or moving funds. A new transaction type, SetCodeTransaction ( 0x04 ), writes a delegation indicator ( 0xef0100 || delegate_address ) into the account’s code slot. From that moment, every external or internal call to the account transparently executes the code at delegate_address in the EOA’s own storage and balance context . The owner can later update or remove the delegation with another SetCodeTransaction . This permanent, opt‑in pointer unlocks powerful patterns: Atomic call batching – one signature can approve, swap, and stake in a single transaction. Gas sponsorship – anyone can call the account and pay the fee; the delegate code verifies the user’s intent. On‑chain policy logic – spending caps, time locks, per‑app sub‑keys, or alternative auth (e.g. WebAuthn) can be enforced inside the delegate contract. At the same time, 7702 keeps the core EOA model intact. Transactions are still signed with the original secp256k1 key; the global nonce rules and ETH‑denominated gas costs remain unchanged; and the protocol itself knows nothing about sub‑keys, paymasters, or account abstraction. Those features live entirely in the delegate contract, which can be swapped or cleared at any time by the account owner. Key Concepts ​ Native Delegation with SetCodeTransaction ​ EIP-7702 defines a new transaction type ( 0x04 ) called SetCodeTransaction . This transaction installs a special bytecode in the EOA: 0xef0100 || delegate_address This instructs the EVM to delegate execution to delegate_address whenever the EOA receives a call. Importantly, the EOA continues to exist as a regular account with its own key, nonce, and ETH balance. Transaction Format ​ SetCodeTransaction (0x04) = rlp([ chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, value, data, access_list, authorization_list, // NEW y_parity, r, s ]) Authorization List ​ To prevent unauthorized code delegation, the authorization_list requires off-chain approval from the account’s owner: authorization_list = [[ chain_id, delegate_address, nonce, y_parity, r, s ], ...] This structure ensures only code explicitly approved by the user (via ECDSA signature) can be delegated to. ---------------------- | ------------------------------------------------------------------------------------ | | Atomic call batching | Approve → swap → stake in one transaction. | | Gas sponsorship | Any relayer can pay the fee; delegate code checks the user’s signed intent. | | On‑chain policy logic | Spending caps, time locks, app‑specific sub‑keys, WebAuthn verification, etc. | | Reversibility | Owner can clear or update the pointer at any time with another SetCodeTransaction . | ⚠️ 7702 itself does not add session keys, passkeys, or token‑gas payments; those live in the delegate contract. Using EIP-7702 with Smart-Account Workflows ​ EIP-7702 is the bridge between a plain EOA and the 4337 smart-account world. One signed message + one transaction turn an address you already own into a fully programmable wallet—while keeping the same key, balance, ENS, and history. What 7702 adds on top of 4337 ​ 4337 alone 4337 + 7702 Requires deploying a contract (factory call, CREATE2 gas, new address) Re-uses the existing EOA address—no factory, no asset moves Batching, sponsorship, modules only after deployment Available immediately after a single “upgrade” tx Hard to migrate legacy users Seamless one-click upgrade for any EOA Using EIP-7702 with Smart-Account Workflows ​ EIP-7702 is the bridge between a plain EOA and the 4337 smart-account world. One signed message + one transaction turn an address you already own into a fully programmable wallet—while keeping the same key, balance, ENS, and history. What 7702 adds on top of 4337 ​ 4337 alone 4337 + 7702 Requires deploying a contract (factory call, CREATE2 gas, new address) Re-uses the existing EOA address—no factory, no asset moves Batching, sponsorship, modules only after deployment Available immediately after a single “upgrade” tx Hard to migrate legacy users Seamless one-click upgrade for any EOA Conceptual upgrade flow ​ Select wallet logic Pick any contract that already implements 4337 validation (e.g. Kernel , Simple7702Account , or your own module bundle). Call it delegate . User signs one authorization hash authHash = keccak256(chainId ‖ delegate ‖ nonce) signature = sign(authHash, EOA_private_key) This proves the EOA owner allows that delegate. Install the delegate code — choose one of two ways Path What gets broadcast Who pays L1 gas A. Direct / Relayed A single SetCodeTransaction (0x04) that contains authorization_list = [authTuple] and writes 0xef0100‖delegate into the code slot. Sender (self-fund) or any relayer that signs & pays the tx. B. Bundled (4337) A UserOperation with extra field eip7702Auth = authTuple . The bundler turns it into SetCodeTransaction + handleOps inside one L1 tx. A paymaster inside the UserOp can cover the fee, giving a true “gasless” upgrade. Done — the address is now a smart-account From the next block every call first executes the delegate in the EOA’s own storage/balance context, so all 4337 features—batched actions, paymasters, session keys, 7579 modules—work exactly as if the wallet had been factory-deployed. Optional: Clear or swap the delegate Developer takeaway ​ No new primitives to learn — keep building with the same 4337 abstractions; 7702 is just a pre-upgrade step. No address migration pain — users keep the identifiers and approvals they already use. Reversible — the owner can clear or swap the delegate with another SetCodeTransaction at any time. EIP-7702 turns create a smart wallet into upgrade the key you already have — giving every existing account the modern UX of batching, gas sponsorship, and modular extensions without touching their funds. Demo ​ Play Chess with WebAuth session to avoid signing a transaction every move: https://chess.gblend.xyz References ​ Standards & Specifications ​ EIP-7702: Native Code Delegation - Standard for delegating execution to other smart contracts. EIP-4337: Account Abstraction - User operation standard for smart accounts without protocol changes. ERC-7579: Modular Smart Accounts - Standard for smart accounts with modular functionality. Official Documentation & Resources ​ EIP-7702 Documentation - Official documentation for the Native Code Delegation standard. EIP-4337 Documentation - Official resources for the Account Abstraction standard. ERC-7579 Documentation - Official site for the Modular Smart Accounts standard. ERC-7579 Architecture by Safe - Detailed explanation of the 7579 architecture by the Safe team. EntryPoint v0.8.0 - Detailed documentation for the EntryPoint contract with native 7702 support. Development Tools & SDKs ​ viem - TypeScript library for interacting with Ethereum. permissionless.js - TypeScript utilities built on viem for ERC-4337 account abstraction. Module SDK - SDK for developing modules compatible with ERC-7579. Smart Sessions SDK - Tools for implementing session-based authentication. ModuleKit - Comprehensive toolkit for module developers by Rhinestone. ERC-7579 Compatible SDK - Official tooling for building with the ERC-7579 standard. Reference Implementations ​ ERC-4337 Reference Implementation - Official reference implementation for Account Abstraction. ERC-7579 Reference Implementation - Reference code for implementing the Modular Smart Accounts standard. Smart Sessions Contracts - Implementation of session-based authentication contracts. Testing & Deployment ​ Prool - Toolkit for setting up testing infrastructure. Kernel Deployments Status - Current deployment status for Kernel implementations. Module Deployment Guide - Documentation on how to deploy modules. Registries & Metrics ​ ERC-7579 Module Registry - Official registry of compatible modules. Account Abstraction Stats - Analytics and metrics for account abstraction usage. Module Ideas Repository - Collection of ideas for ERC-7579 modules. Educational Content ​ Video Resources ​ Account Abstraction Video Series - Comprehensive video tutorials on account abstraction. EIP-7702 Talk by Authors - Explanation of EIP-7702 by its core contributors. Smart Sessions Explained - Detailed walkthrough of session-based authentication models. Articles & Guides ​ What Are Smart Sessions? - Explanation of session keys and their implementation. Safe Modular Smart Account Architecture Explained - Comprehensive breakdown of modular account design. Smart-Account Evolution at a Glance Overview Key Concepts Native Delegation with SetCodeTransaction Transaction Format Authorization List Using EIP-7702 with Smart-Account Workflows What 7702 adds on top of 4337 Using EIP-7702 with Smart-Account Workflows What 7702 adds on top of 4337 Conceptual upgrade flow Developer takeaway Demo References Standards & Specifications Official Documentation & Resources Development Tools & SDKs Reference Implementations Testing & Deployment Registries & Metrics Educational Content ## /knowledge-base/fluent-overview On this page Fluent Tech Stack Overview ​ Fluent is the first blended execution network. The project encompasses a zero-knowledge virtual machine (zkVM), Layer-2 network, and development framework for building diverse blockchain-based applications on Ethereum. Fluent's zkVM is written in SP1 as shown in the rwasm-zkvm repo . 💡 Fluent’s unique value proposition simulate the execution environment (EE) of multiple virtual machines (VMs), enabling real-time composability of smart contracts pertaining to different VMs (the EVM, the SVM, Wasm, etc.), and written in various programming languages (e.g., Solidity, Rust, and more), on a shared state execution environment. Fluent supports atomic composability between apps targeting different VMs, and blended apps composed of smart contracts mixed and matched between them. Interaction between the different types of contracts the network supports happens under the hood and is both atomic and happens in real-time. 🔍 Info For more details regarding the architecture of the Fluent tech stack from a core engineer and protocol analyst point of view, visit the tech book . The Fluent VM ​ The Fluent VM is a minimally modified version of the WebAssembly (Wasm) binary instruction format designed for verifiable applications. It is a reduced version of Wasm, called rWasm, which maintains compatibility with the original Wasm instruction set yet is optimized for zero-knowledge (zk) operations. Sections of the instruction set are embedded inside the binary, enhancing the efficiency and ease of verification of Wasm programs in a zk-rollup. rWasm features support for multiple VM targets at the execution layer. Its account and state structure are managed by specialized system contracts that represent each supported VM. Ultimately, these VMs are simulated and compiled down to rWasm for execution. The design is extensible in that support for additional VMs can be added over time. It also ensures atomic and synchronous composability between smart contracts pertaining to the different VMs it supports. The Fluent L2 Network ​ The Fluent L2 is a zk-rollup to run Wasm, EVM and SVM apps in one place. It supports blended execution of different VM targets on a shared state execution environment for real-time composability between apps from different ecosystems. The network is both EVM and SVM-compatible, maintaining ABI encodings for all contracts, and introducing no additional overhead for deploying apps in Solidity, or Solana Rust. Ultimately, all VMs on Fluent are simulated at the execution layer and compiled down to the Fluent rWasm VM for execution. Each VM is represented by a core Wasm-based system contract (the VM’s "compatibility contract") which defines its EE standards and provides an API to access these functions. While Fluent will initially support Wasm, EVM, and SVM-based contracts, its design is extensible, enabling support for additional VM integrations. App Deployment Models ​ The Fluent L2 will support two types of apps: shared and dedicated. Shared Apps: These are smart contract apps that share state on Fluent’s execution environment. Note that all shared apps on the Fluent L2 compose in real-time, even across different VM targets and programming languages (e.g. Rust and Solidity). Dedicated Apps: These apps are customizable, independent state machines that can leverage Fluent for proof aggregation and verification. Developers can customize sovereign app runtimes, modular layers (e.g. DA, sequencing) and more. The Fluentbase Framework ​ The Fluentbase framework is used to deploy smart contracts on the Fluent L2 as well as blockchains and verifiable compute environments that compile to rWasm. It introduces an SDK and a proving system for the Fluent state transition function (STF). It is the basis for the Fluent L2 and can be used to build: Blended apps: Smart contracts on the Fluent L2 written in the various programming languages that the network supports. Blended execution networks: blockchain-based networks (L2s, L3s, etc.) which simulates multiple VM targets on a shared execution layer. Arbitrary compute environments: off-chain dedicated compute environments with arbitrary logic. 🔍 Info Fluentbase supports integrations to build modular blockchains including DA layers (Celestia, Avail, etc.), shared sequencers (Espresso, Nodekit), and more. Fluent Tech Stack Overview The Fluent VM The Fluent L2 Network App Deployment Models The Fluentbase Framework
프로젝트로 돌아가기