bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 10쪽 중 1쪽
# Native Account Abstraction (Legacy Chain)
Source: https://docs.sophon.xyz/architecture/account-abstraction
Account abstraction in the Sophon v1 chain
<Warning>
This page describes account abstraction in the legacy Sophon v1 chain. The chain
is being wound down; see the [migration guide](/migration) for current actions.
</Warning>
Sophon v1 inherited native account abstraction from the ZK Stack. Unlike an
ERC-4337 overlay, the ZK Stack transaction model treated programmable accounts and
paymasters as protocol-level capabilities.
The legacy design supported:
* custom signature and authorization logic;
* multisignature and recovery patterns;
* application-specific transaction restrictions;
* paymasters that could sponsor gas or accept alternative fee tokens;
* a unified transaction flow for externally owned and smart-contract accounts.
This page is an architectural summary, not current deployment guidance. The separate
[Sophon Account](/sophon-account/intro) section documents the account SDK and
connectors that remain in this repository.
# Paymasters (Legacy Chain)
Source: https://docs.sophon.xyz/architecture/paymasters
Gas sponsorship in Sophon v1
<Warning>
This page describes paymasters in the legacy Sophon v1 chain. Do not begin a new
production deployment on Sophon; see the [migration guide](/migration) for current
actions.
</Warning>
Paymasters were ZK Stack smart contracts that could pay or customize gas fees for a
Sophon transaction. Applications used them to sponsor user activity, set allowance
rules, grant NFT-based fee benefits, or accept an ERC-20 token in place of SOPH.
The implementation guide is retained for teams maintaining a legacy deployment
during the wind-down: [Setting Up Paymasters](/build/setting-up-paymasters).
# Validium Architecture (Legacy)
Source: https://docs.sophon.xyz/architecture/validiums
How Sophon v1 used offchain data availability
<Warning>
This page documents the legacy Sophon v1 chain architecture. The Sophon Chain is
being wound down; see the [migration guide](/migration) for current actions.
</Warning>
Sophon v1 was implemented as a Validium built with the ZK Stack. A Validium keeps
transaction data outside Ethereum while publishing validity proofs to Ethereum,
reducing data costs while retaining proof-based verification of chain state.
Sophon used [Avail](https://www.availproject.org/) as its external data-availability
layer. Avail stored the data needed to reconstruct state, while Ethereum verified
the validity proofs associated with transaction batches.
This architecture is retained as historical context only; it is not a roadmap for a
new Sophon chain deployment.
# ZK Stack Architecture (Legacy)
Source: https://docs.sophon.xyz/architecture/zk-stack
The ZK Stack foundations of Sophon v1
<Warning>
This page documents the legacy Sophon v1 chain architecture. The Sophon Chain is
being wound down; see the [migration guide](/migration) for current actions.
</Warning>
Sophon v1 was a ZK Stack chain. The original architecture used ZKsync components to
execute transactions on Sophon, prove chain state to Ethereum, and participate in
the broader Elastic Chain design.
<img alt="Sophon ZK Stack architecture" />
## Original design goals
* **Scalability:** execute consumer-application transactions outside Ethereum.
* **Validity proofs:** use zero-knowledge proofs to verify batched state transitions
on Ethereum.
* **External data availability:** store reconstructable chain data through Avail.
* **Interoperability:** align with ZKsync's Elastic Chain architecture for movement
between ZK chains.
These points explain the technical thesis behind the legacy chain. Sophon's current
direction is product-led, with new applications built on Base rather than a new
general-purpose Sophon chain.
# Early Partners Program
Source: https://docs.sophon.xyz/build/early-partners
<Warning>
This is legacy Sophon v1 documentation. The chain is being wound down; do not
apply for or begin a new Sophon Chain deployment through this programme.
</Warning>
To use Sophon, you'll need our native token (**SOPH**), just like with any blockchain.
## Gas Fees & Paymaster
<Warning>
Since the SOPH TGE happened on May 28th, we'll be winding down our ecosystem-wide paymaster two
weeks after the launch. Until then, our Paymaster will cover your deployment transactions and
contract interactions.
</Warning>
<Tip>
Gas costs for L1 to L2 native bridging and transactions done within Sophon Home will still be
sponsored by us.
</Tip>
Here's how the Paymaster works:
* Only whitelisted addresses can deploy new contracts
* Anyone can interact with contracts deployed by whitelisted addresses
<Tip>
Want to get on the whitelist? Just fill out this [form](https://forms.gle/j3BTuHJUL2apBT8d9) and
we'll reach out to help you get started. Deployments will still be permissioned to only
whitelisted addresses.
</Tip>
<Info>
Curious about paymasters in general? Check out the [Paymasters](/architecture/paymasters) page for
more details.
</Info>
Once you're onboarded, you can follow our [Hardhat](/build/interact/hardhat) or [Foundry](/build/interact/foundry) guides to deploy your contracts.
## Set Up Your Own Paymaster
As a partner, you'll be able to run your own paymaster. This means you can sponsor your users' transactions and contract interactions, using your own rules and budgets.
Even after our paymaster sunsets, contract deployments will still be limited to whitelisted addresses.
<Info>
Want to set up your own paymaster? Check out our [How to set up a
Paymaster](/build/setting-up-paymasters) guide for a step-by-step walkthrough.
</Info>
# zkVM vs EVM Differences
Source: https://docs.sophon.xyz/build/evm-compatibility/differences
Core differences between Sophon's native zkVM and Ethereum's EVM
<Warning>
This is a legacy Sophon v1 technical reference. The chain is being wound down and
should not be used for a new production deployment.
</Warning>
# zkVM vs EVM Differences
Sophon's native zkVM is fundamentally different from Ethereum's EVM as it's designed to generate zero-knowledge proofs while executing smart contracts. While the EVM Bytecode Interpreter enables EVM compatibility (see [limitations](/build/evm-compatibility/evm-interpreter#limitations)), here are the core differences between zkVM and EVM:
## Execution Model
* **Proof Generation**: zkVM operations must be ZK-proof friendly, affecting how certain operations work
* **Gas Model**: Uses "ergs" instead of gas, with different cost calculations for operations
* **State Management**: Different approach to handling state changes due to ZK-proof requirements
## EVM Instruction Differences
To check what opcodes differ in behavior between Sophon and Ethereum, see the official [EVM Instructions](https://docs.zksync.io/zksync-protocol/differences/evm-instructions) page.
## Native Features
### Account Abstraction
Unlike EVM which requires EIP-4337 for AA, Sophon's zkVM:
* Has native account abstraction built into the VM
* Provides better performance for AA operations
* Handles nonces differently for AA accounts
[Learn more about AA differences](https://docs.zksync.io/zksync-protocol/differences/native-vs-eip4337)
### Paymasters
zkVM has native support for paymasters:
* Built-in paymaster functionality
* More efficient fee abstraction
* Different gas accounting for sponsored transactions
### System Contracts
* Additional precompiled contracts specific to zkVM
* Different handling of system-level operations
* Native multi-transaction support
[Learn more about precompile differences](https://docs.zksync.io/zksync-protocol/differences/pre-compiles)
## State and Storage
### Nonce Handling
* Separate nonces for deployments and transactions
* Different nonce management for smart contract accounts
* Unique nonce behavior for batched transactions
[Learn more about nonce differences](https://docs.zksync.io/zksync-protocol/differences/nonces)
### Storage Layout
* Different storage slot calculation
* Unique handling of immutable references
* Modified library linking process
[Learn more about storage differences](https://docs.zksync.io/zksync-protocol/differences/libraries)
## Contract Lifecycle
### Deployment
* Different bytecode format for native zkVM contracts
* Unique contract creation flow
* Modified CREATE/CREATE2 behavior for zkVM contracts
[Learn more about deployment differences](https://docs.zksync.io/zksync-protocol/differences/contract-deployment)
### Code Execution
* Different handling of contract calls
* Modified return data handling
* Unique error propagation model
[Learn more about execution differences](https://docs.zksync.io/zksync-protocol/differences/evm-instructions)
# EVM Bytecode Interpreter
Source: https://docs.sophon.xyz/build/evm-compatibility/evm-interpreter
How Sophon's EVM equivalence module works
<Warning>
This is a legacy Sophon v1 technical reference. The chain is being wound down and
should not be used for a new production deployment.
</Warning>
# EVM Bytecode Interpreter
The **EVM Bytecode Interpreter** is a key component of Sophon's **v27 upgrade**, enabling true **EVM equivalence** by allowing the direct execution of unmodified EVM bytecode on Sophon's zkEVM.
## What is EVM Equivalence?
**EVM equivalence** means that a blockchain can execute standard EVM bytecode directly, providing:
* **Identical behavior** to Ethereum's EVM in all aspects
* **Identical address derivation** for contract deployments
* **Full compatibility** with standard Ethereum development tools
* **No requirement** for special compilation or adaptation
This is different from mere "EVM compatibility," which typically requires specialized tooling or compilation steps. For more details, see the official [EVM Interpreter](https://docs.zksync.io/zksync-era/unique-features/evm-interpreter/evm-interpreter) page.
## How the EVM Bytecode Interpreter Works
The **EVM Bytecode Interpreter** serves as a crucial system contract that enables the execution of standard EVM bytecode on Sophon's zkEVM, ensuring EVM equivalence. This involves:
1. **Effortless Contract Deployment**: Deploy contracts just as you would on Ethereum, using transactions without a `to` field and embedding contract initialization code as calldata. This process guarantees identical address derivation and behavior as on Ethereum.
2. **Comprehensive Tool Compatibility**: Utilize standard Ethereum development tools like Hardhat and Foundry without needing additional plugins or modifications.
3. **Transparent Execution**: The interpreter operates behind the scenes, invoked automatically by the protocol.
Contracts deployed in this manner are flagged as EVM bytecode and executed through the EVM interpreter. During execution, the contract's EVM opcodes are translated into the ZKsync VM's instruction set and executed by the ZKsync VM.
<img alt="Contract Deployment" />
## Versioned Contract Storage
Contracts in Sophon are identified through their **"versioned hash"** in the `AccountCodeStorage`:
* **zkEVM contracts**: Version `0x01`
* **EVM contracts**: Version `0x02`
You can check if a contract was deployed with EVM bytecode by calling the `isAccountEVM(address)` function on the `AccountCodeStorage` system contract at `0x0000000000000000000000000000000000008002`.
## Benefits for Developers
**EVM equivalence** provides significant advantages for developers:
* **Standard Solidity/Vyper Deployment**: Deploy contracts compiled with standard Solidity/Vyper compilers
* **Same Address Derivation**: Get the same contract addresses from `create` and `create2` as on Ethereum
* **Familiar Debugging**: Use standard Ethereum debugging tools with deployed contracts
* **Cross-VM Interoperability**: EVM and zkEVM contracts can interact (with some limitations)
* **Simplified Migration**: Move existing Ethereum contracts to Sophon without code changes
* **Code Reuse**: Leverage existing libraries and patterns without modification
## Limitations
### EVM Version Support
The EVM Bytecode Interpreter targets the **Cancun** EVM version. This means it includes Cancun's opcodes and features, but may not include future Ethereum upgrades immediately.
### Unsupported Opcodes
The following opcodes are not supported due to underlying limitations of ZKsync VM:
* `CALLCODE`
* `SELFDESTRUCT`
* `BLOBHASH`
* `BLOBBASEFEE`
### Gas Handling
* **Block Gas Limit**: `block.gaslimit` returns `1125899906842624n`, which differs from EVM chains (`36000000n`)
* **Gas Conversion**: A fixed ratio (5:1) is used to convert between EVM gas and native zkEVM gas (ergs)
* **Higher Costs**: EVM contracts have 150-400% higher gas fees than native zkEVM contracts
* **Out-of-Gas Behavior**: If an EVM contract runs out of native zkEVM gas, it triggers a revert of the entire EVM call stack
### Contract Interactions
* **EVM-zkEVM Interaction**: Standard calls between EVM and zkEVM contracts work, but `delegatecall` operations are not supported
### Tools and Verification
* **Foundry Scripts**: Require the `--skip-simulation` flag due to gas model differences
* **Contract Verification**: Must use Sophon's native block explorer API
## The Road to Full EVM Equivalence
While the **v27 upgrade** with the **EVM Bytecode Interpreter** brings Sophon much closer to true EVM equivalence, complete equivalence is expected with the next proving system. The current implementation covers most developers' needs but does have some limitations due to the underlying zkEVM architecture.
## zkEVM: The Foundation
Sophon's zkEVM is a specialized virtual machine designed to execute smart contracts while generating zero-knowledge proofs of execution. It:
* Maintains compatibility with most Ethereum smart contracts
* Optimizes operations for efficient ZK-proof generation
* Extends functionality with features like paymasters and account abstraction
The EVM Bytecode Interpreter builds on this foundation to provide true EVM equivalence while maintaining the benefits of the underlying zkEVM architecture.
# Overview
Source: https://docs.sophon.xyz/build/evm-compatibility/index
Understanding how Sophon's EVM implementation compares to Ethereum
<Warning>
This is a legacy Sophon v1 technical reference. The chain is being wound down and
should not be used for a new production deployment.
</Warning>
# EVM Compatibility
While Sophon is EVM compatible and you can use familiar development tools from the Ethereum ecosystem, it provides two ways to deploy contracts:
* Native zkEVM contracts (optimized for performance and lower gas costs)
* Standard EVM contracts (through the EVM Bytecode Interpreter)
## Key Benefits
* **EVM Compatibility**: Most Ethereum smart contracts will work on Sophon
* **Familiar Development Tools**: Use the same development tools like Hardhat and Foundry
* **Extended Functionality**: Access to additional features like Paymasters
* **Dual Execution Models**: Support for both zkEVM native contracts and EVM bytecode contracts
## Recommended Best Practices
When developing for Sophon, consider the following:
1. **Test thoroughly on Sophon testnet** before deploying to mainnet
2. Be aware of **gas model differences** between Ethereum and Sophon
3. Understand **limitations in contract interactions** between EVM and zkEVM contracts
4. Take advantage of **zkEVM-specific features** like paymasters and account abstraction
## Core Differences and Implementations
Learn about the zkEVM and how it differs from standard Ethereum EVM.
<CardGroup>
<Card title="EVM Interpreter" icon="microchip" href="/build/evm-compatibility/evm-interpreter">
How Sophon's EVM Bytecode Interpreter works and enables EVM equivalence.
</Card>
<Card title="Detailed ZkVM vs EVM Differences" icon="binary" href="/build/evm-compatibility/differences">
Specific differences between Sophon's zkVM and Ethereum EVM, including opcode and precompile differences.
</Card>
</CardGroup>
## Getting Started
If you're unfamiliar with developing or deploying on the ZK Stack, check out:
* [Start Building](/build/start-building)
* [Network Information](/build/network-information)
* [Mainnet Information](/build/mainnet)
* [Setting Up Paymasters](/build/setting-up-paymasters)
* [Your First Contract](https://docs.zksync.io/build/start-coding/quick-start/deploy-your-first-contract)
## Additional Resources
Below are some important resources to help you understand Sophon's EVM compatibility:
* [Hello ZKsync](https://docs.zksync.io/build/zksync-101/hello-zksync)
* [Getting Started: Hardhat](https://docs.zksync.io/zksync-era/tooling/hardhat/guides/getting-started)
* [Paymaster](https://docs.zksync.io/zksync-era/unique-features/paymaster)
* [EVM Bytecode Interpreter](https://docs.zksync.io/zksync-era/unique-features/evm-interpreter/evm-interpreter)
* [zkEVM ↔ EVM Contract Interactions](https://docs.zksync.io/zksync-protocol/evm-interpreter/era-evm-interactions)
* [EVM Bytecode Interpreter Documentation](https://docs.zksync.io/zksync-era/unique-features/evm-interpreter/evm-interpreter)
* [zkEVM ↔ EVM Contract Interactions](https://docs.zksync.io/zksync-protocol/evm-interpreter/era-evm-interactions)
* [EVM Bytecode Interpreter FAQ](https://docs.zksync.io/zksync-era/unique-features/evm-interpreter/faq)
# Foundry
Source: https://docs.sophon.xyz/build/interact/foundry
<Warning>
This guide is retained only for maintaining an existing Sophon v1 deployment.
Do not start a new production deployment on the chain.
</Warning>
## Installing Foundry
On your command line, run:
```
curl -L https://raw.githubusercontent.com/matter-labs/foundry-zksync/main/install-foundry-zksync | bash
```
<Tip>
You can find more info on the official [ZKsync
Foundry](https://foundry-book.zksync.io/getting-started/installation) website.
</Tip>
## Create a New Project
```
forge init
forge build --zksync
```
This will create a new simple Foundry project with a `Counter` contract.
## Set Configs
<Note>
A full baseline Foundry example can be found on our GitHub
[here](https://github.com/sophon-org/hello-foundry-template).
</Note>
Set your `foundry.toml` and `.env` as follows:
<CodeGroup>
```.toml foundry.toml theme={null}
# The Default Profile
[profile.default]
solc_version = "0.8.24"
zksolc_version = "1.5.11"
src = "src"
out = "out"
libs = ["lib"]
remappings = [
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
]
[etherscan]
sepoliaTestnet = { key = "${ETHERSCAN_API_KEY}", url = "${SEPOLIA_VERIFIER_URL}", chain = 11155111 }
sophon = { key = "${ETHERSCAN_API_KEY}", url = "${SOPHON_VERIFIER_URL}", chain = 50104 }
ethereum = { key = "${ETHERSCAN_API_KEY}", url = "${VERIFIER_URL}", chain = 1 }
[rpc_endpoints]
sepoliaTestnet = "${SEPOLIA_RPC_URL}"
sophon = "${SOPHON_RPC_URL}"
ethereum = "${RPC_URL}"
# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
```
```.env .env theme={null}
PRIVATE_KEY="" # YOUR_PRIVATE_KEY your developer private key here
ETHERSCAN_API_KEY="YOUR_ETHERSCAN_API_KEY" # your Sophscan API gey obtained from sophscan
PAYMASTER_ADDRESS=0x98546B226dbbA8230cf620635a1e4ab01F6A99B2 # the paymaster address you want to use
# ethereum sepolia
SEPOLIA_RPC_URL=https://eth-sepolia.g.alchemy.com/v2/sp2BM_VFMURcKWMWg8HDVSBgvnm75_NS
SEPOLIA_VERIFIER_URL=https://api.etherscan.io/api
SEPOLIA_CHAIN_ID="11155111"
# ethereum
RPC_URL=https://ethereum-rpc.publicnode.com
VERIFIER_URL=https://api.etherscan.io/api
CHAIN_ID="1"
# sophon
SOPHON_RPC_URL=https://rpc.sophon.xyz
SOPHSCAN_MAINNET_VERIFIER_URL="https://api.sophscan.xyz/api"
SOPHON_VERIFIER_URL=https://verification-explorer.sophon.xyz/contract_verification
SOPHON_CHAIN_ID="50104"
```
</CodeGroup>
<Tip>
In order to obtain a Sophscan API Key, you need to create an account and get an API Key
[here](https://docs.sophscan.xyz/getting-started/viewing-api-usage-statistics).
</Tip>
프로젝트로 돌아가기