Zircuit 백서

Zircuit

원문

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

nd efficiently.\\ # (Deprecated) Grants Progam ⚠️ The Grants Program has been discontinued. We are no longer accepting grant applications. This page is kept for reference only and the program is no longer active. If you are interested in working with us or contributing to the ecosystem, please explore other opportunities in our documentation. # Block Explorer {% hint style="info" %} The block explorer currently does not provide any external APIs for clients. {% endhint %} ## Mainnet <a href="https://explorer.zircuit.com/" class="button primary" data-icon="arrow-up-right-from-square"><https://explorer.zircuit.com/></a> ## Garfield Testnet <a href="https://exp.garfield-testnet.zircuit.com/" class="button primary" data-icon="arrow-up-right-from-square"><https://exp.garfield-testnet.zircuit.com/></a> ## Verifying Contracts To verify contracts, follow the [steps](https://docs.conduit.xyz/chains/explorer/verify-contracts) provided by Conduit. # Verifying Contracts Verifying your smart contract's source code on the [block explorer](https://explorer.zircuit.com) allows others to see your contract's code and verify that it operates as intended. The Zircuit block explorer provides two ways of verifying source code: * automated verification using [Hardhat](https://hardhat.org/getting-started/) or [Foundry](https://book.getfoundry.sh/getting-started/installation.html) * manual verification through direct upload of Solidity code from your `.sol` files or the compiler artifacts to [Sourcify](https://verify.sourcify.dev/) ### Automated Verification If you are using Hardhat or Foundry to develop your project, you can use a plug-in to verify the smart contracts: #### Foundry Install [Foundry](https://book.getfoundry.sh/getting-started/installation.html) if not already installed, and deploy your smart contracts to Zircuit. Then: Use the `forge` command to verify the contract: ```bash forge verify-contract <deployed-contract-address> <source-file>:<contract-name> \ --chain-id 48900 # or 48898 if deploying to Garfield Testnet --verifier sourcify \ --verifier-url https://sourcify.dev/server ``` Replace `<deployed-contract-address>`, and `<source-file>:<contract-name>` with your details. If you need to specify the constructor arguments, use the `--constructor-args` option with the ABI-encoded argument string. You can refer to the `verify-contract` [subcommand documentation](https://book.getfoundry.sh/reference/forge/forge-verify-contract) for more details. If the command runs successfully, your contract's page on <https://explorer.zircuit.com> will now display the source code and a **Contract source code verified** badge. #### Hardhat Before you start, install [Hardhat](https://hardhat.org/getting-started/) if you haven't already, and deploy your smart contracts to Zircuit. Then: 1. Install the Hardhat plug-in: `npm install --save-dev @nomicfoundation/hardhat-verify` 2. Configure Hardhat by adding the plug-in to your `hardhat.config.js`: ```javascript import { defineConfig } from "hardhat/config"; import hardhatVerify from "@nomicfoundation/hardhat-verify"; export default defineConfig({ plugins: [hardhatVerify], networks: { zircuit: { url: 'https://mainnet.zircuit.com', // or 'https://garfield-testnet.zircuit.com' // ... rest of the network config }, }, verify: { etherscan: { enabled: false }, blockscout: { enabled: false }, sourcify: { enabled: true, apiUrl: 'https://sourcify.dev/server', } }, // ... rest of the config }); ``` 3. Run the verification command from your terminal: ``` npx hardhat verify --network zircuit <deployed-contract-address> [constructor-arguments] ``` Replace `<deployed-contract-address>`, and `[constructor-arguments]` with your specific details. If the command runs successfully, your contract's page will now display the source code and a **Contract source code verified** badge. ### Manual Verification You will require the following: 1. Deployed Smart Contract: The contract's Zircuit address 2. Solidity Source Code: The solc artifacts in the standard JSON format, or the exact source code as it was at the time of contract deployment + their metadata.json file(s) 3. Compiler Version: The Solidity compiler version used to compile the deployed contract 4. Constructor Arguments: The contract’s constructor arguments during the deployment, if any Follow these steps for verification: 1. Navigate to your smart contract on <https://explorer.zircuit.com> (or [https://explorer.garfield-testnet.zircuit.com](https://explorer.garfield-testnet.zircuit.com/)) and use the search bar to find the smart contract for which you would like to verify the source code. 2. On the contract's page, click on the **Contract** tab. Click on the **Verify and Publish** link. 3. On the next screen, select the compiler version used to compile source code, and upload the source code files. Those can be the [standard json input/output files for solc](https://docs.soliditylang.org/en/v0.8.15/using-the-compiler.html#compiler-api), or Solidity and metadata.json file(s). Click **next**. 4. On the next page, enter the constructor argument data types and values. Use the ABI encoded format or the form, and the system will convert them for you. if using the .sol files, you will also need to upload their respective metadata.json files. When finished, upload the source files and click **Verify and Publish**. If successful, your contract's page will now display the source code and a **Contract Source Code Verified** badge. If the process fails, double-check the compiler version, constructor parameters, and exactness of the source code. # RPCs ## Mainnet ### Zircuit Load-Balanced Endpoint This is the link for Zircuit load-balanced endpoint, that combined all nodes listed in the "Zircuit Isolated Endpoints" section. <table><thead><tr><th width="325">URL</th><th>Supported By</th></tr></thead><tbody><tr><td><a href="https://mainnet.zircuit.com">https://mainnet.zircuit.com</a><br>wss://mainnet.zircuit.com</td><td>Zircuit Team and DRPC (<a href="https://drpc.org">drpc.org</a>)</td></tr></tbody></table> The Chain Id is `48900`. ### Paid Nodes For Advanced Usage The DRPC ([https://drpc.org](https://drpc.org/)) team provides paid node access, offering unlimited high-performance and cost-effective access to the Zircuit network (<https://drpc.org/pricing>). If your application requires higher performance and support, you can get them here. The paid RPC endpoints support debug traces. ## Garfield Testnet ### Zircuit Load-Balanced Endpoint This is the link for Zircuit load-balanced endpoint, that combined all nodes listed in the "Zircuit Isolated Endpoints" section. <table><thead><tr><th width="325">URL</th><th>Support By</th></tr></thead><tbody><tr><td><a href="https://garfield-testnet.zircuit.com/">https://garfield-testnet.zircuit.com</a><br>wss://garfield-testnet.zircuit.com</td><td>Zircuit Team and DRPC (<a href="https://drpc.org">drpc.org</a>)</td></tr></tbody></table> The Chain Id is `48898`. # Running a Node Instructions for running a Zircuit network node Zircuit nodes are maintained by [Conduit](https://www.conduit.xyz/). Conduit provides [instructions](https://docs.conduit.xyz/chains/getting-started/run-a-node/op-stack-nodes) for running network nodes on their website. *** # Oracles Oracles are third-party services that provide smart contracts with external information. They act as a bridge between blockchains and the outside world, enabling smart contracts to access off-chain data. Oracles are essential in expanding the functionality of smart contracts by enabling them to interact with data sources beyond their native networks. There are oracle providers are available on Zircuit, you can learn more about them below. ## Redstone {% embed url="<https://docs.redstone.finance/docs/get-started/price-feeds>" %} RedStone is a modular oracle specializing in providing gas-optimized data feeds and offering price feeds for new LSTs, LRTs, Bitcoin LSTs, and emerging types of stablecoins. Their services are available cross-chain including EVM and non-EVM chains, rollups, and appchains. ## **API3** {% embed url="<https://docs.api3.org/>" %} API3 provides price feed services to smart contracts in a decentralized, trust-minimized way, using first-party oracles, with each source being verifiable on-chain. A key feature of API3 oracles is the ability to fast-track the most accurate asset value through API3's Oracle Extractable Value (OEV) network. API3 focuses on maximizing security and minimizing latency. # Data & Indexing ## Goldsky {% embed url="<https://docs.goldsky.com/subgraphs/introduction>" %} High-performance subgraph hosting and realtime data replication pipelines. ## Sentio {% embed url="<https://docs.sentio.xyz/docs/quickstart>" %} Building the next-generation infrastructure for crypto data, purpose-built for the speed, scale, and complexity of modern blockchain use cases. ## Envio {% embed url="<https://docs.envio.dev/docs/HyperSync/hypersync-quickstart>" %} A specialized indexing solution that focuses on speed. ## SubQuery {% embed url="<https://subquery.network/doc/indexer/quickstart/quickstart.html>" %} An open-source data indexer that provides you with custom APIs for your web3 project. # Relayers A relayer allows users to initiate blockchain transactions without holding the native token required for gas fees. It verifies the user's signature for security, then submits the transaction on their behalf, abstracting away gas payments to enable a smoother user experience. ## Zircuit Relayer Service {% content-ref url="/pages/JJSqglFsocKbvhm6axce" %} [Zircuit Relayer Service](/infra/relayers/zircuit-relayer-service) {% endcontent-ref %} The Zircuit Relayer service is available on Garfield Testnet and allows to batch multiple calls in a single user operation on the Zircuit Block Explorer. Users have to manually delegate to a EIP7702 Contract Template and are then automatically tapped into the feature on the explorer frontend. ## Gelato {% embed url="<https://docs.gelato.cloud/Relay/Introduction/Overview>" %} Gelato Relay is available on Zircuit Mainnet and facilitates secure, gasless transactions by relaying signed messages from users and handling gas payments through multiple supported methods. # Zircuit Relayer Service The Zircuit Relayer service enables click‑to‑build smart‑account transactions directly from our Block Explorer. Users compose ERC‑4337 user operations in the UI and submit them through our managed relayer, with gas fully sponsored for eligible accounts or charged as a small ZRC fee without any ETH required. Behind the scenes, we handle the EIP‑7702 set‑code flow, validation, paymaster signing, bundling, and submission to EntryPoint, so you ship faster without running infrastructure. The result is smoother, cheaper, and safer on‑chain actions—making it effortless to transact more efficiently on the Explorer. ## What You Are Authorizing ### EIP 7702 Relay Service for Sponsored User Operations By signing the delegation tuple you: * **Grant power only to the&#x20;*****Zircuit Smart Contract template*** (`ZircuitRelayerContract`). * **Limit scope** strictly to user operations that you explicitly sign in the Explorer. ### Authorization Signature Required Your signature authorizes the relay contract to forward operations *exactly as you reviewed them*. It cannot modify or craft new calls. ## Security & Control * **Funds never leave your wallet** until the EntryPoint executes the batch. * The relayer **cannot** initiate calls or move funds without your signed intent. * **Revocation:** Submit a fresh EIP‑7702 transaction that clears or changes the delegation at any time. ## Frequently Asked Questions **Q: Do I ever need ETH?**\ \&#xNAN;*A:* No. Either Zircuit sponsors 100 % of gas or you pay with ZRC. **Q: Can the relayer rug me?**\ \&#xNAN;*A:* No! Only if you sign a malicious batch. Always review operations in the side drawer and before signing the user operation in your wallet. **Q: How do I revoke the delegation?**\ \&#xNAN;*A:* Send an EIP‑7702 transaction setting the target address to 0x...0 (cast az). # Enable Relaying Using EIP-7702 To batch transactions and use gas‑sponsored UserOperations with **Zircuit** you must first **delegate your account to the Zircuit Relayer Account** via an **EIP‑7702 `SetCode` transaction**. The guide below shows how to do this securely with Foundry’s `cast` CLI—without ever pasting your private key into the browser. ## Why Delegation Is Required EIP‑7702 lets you temporarily replace your externally‑owned account’s code for a single transaction batch—perfect for ERC‑4337 wallets. Until mainstream wallets such as MetaMask or Rabby add native support for sending a `SetCode` transaction to *arbitrary* addresses, you have to perform the delegation yourself. ## Security Principles * **Never** paste your private key into any website form or browser console. * Export the key only in a hardened, preferably offline shell session. * Once delegation is confirmed, remove the key from your environment. ## Prerequisites Foundry must be installed as described in the official installation guide [here](https://getfoundry.sh/introduction/installation/). {% stepper %} {% step %} **Export your private key in a local terminal** ```bash export PRIVATE_KEY=0xYOUR_PRIVATE_KEY ``` {% endstep %} {% step %} **Send the SetCode transaction to delegate to ZircuitRelayerAccount** {% code overflow="wrap" %} ```bash cast send $(cast az) --auth <ZIRCUIT_RELAYER_ADDRESS> --private-key $PRIVATE_KEY --rpc-url https://mainnet.zircuit.com ``` {% endcode %} {% endstep %} {% step %} **Verify the delegation on** [**https://explorer.zircuit.com**](https://explorer.zircuit.com/)**, verifying your address has been successfully delegated** {% endstep %} {% endstepper %} ## Next Steps ### Contract Details **Zircuit Relayer Account address**: Garfield Testnet: [0xD4f99Ef25e5aAB3A0575D9C2dB2E4f09f18442D8](https://explorer.garfield-testnet.zircuit.com/address/0xD4f99Ef25e5aAB3A0575D9C2dB2E4f09f18442D8?activeTab=3) ```solidity // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.28; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import "@openzeppelin/contracts/interfaces/IERC1271.sol"; import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol"; import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../core/Helpers.sol"; import "../core/BaseAccount.sol"; /** * ZircuitRelayerAccount.sol * A minimal account to be used with EIP‑7702 (for batching) and ERC‑4337 (for gas sponsoring) */ contract ZircuitRelayerAccount is BaseAccount, IERC165, IERC1271, ERC1155Holder, ERC721Holder { address public immutable ZIRCUIT_TOKEN_ADDRESS; address public immutable ZIRCUIT_PAYMASTER_ADDRESS; IEntryPoint public immutable ENTRY_POINT; constructor(address _zircuitTokenAddress, IEntryPoint _entryPoint, address _zircuitPaymasterAddress) { ZIRCUIT_TOKEN_ADDRESS = _zircuitTokenAddress; ENTRY_POINT = _entryPoint; ZIRCUIT_PAYMASTER_ADDRESS = _zircuitPaymasterAddress; } // address of entryPoint v0.8 function entryPoint() public view override returns (IEntryPoint) { return ENTRY_POINT; } /** * Make this account callable through ERC‑4337 EntryPoint. * The UserOperation should be signed by this account's private key. */ function _validateSignature(PackedUserOperation calldata userOp, bytes32 userOpHash) internal virtual override returns (uint256 validationData) { if (!_checkSignature(userOpHash, userOp.signature)) { return SIG_VALIDATION_FAILED; } bytes calldata paymasterAndData = userOp.paymasterAndData; // Check if paymasterAndData exists and has at least the 52‑byte prefix if (paymasterAndData.length >= 52) { // Extract paymaster address from prefix (needed for approve) address paymasterAddress = address(bytes20(paymasterAndData[0:20])); if (paymasterAddress == ZIRCUIT_PAYMASTER_ADDRESS) { // Bytes 52‑83: Packed data (mode + validUntil + validAfter) // Bytes 84‑115: Amount (32 bytes) // Extract packed data (bytes 52‑83) bytes32 packedData; assembly { packedData := calldataload(add(paymasterAndData.offset, 52)) } // Extract mode from packed data (first byte) uint8 mode = uint8(uint256(packedData) >> 248); require(mode <= 1, "Unsupported paymaster mode"); // If mode is 1, approve the paymaster for the specified amount if (mode == 1) { require(paymasterAddress != address(0), "Invalid paymaster address"); // Sanity check uint256 amount; assembly { amount := calldataload(add(paymasterAndData.offset, 84)) } IERC20(ZIRCUIT_TOKEN_ADDRESS).approve(paymasterAddress, amount); } } } return SIG_VALIDATION_SUCCESS; } function isValidSignature(bytes32 hash, bytes memory signature) public view returns (bytes4 magicValue) { return _checkSignature(hash, signature) ? this.isValidSignature.selector : bytes4(0xffffffff); } function _checkSignature(bytes32 hash, bytes memory signature) internal view returns (bool) { return ECDSA.recover(hash, signature) == address(this); } function _requireForExecute() internal view virtual override { require(msg.sender == address(this) || msg.sender == address(ENTRY_POINT), "not from self or EntryPoint"); } function supportsInterface(bytes4 id) public pure override(ERC1155Holder, IERC165) returns (bool) { return id == type(IERC165).interfaceId || id == type(IAccount).interfaceId || id == type(IERC1271).interfaceId || id == type(IERC1155Receiver).interfaceId || id == type(IERC721Receiver).interfaceId; } // accept incoming calls (with or without value), to mimic an EOA. fallback() external payable {} receive() external payable {} } ``` # Using the Zircuit Relayer Service {% stepper %} {% step %} **Open the Explorer** Navigate to [**https://explorer.zircuit.com/user-operations**](https://explorer.zircuit.com/user-operations) {% endstep %} {% step %} **Delegate Your Account** Ensure your wallet’s account is delegated to **`ZircuitRelayerContract`** (one‑time EIP‑7702 delegation). {% endstep %} {% step %} **Compose Your Batch** <figure><img src="https://3252263143-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fp2pPzGBdConDaqw5tnHs%2Fuploads%2Fgit-blob-3dac359d50d0f89c7c6d89692ecb9f0ba16e7988%2FScreenshot%202025-09-15%20at%2012.44.40.png?alt=media" alt=""><figcaption></figcaption></figure> For every *write* call you would normally send as a transaction, click **“Add Call to User Operation”** instead. {% endstep %} {% step %} **Review & Edit** <figure><img src="https://3252263143-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fp2pPzGBdConDaqw5tnHs%2Fuploads%2Fgit-blob-6dec418315f06c45b805304db495f7b2a47684ed%2FScreenshot%202025-09-15%20at%2013.23.16.png?alt=media" alt=""><figcaption></figcaption></figure> Use the side drawer to inspect and, if needed, edit each operation in the batch before signing. {% endstep %} {% step %} **Submit** * **Gas‑sponsored:** Send the batch for free, fully sponsored by Zircuit. * **Low‑fee:** Pay a small amount of **ZRC** (never ETH) for fee processing. Your user operation will appear on‑chain once it passes through the public **EntryPoint** and the **Zircuit Paymaster** {% endstep %} {% endstepper %} # Bridges Bridges provide seamless interoperability between Zircuit and other blockchain networks, enabling the efficient transfer of assets and data across different chains ### Providers <table><thead><tr><th width="249"></th><th>Networks</th><th>Tokens</th></tr></thead><tbody><tr><td><a href="https://bridge.zircuit.com/">Canonical Zircuit Bridge</a></td><td>Ethereum</td><td>ETH, WBTC, LBTC, weETH, weETHs, USDT, ZRC, LsETH, GUD, FBTC, mETH</td></tr><tr><td><a href="https://app.rhino.fi/bridge?mode=pay&#x26;c
프로젝트로 돌아가기