diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json index 02516bedf..546093ecb 100644 --- a/public/locales/en/translation.json +++ b/public/locales/en/translation.json @@ -79,6 +79,7 @@ "developers": { "developers": "Developers", "buildingOnScroll": "Building on Scroll", + "faq": "Frequently Asked Questions", "developerQuickstart": "Developer Quickstart", "verifyingSmartContracts": "Verifying Smart Contracts", "scrollContracts": "Scroll Contracts", diff --git a/src/config/sidebar.ts b/src/config/sidebar.ts index b01cd5c8e..4907e81cb 100644 --- a/src/config/sidebar.ts +++ b/src/config/sidebar.ts @@ -80,7 +80,7 @@ export const getSidebar = () => { section: t("sidebar.developers.developers"), contents: [ { title: t("sidebar.developers.buildingOnScroll"), url: formatUrl("developers") }, - { title: t("sidebar.developers.developerQuickstart"), url: formatUrl("developers/developer-quickstart") }, + { title: t("sidebar.developers.faq"), url: formatUrl("developers/faq") }, { title: t("sidebar.developers.verifyingSmartContracts"), url: formatUrl("developers/verifying-smart-contracts"), @@ -150,10 +150,6 @@ export const getSidebar = () => { { section: t("sidebar.developers.guides"), contents: [ - { - title: t("sidebar.developers.contractDeploymentTutorial"), - url: formatUrl("developers/guides/contract-deployment-tutorial"), - }, { title: t("sidebar.developers.crossChainInteraction"), url: formatUrl("developers/guides/scroll-messenger-cross-chain-interaction"), @@ -188,23 +184,6 @@ export const getSidebar = () => { // }, ], }, - { - section: t("sidebar.whatToBuild.whatToBuild"), - contents: [ - { - title: t("sidebar.whatToBuild.stablecoinPaymentsTutorial"), - url: formatUrl("developers/what-to-build/stablecoin-payments-tutorial"), - }, - { - title: t("sidebar.whatToBuild.solidityCookbook"), - url: formatUrl("developers/what-to-build/solidity-cookbook"), - }, - { - title: t("sidebar.whatToBuild.privacyDappsWithZk"), - url: formatUrl("developers/what-to-build/privacy-dapps-with-zk"), - }, - ], - }, { section: t("sidebar.developers.mainnetResources"), contents: [ diff --git a/src/content/docs/en/developers/developer-quickstart.mdx b/src/content/docs/en/developers/developer-quickstart.mdx deleted file mode 100644 index d2d0f91b0..000000000 --- a/src/content/docs/en/developers/developer-quickstart.mdx +++ /dev/null @@ -1,299 +0,0 @@ ---- -section: developers -date: Last Modified -title: "Developer Quickstart" -lang: "en" -permalink: "developers/developer-quickstart" -excerpt: "Scroll Developer Quickstart helps you acquire testnet Ether, configure your network, and access all of your favorite tooling" -whatsnext: { "Verify Your Smart Contracts": "/en/developers/verifying-smart-contracts" } ---- - -import Aside from "../../../../components/Aside.astro" -import ClickToZoom from "../../../../components/ClickToZoom.astro" -import networkSelection from "./_images/mmNetworkSelection.png" -import injectedProviderMM from "./_images/injectedProviderMM.png" -import ToggleElement from "../../../../components/ToggleElement.astro" -import wagmiDemo from "../../../../assets/images/developers/getting-started/wagmi-demo.png" - -Welcome to the Scroll Developer Quickstart. This guide walks you through building a minimal on-chain app, from installing tooling to deploying contracts on Scroll and connecting it to a React frontend. - - -## What You'll Build - -By the time you're done, you'll have: -- Installed developer tooling. -- Deployed a Counter smart contract on Scroll by using Foundry. -- Created a React frontend (with wagmi and Viem) to read from and write to your contract. - - -_What you'll build: a hello world dApp on Scroll connecting a React frontend to a contract you deployed._ - -## Why Scroll? - -Scroll is a high performance, EVM equivalent zkEVM Layer 2 designed to help developers build secure, low-cost, and engaging applications. Because Scroll is fully bytecode compatible with the EVM, your existing development and testing tools work out of the box, just configure them to use a Scroll RPC provider. - -If you run into any issues, please reach out in [our Discord](https://discord.gg/scroll). - -## Install and Configure Foundry - -We'll use Foundry to compile and deploy our Counter contract. - -Create a folder for the contract: - -```bash -# create a new contracts directory -mkdir contracts -cd contracts -# install and update foundry if you haven't -curl -L https://foundry.paradigm.xyz | bash -foundryup -# initialize a fresh Foundry project -forge init --no-git -``` - -## Configure Environment Variables - -To deploy your smart contracts on Scroll, you need two key components: -- An RPC node connection to interact with the Scroll network: https://sepolia-rpc.scroll.io/ -- A funded private key to deploy the contract - - - -Let's set up both of these: - -`.env` -```bash -SCROLL_SEPOLIA_RPC_URL="https://sepolia-rpc.scroll.io/" -PRIVATE_KEY= -``` - -Also be sure you don't upload this to a public repo by setting up a `.gitignore`. - -`.gitignore` -```bash -.env -``` - -If you don't have Sepolia test ETH yet, join our [Telegram faucet](https://t.me/+0tvdw8QMJBMyOTli) and send `/drop YOUR_ADDRESS` to receive Sepolia ETH on Scroll. - - - -## Deploy Your Smart Contract - -With Foundry set up and `.env` in place, deploy the Counter contract. - -In the contracts directory, run: - -```bash -source .env -forge create src/Counter.sol:Counter \ - --rpc-url $SCROLL_SEPOLIA_RPC_URL \ - --broadcast \ - --private-key $PRIVATE_KEY -``` - -After deployment, you'll see something like: - -```bash -[⠊] Compiling... -No files changed, compilation skipped -Deployer: 0xbef34f2FCAe62dC3404c3d01AF65a7784c9c4A19 -Deployed to: 0xf0e9ceCAE516B2F5Ac297B3857453b07455f817F -Transaction hash: 0x2bca5934ad82ce26332847fdd6a9241b0da0e38e6928f06499ee58ebc967bbde -``` - -Copy the address under `Deployed to:`. You'll need it when configuring the frontend. - -## Create and Configure the React Frontend - -We'll build a simple React app (using Vite, wagmi, and Viem) that connects to MetaMask (or another injected provider) and interacts with the Counter contract. - -From the root of your project: - -```bash -cd .. -pnpm create wagmi frontend -t vite-react -cd frontend -pnpm install -``` - -This scaffolds a new Vite + React + wagmi template. - -Now add the smart contract address you just deployed to the `.env.local` file. - -`.env.local` -```bash -VITE_COUNTER_CONTRACT_ADDRESS=0xYourNewContractAddress -``` - -## Implement the Frontend Logic - -Create a new `Counter` component on `src/components/Counter.tsx` that is able to read and write to our smart contract. - -`src/components/Counter.tsx` -```tsx -import { useAccount, useWriteContract } from 'wagmi' -import { createPublicClient, http } from 'viem' -import { scrollSepolia } from 'viem/chains' -import { useState, useEffect } from 'react' - -const COUNTER_CONTRACT_ADDRESS = import.meta.env.VITE_COUNTER_CONTRACT_ADDRESS as `0x${string}` - -// Connect your client to Scroll Sepolia -const publicClient = createPublicClient({ - chain: scrollSepolia, - transport: http() -}) - -// Define the ABI so we can interact with the contract from TS -const counterABI = [ - { - inputs: [], - name: "increment", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "number", - outputs: [{ type: "uint256" }], - stateMutability: "view", - type: "function", - }, -] as const - -// Custom hook for counter functionality -function useCounter() { - const [number, setNumber] = useState(null) - const { writeContract, isPending: isIncrementing } = useWriteContract() - const fetchNumber = async () => { - try { - const result = await publicClient.readContract({ - address: COUNTER_CONTRACT_ADDRESS, - abi: counterABI, - functionName: 'number', - }) - setNumber(result) - } catch (error) { - console.error('Error reading contract:', error) - } - } - useEffect(() => { - fetchNumber() - }, []) - const increment = () => { - writeContract({ - address: COUNTER_CONTRACT_ADDRESS, - abi: counterABI, - functionName: 'increment', - }, { - onSuccess: (txHash) => { - publicClient.waitForTransactionReceipt({ hash: txHash }) - .then(() => fetchNumber()) - .catch(console.error) - }, - }) - } - return { - number, - isIncrementing, - increment, - refreshNumber: fetchNumber - } -} -// Counter Component -export function Counter() { - const account = useAccount() - const { number, isIncrementing, increment } = useCounter() - return ( -
-

Counter

-

Current number: {number?.toString()}

- {account.status === 'connected' && ( - - )} -
- ) -} -``` - -Now let's add our new component into `src/App.tsx`. - -```ts -import { useAccount, useConnect, useDisconnect } from 'wagmi' -// Import our newly created component -import { Counter } from './components/Counter' - -function App() { - const account = useAccount() - const { connectors, connect, error } = useConnect() - const { disconnect } = useDisconnect() - - return ( -
-
-

Wallet

- {account.status === 'connected' ? ( - <> -

Connected: {account.addresses?.[0]}

- - - ) : ( - <> - {connectors.map((connector) => ( - - ))} - {error &&

{error.message}

} - - )} -
- - {/* Use the Counter component in our dApp */} - -
- ) -} - -export default App -``` - -## Start the Frontend - -Start your development server: - -```bash -pnpm run dev -``` - -Open your browser at http://localhost:5173 or whatever Vite shows. You should see wallet connection buttons and an increment button. First, click the connect wallet button corresponding to the wallet you installed and then click the increment button to see the number going up. - -## Ready to go live? - -When you’re ready to switch to mainnet, simply replace the Sepolia RPC URL with the Scroll mainnet RPC URL in your environment: `https://rpc.scroll.io/`. In your React code, update the Viem client to use `scroll` instead of `scrollSepolia`: - -```ts -import { scroll } from 'viem/chains' - -const publicClient = createPublicClient({ - chain: scroll, - transport: http(), -}) -``` - -This change tells Viem to point at the live Scroll chain rather than Sepolia. All of your existing contract reads and writes will now go to mainnet. \ No newline at end of file diff --git a/src/content/docs/en/developers/faq.mdx b/src/content/docs/en/developers/faq.mdx new file mode 100644 index 000000000..692d1abd2 --- /dev/null +++ b/src/content/docs/en/developers/faq.mdx @@ -0,0 +1,67 @@ +--- +section: developers +date: Last Modified +title: "Developer Frequently Asked Questions" +lang: "en" +permalink: "developers/faq" +whatsnext: { "L1 & L2 Bridging": "/en/developers/getting-started/" } +excerpt: "." +--- + +## EVM Compatibility & Infrastructure + +**What are the opcode differences on Scroll compared to Ethereum?** + +Scroll is fully EVM-equivalent, but certain rollup-specific opcodes differ. A full breakdown can be found here: [Rollup Codes: Scroll Overview](https://www.rollup.codes/scroll#overview). + +## Testnet ETH + +**How do I get testnet ETH on Scroll?** + +You can request testnet ETH via the official Scroll telegram faucet bot by sending a message to @scroll_up_sepolia_bot who will provide access to the faucet. Once on the faucet telegram group chat, send your wallet address on a `/drop YOUR_ETHEREUM_ADDRESS` command and the bot will automatically send some funds to you. + +**Is there an alternative way to get testnet ETH?** + +Yes. Please refer to our list of [Unofficial Faucets](https://docs.scroll.io/en/user-guide/faucet/) on both Sepolia and Scroll Sepolia. Remember, you can either receive Scroll Sepolia ETH directly or trough the [Sepolia Testnet Bridge](https://sepolia.scroll.io/bridge). + +## Developer Tooling & Ecosystem + +**Where can I find the list of developer tooling available on Scroll?** + +See the full list here: [Scroll Developer Tooling](https://docs.scroll.io/en/developers/tooling-deployed-on-scroll/). + +**Where can I explore the ecosystem of projects deployed on Scroll?** + +The live ecosystem page is here: [Scroll Ecosystem Data page](https://docs.scroll.io/en/developers/developer-ecosystem/) and the full list [Scroll Ecosystem Projects](https://scroll.io/ecosystem). + +## Node Questions + +**Where can i download Scroll node's snapshot?** + +Mainnet : https://scroll-geth-snapshot.s3.us-west-2.amazonaws.com/mpt/latest.tar + +Sepolia : https://scroll-sepolia-l2geth-snapshots.s3.us-west-2.amazonaws.com/mpt/latest.tar + +**Scroll snapshot size is too large, do you have pruned snapshot?** + +Unfortunately, pruned snapshots are not available for Scroll. You may consider changing the garbage collection mode from archive to full to reduce the size of the snapshot by changing flag from --gcmode archive to --gcmode full + +**Can I run my own node on Scroll?** + +Yes. Scroll provides a step-by-step tutorial for setting up and running your own node. See: [Running a Node](https://docs.scroll.io/en/developers/guides/running-a-scroll-node/). + +## Errors & Support + +**I have a question about my node, the faucet or developing on Scroll. What should I do?** + +Please join the Scroll Discord server and ask on the `#developers` or `#developer-support` discord channels. + +**I want to connect to the BD team. What should I do?** + +To connect with the BD team please fill the [Scroll BD Intake form](https://tally.so/r/wM2aaE). + +**How to keep track of any changes in Scroll?** + +You can follow our telegram announcement channel [here](https://t.me/scroll_tech_announcements). + +Or subscribe to our github [repo](https://github.com/scroll-tech/scroll), click watch, then custom, and tick releases. \ No newline at end of file diff --git a/src/content/docs/en/developers/guides/contract-deployment-tutorial.mdx b/src/content/docs/en/developers/guides/contract-deployment-tutorial.mdx deleted file mode 100644 index 7cf3d90ee..000000000 --- a/src/content/docs/en/developers/guides/contract-deployment-tutorial.mdx +++ /dev/null @@ -1,84 +0,0 @@ ---- -section: developers -date: Last Modified -title: "Contract Deployment Tutorial" -lang: "en" -permalink: "developers/guides/contract-deployment-tutorial" -excerpt: "The Scroll Sepolia Testnet allows the community to deploy smart contracts on Scroll. In this tutorial, we will teach you how to deploy a contract on Scroll Sepolia." -whatsnext: { "Scroll Messenger Cross-chain Interaction": "/en/developers/guides/scroll-messenger-cross-chain-interaction/" } ---- - -import Aside from "../../../../../components/Aside.astro" - -The Scroll Sepolia Testnet allows anyone to deploy a smart contract on Scroll. In this tutorial, you will learn how to deploy a contract on Scroll Sepolia using common tools for developing on Ethereum. This [demo repo](https://github.com/scroll-tech/scroll-guides/tree/main/contract-deploy-demo) illustrates contract deployment with [Hardhat](https://hardhat.org/) and [Foundry](https://github.com/foundry-rs/foundry). - - - -## Deploy contracts with Hardhat - -1. If you haven't already, install [nodejs](https://nodejs.org/en/download/) and [yarn](https://classic.yarnpkg.com/lang/en/docs/install). -2. Clone the repo and install dependencies: - - ```shell - git clone https://github.com/scroll-tech/scroll-guides.git - cd scroll-guides/contract-deploy-demo - yarn install - ``` - -3. Create a `.env` file following the example `.env.example` in the root directory. Change `PRIVATE_KEY` to your own account private key in the `.env`. - -4. Run `yarn compile` to compile the contract. - -5. Run `yarn deploy:scrollTestnet` to deploy the contract on the Scroll Sepolia Testnet. - -6. Run `yarn test` for hardhat tests. - -## Deploy contracts with Foundry - -1. Clone the repo: - - ```shell - git clone https://github.com/scroll-tech/scroll-guides.git - cd scroll-guides/contract-deploy-demo - ``` - -2. Install Foundry: - - ```shell - curl -L https://foundry.paradigm.xyz | bash - foundryup - ``` - -3. Run `forge build` to build the project. - -4. Deploy your contract with Foundry: - - ```bash - forge create --rpc-url https://sepolia-rpc.scroll.io/ \ - --value \ - --constructor-args \ - --private-key \ - contracts/Lock.sol:Lock - ``` - - - `` is the amount of test `ETH` to be locked in the contract. Try setting this to some small amount, like `0.0000001ether`. - - `` is the Unix timestamp after which the funds locked in the contract will become available for withdrawal. Try setting this to some Unix timestamp in the future, like `1696118400` (this Unix timestamp corresponds to October 1, 2023). - - For example: - - ```bash - forge create --rpc-url https://sepolia-rpc.scroll.io/ \ - --value 0.00000000002ether \ - --constructor-args 1696118400 \ - --private-key 0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1 \ - contracts/Lock.sol:Lock - ``` - -## Questions and Feedback - -Thank you for participating in and developing on the Scroll Sepolia Testnet! If you encounter any issues, join our [Discord](https://discord.gg/scroll) and ask us in the `#testnet-devs` channel. diff --git a/src/content/docs/en/developers/what-to-build/privacy-dapps-with-zk.mdx b/src/content/docs/en/developers/what-to-build/privacy-dapps-with-zk.mdx deleted file mode 100644 index a87654589..000000000 --- a/src/content/docs/en/developers/what-to-build/privacy-dapps-with-zk.mdx +++ /dev/null @@ -1,437 +0,0 @@ ---- -section: developers -date: Last Modified -title: "Privacy dApps with ZK" -lang: "en" -permalink: "what-to-build/privacy-dapps-with-zk" -excerpt: "Build dApps with privacy by default on Scroll" -whatsnext: { "Verify Your Smart Contracts": "/en/developers/verifying-smart-contracts" } ---- - -import Aside from "../../../../../components/Aside.astro" -import ClickToZoom from "../../../../../components/ClickToZoom.astro" -import ToggleElement from "../../../../../components/ToggleElement.astro" -import proofSteps from "../../../../../assets/images/developers/privacy-dapps-with-zk/proof-steps.png" -import zkDapp from "../../../../../assets/images/developers/privacy-dapps-with-zk/zk-dapp.png" - - -Scroll has been a pioneer in zk dapp support from the start, enabling tools like Circom, Noir, and ZoKrates. Today, we're building a privacy-focused app that leverages Scroll’s low fees, fast blocks, and zk-native guarantees to unlock new use cases. - -Users need privacy in finance, identity, and social interactions but web3 is public by design. The solution is browser-based proving: generating zk proofs locally, before any data touches the internet. This keeps user data secure and private by default. - - -_In order to keep the paramaters private, they should never get out of the browser_ - -Let's get to know, with a practical and simple example, how to create interfaces that make use of zk-wasm, the technology that makes this possible. - -## Dependencies - -For this example, we will use Circom. If you don't have it installed, you can do so with the following commands. - -```bash -curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh -git clone https://github.com/iden3/circom.git -cd circom -cargo build --release -cargo install --path circom -npm install -g snarkjs -``` - -## 1. Create a circuit - -We'll create a very simple example: generating a computation proof for a multiplication a*b=c while keeping a and b private. This will make a solid starting point before building real use cases. - -Circom allows us to create circuits that generate execution proofs while obfuscating the parameters. - -Start by creating the following circuit: - -`myCircuit.circom` - -```js -pragma circom 2.0.0; - -template Multiplier() { - signal input a; - signal input b; - signal output c; - c <== a*b; - } - - component main = Multiplier(); -``` - -Now compile it and generate the artifacts that we will use later. - -```bash -circom myCircuit.circom --r1cs --wasm --sym -snarkjs powersoftau new bn128 12 pot12_0000.ptau -v -snarkjs powersoftau contribute pot12_0000.ptau pot12_0001.ptau --name="First contribution" -v -snarkjs powersoftau prepare phase2 pot12_0001.ptau pot12_final.ptau -v -snarkjs groth16 setup myCircuit.r1cs pot12_final.ptau myCircuit_0000.zkey -snarkjs zkey contribute myCircuit_0000.zkey myCircuit_0001.zkey --name="1st Contributor Name" -v -snarkjs zkey export verificationkey myCircuit_0001.zkey verification_key.json -``` - -## 2. Deploy the contracts - -The following command will generate a verifier contract in the `verifier.sol` file. Deploy it on Scroll testnet by using the framework of your choice (we recommend either [Remix](https://remix.ethereum.org/) for a borwser experience or Foundry as detailed in our [getting started guide](https://docs.scroll.io/en/developers/developer-quickstart/#deploy-your-smart-contract)). This contract contains the `verifyProof()` function, which takes a computation proof made with our circuit as a parameter and returns true if the proof is correct. - -```bash -snarkjs zkey export solidityverifier myCircuit_0001.zkey verifier.sol -``` - -Now deploy the following custom logic contract, passing the address of the verifier contract we deployed earlier as a constructor parameter. In this contract, you can add any desired logic in Solidity, such as vote counting in a voting system or the reception or sending of ERC20 tokens in an anonymous DeFi system. In this example, we will only store the result of the multiplication we did in our circuit. - -```javascript -// SPDX-License-Identifier: MIT - -pragma solidity >=0.7.0 <0.9.0; - -// Interface that allows verifing proofs by sending them as a call to the verifier contract we just deployed -interface ICircomVerifier { - function verifyProof(uint[2] calldata _pA, uint[2][2] calldata _pB, uint[2] calldata _pC, uint[1] calldata _pubSignals) external view returns (bool); -} - -// Contract that demonstrates the typical structure of a ZK verifer with custom logic in Solidity -contract CircomCustomLogic { - ICircomVerifier circomVerifier; - uint public publicInput; - - // Recieves a valid circom verifer contract address that was autogenerated by snarkjs - constructor(address circomVeriferAddress) { - circomVerifier = ICircomVerifier(circomVeriferAddress); - } - - // Typical proof verifying function, execute custom logic if the proof passed as parameter is correct - function sendProof(uint[2] calldata _pA, uint[2][2] calldata _pB, uint[2] calldata _pC, uint[1] calldata _pubSignals) public { - // ZK verification - circomVerifier.verifyProof(_pA, _pB, _pC, _pubSignals); - - // Your custom logic, in this case just storing the multiplication result - publicInput = _pubSignals[0]; - } -} -``` - -## 3. Build a frontend - -Let's start by creating a new wagmi frontend in react with the snarkjs dependency that will help us building ZK proofs. - -```bash -cd .. -pnpm create wagmi zk-tutorial -t vite-react -cd frontend -pnpm install snarkjs -``` - -Now create this file structure where you populate the `zk_artifacts` with the build result in your circuit drectory and add the typescript files as detailed below: - -``` -zk-tutorial/ -├── public/ -│ └── zk_artifacts/ -│ ├── myCircuit.wasm -│ ├── myCircuit_final.zkey -│ └── verification_key.json -├── src/ -│ ├── components/ -│ │ └── ZKForm.tsx -│ └── App.tsx -├── index.html -├── tsconfig.json -├── env.local -└── package.json -``` - - - -Add the address of the `CircomCustomLogic` you just deployed to the environment files. - -`zk-tutorial/env.local` -```bash -VITE_COUNTER_CONTRACT_ADDRESS=0xYourNewContractAddress -``` - -Now implement the ZK and web3 logic in a new component. - -`zk-tutorial/src/components/ZKForm.tsx` -```ts -// src/components/ZKForm.tsx -import { useAccount, useWriteContract } from 'wagmi' -import { createPublicClient, http } from 'viem' -import { scrollSepolia } from 'viem/chains' -import { useState, useEffect } from 'react' -import { groth16 } from "snarkjs"; - -// Custom logic contract we just deployed -const CONTRACT_ADDRESS = import.meta.env.VITE_CIRCOM_CUSTOM_LOGIC_CONTRACT_ADDRESS as `0x${string}` - -// In this tutorial we'll use Scroll Sepolia, but this code can also be used on Scroll Mainnet or any EVM chain that supports all precompiles needed for ZK proof -const publicClient = createPublicClient({ - chain: scrollSepolia, - transport: http() -}) - -// Custom logic contract ABI to be able to send proofs on-chain -const verifierAbi = [ - { - "inputs": [ - { - "internalType": "uint256[2]", - "name": "_pA", - "type": "uint256[2]" - }, - { - "internalType": "uint256[2][2]", - "name": "_pB", - "type": "uint256[2][2]" - }, - { - "internalType": "uint256[2]", - "name": "_pC", - "type": "uint256[2]" - }, - { - "internalType": "uint256[1]", - "name": "_pubSignals", - "type": "uint256[1]" - } - ], - "name": "sendProof", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "publicInput", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -] as const - -// Function responsible to generate private computation on the browser and then sending the computation proof on-chain -function useZKForm() { - const [a, setA] = useState("") - const [b, setB] = useState("") - const [message, setMessage] = useState("Connect your wallet") - const [publicInput, setPublicInput] = useState(null) - const { writeContract, isPending: isSendingProof } = useWriteContract() - - // Reads the contract state, in this case the multiplication result that was previously submmited - const fetchPublicInput = async () => { - try { - const result = await publicClient.readContract({ - address: CONTRACT_ADDRESS, - abi: verifierAbi, - functionName: "publicInput", - }) - setPublicInput(Number(result)) - } catch (err) { - console.error("Error fetching public input:", err) - } - } - - // Generates the ZK proof based on private parameters, and then sends the proofs to the smart contract on Scroll - const sendProof = async () => { - setMessage("Generating proof...") - - // Let's start by generating a proof by passing private inputs and the ZK artifacts generated by the circom compiler - // Notice the ZK artifacts should be shared publicly in your website - const { proof, publicSignals } = await groth16.fullProve( - { a: Number(a), b: Number(b) }, - "./zk_artifacts/myCircuit.wasm", - "./zk_artifacts/myCircuit_final.zkey" - ) - - // Now let's verify the proof locally, this is optional - setMessage("Verifying off‑chain...") - const vkey = await fetch("/verification_key.json").then((r) => - r.json() - ) - const valid = await groth16.verify(vkey, publicSignals, proof) - if (!valid) { - setMessage("Proof verification failed") - return - } - - // We now translate the proof in a format compatible with what our smart contract expects - const pA = proof.pi_a.slice(0, 2) // Take first two elements - const pB = proof.pi_b.slice(0, 2).map((row: string[]) => row.slice(0, 2)) - const pC = proof.pi_c.slice(0, 2) - - // Once the proof is ready we send it on-chain - setMessage("Proof generated please confirm transaction.") - writeContract({ - address: CONTRACT_ADDRESS, - abi: verifierAbi, - functionName: "sendProof", - args: [pA, pB, pC, publicSignals], - }, { - onSuccess: (txHash) => { - setMessage("Executing...") - publicClient.waitForTransactionReceipt({ hash: txHash }) - .then(() => { - setMessage("Success!") - fetchPublicInput() - }) - .catch((err) => { - console.error("ERROR! Transaction reverted:", err) - setMessage("Transaction failed") - }) - }, - onError: (err) => { - console.error("ERROR! Transaction reverted:", err) - setMessage("Transaction failed") - } - }) - } - - return { - a, - setA, - b, - setB, - message, - publicInput, - isSendingProof, - sendProof, - fetchPublicInput - } -} - -// React UI that handles contract reads, and private inputs for the ZK proof generation -export default function ZKForm() { - const account = useAccount() - const { - a, setA, - b, setB, - message, - publicInput, - isSendingProof, - sendProof, - fetchPublicInput - } = useZKForm() - - useEffect(() => { - if (account.status === 'connected') { - fetchPublicInput() - } - }, [account.status, fetchPublicInput]) - - return ( -
-

ZK Multiplication

-

{message}

- setA(e.target.value)} - /> - setB(e.target.value)} - /> - {account.status === 'connected' && ( - - )} - {publicInput !== null && ( -

- Last stored result: {publicInput} -

- )} -
- ) -} -``` - -Add the new component to your app. - -`zk-tutorial/src/App.tsx` -```ts -import { useAccount, useConnect, useDisconnect } from 'wagmi' -// Import your ZKForm -import ZKForm from "./components/ZKForm"; - -function App() { - const account = useAccount() - const { connectors, connect, status, error } = useConnect() - const { disconnect } = useDisconnect() - - return ( - <> -
-

Account

- -
- status: {account.status} -
- addresses: {JSON.stringify(account.addresses)} -
- chainId: {account.chainId} -
- - {account.status === 'connected' && ( - - )} -
- -
-

Connect

- {connectors.map((connector) => ( - - ))} -
{status}
-
{error?.message}
-
- -
-

ZK Tutorial

- -
- - ) -} - -export default App -``` - -Finally, start the frontend. - -``` -pnpm run dev -``` - - -_Once everything is ready this is how your app should look like_ - - -Now that you know the core parts of a zkDapp you can start experimenting with real use cases. ZK has demonstrated to serve DeFi, DiD, gamming and more. We're excited to see what you will build on Scroll! \ No newline at end of file diff --git a/src/content/docs/en/developers/what-to-build/solidity-cookbook.mdx b/src/content/docs/en/developers/what-to-build/solidity-cookbook.mdx deleted file mode 100644 index 6e4f153f5..000000000 --- a/src/content/docs/en/developers/what-to-build/solidity-cookbook.mdx +++ /dev/null @@ -1,186 +0,0 @@ ---- -section: developers -date: Last Modified -title: "Solidity Cookbook" -lang: "en" -permalink: "what-to-build/solidity-cookbook" -excerpt: "Solidity snipets to plug into your contracts. DeFi integrations and more." -whatsnext: { "Verify Your Smart Contracts": "/en/developers/verifying-smart-contracts" } ---- - -Smart contracts are open and interoperable by default. Scroll’s ecosystem includes both established blue-chip protocols and native projects. Below is a collection of Solidity code snippets you can use to easily integrate DeFi and more into your contracts. - -Did we miss an important protocol, or do you want to add your own? Send us a PR [here](#TODO). - -## Lend on Aave - -Supplying assets to Aave serves two functions: earning yield and providing collateral for loans. By depositing any idle tokens from your protocol into Aave, you create a sustainable revenue stream either for your platform or your users. Additionally, you can integrate Aave’s lending features directly into your app or abstract the borrowing experience behind your own interface. - -In the following example we will supply USDC to Aave to generate yield. You will be able to see your supplied assets and also other Markets available at [app.aave.com](https://app.aave.com/). Currently ETH, USDC, weETH, wstETH and SCR are supported. - -Learn more at Aave's [official docs](https://aave.com/docs/developers/smart-contracts/pool#write-methods-supply). - - -```solidity -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.13; - -// Import Openzeppelin's IERC20 to interact with XXX and Aave's IPool to interact with the supply API -import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import {IPool} from "https://github.com/aave/aave-v3-core/blob/master/contracts/interfaces/IPool.sol"; - -// Demonstrates how to supply tokens into the Scroll Aave pools -contract AaveScrollDemo { - address public immutable AAVE_POOL_ADDRESS = 0x11fCfe756c05AD438e312a7fd934381537D3cFfe; // Aave pool on Scroll Mainnet - address public immutable USDC_ADDRESS = 0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4; // USDC token on Scroll Mainnet - - // Supply tokens to the Aave pool on behalf of the sender - // Important: You need to approve this contract before calling this, also remember USDC uses 6 decimals. Approve here: https://scrollscan.com/token/0x06efdbff2a14a7c8e15944d1f4a48f9f95f663a4#writeProxyContract#F1 - function stake(uint amount) public { - // First we transfer the USDC from the sender into this contract and approve the Aave Pool - IERC20(USDC_ADDRESS).transferFrom(msg.sender, address(this), amount); - IERC20(USDC_ADDRESS).approve(AAVE_POOL_ADDRESS, amount); - // Next we call the supply function - IPool(AAVE_POOL_ADDRESS).supply( - USDC_ADDRESS, - amount, - msg.sender, - 0); - // After the transaction succeeds you should be able to see your supply at app.aave.com - } -} -``` - -## Query Chainlink Price Feeds - -Chainlink has been an historical backbone in DeFi. In this demo we query the bitcoin price on Scroll Mainnet. - -See the complete list of price feeds in the [official documentation](https://docs.chain.link/data-feeds/price-feeds/addresses?page=1&testnetPage=1&network=scroll#scroll-mainnet). - -```solidity -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.7; - -// Import Chainlink's aggregator interface that exposes many data feeds -import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; - -// Demonstrates how to query Bitcoin price in Scroll Mainnet -contract ChainlinkScrollDemo { - // Connect your contract with the Bitcoin price provider - AggregatorV3Interface internal dataFeed = AggregatorV3Interface( - 0xCaca6BFdeDA537236Ee406437D2F8a400026C589 - ); - - // View function that returns the current Bitcoin price - function getChainlinkDataFeedLatestAnswer() public view returns (int) { - // prettier-ignore - ( - /* uint80 roundID */, - int answer, - /*uint startedAt*/, - /*uint timeStamp*/, - /*uint80 answeredInRound*/ - ) = dataFeed.latestRoundData(); - return answer; - } -} -``` - -## Attest to Anything on Ethereum Attestation Service - -Define custom schemas and issue attestations for anything, from digital identities to DeFi events, by using the EAS. You can interact with EAS directly on Scroll’s [EAScan](https://scroll.easscan.org/) or integrate it into your own smart contracts. - -Next, we’ll demonstrate how to issue a “friendship attestation” from a smart contract, certifying that the controller of a given address is your friend. - -For full details on EAS and its APIs, refer to the [official documentation](https://docs.attest.org/docs/welcome). - -```solidity -// SPDX-License-Identifier: MIT - -pragma solidity ^0.8.24; - -import { IEAS, AttestationRequest, AttestationRequestData, RevocationRequest, RevocationRequestData } from "@ethereum-attestation-service/eas-contracts/contracts/IEAS.sol"; -import { NO_EXPIRATION_TIME, EMPTY_UID } from "@ethereum-attestation-service/eas-contracts/contracts/Common.sol"; - -contract EASScrollDemo -{ - address easAddress = 0xaEF4103A04090071165F78D45D83A0C0782c2B2a; - bytes32 schema = 0x27d06e3659317e9a4f8154d1e849eb53d43d91fb4f219884d1684f86d797804a; - - // check at https://scroll-sepolia.easscan.org/schema/view/0x27d06e3659317e9a4f8154d1e849eb53d43d91fb4f219884d1684f86d797804a - - function sendIsFriend(address to, bool isFriend) public returns(bytes32) - { - return IEAS(easAddress).attest( - AttestationRequest({ - schema: schema, - data: AttestationRequestData({ - recipient: to, - expirationTime: NO_EXPIRATION_TIME, - revocable: false, - refUID: EMPTY_UID, - data: abi.encode(isFriend), - value: 0 // No value/ETH - }) - }) - ); - } -} -``` - -## Swap Tokens on Uniswap V3 - -Uniswap V3 is a leading DEX protocol that enables token swaps and concentrated liquidity. You can integrate Uniswap V3 swaps directly into your contracts using the ISwapRouter interface. Below is an example of how to swap USDC for WETH on Scroll Mainnet. Important note: keep in mind that currently, in Scroll, most liquidity is onther DEXes other than Uniswap V3. - -Learn more at Uniswap [V3 Core Docs](https://docs.uniswap.org/contracts/v3/reference/periphery/interfaces/ISwapRouter). - -```solidity -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.13; - -// Import the OpenZeppelin's IERC20 so we can interacts with ERC20 tokens -import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; - -// Uniswap v3 Router (Rollups version) deployed on Scroll -interface ISwapRouter { - struct ExactInputSingleParams { - address tokenIn; - address tokenOut; - uint24 fee; - address recipient; - uint256 amountIn; - uint256 amountOutMinimum; - uint160 sqrtPriceLimitX96; - } - function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut); -} - -// Demonstrates how to make a swap from within a smart contract on uniswap v3 on Scroll Mainnet -contract UniV3ScrollDemo { - ISwapRouter public immutable swapRouter = ISwapRouter(0xfc30937f5cDe93Df8d48aCAF7e6f5D8D8A31F636); - address public constant USDC = 0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4; // USDC on Scroll Mainnet - address public constant WETH9 = 0x5300000000000000000000000000000000000004; // WETH on Scroll Mainnet - uint24 public constant poolFee = 500; // 0.05% - - // Swaps a specified amount of USDC for WETH - function swapUSDCForWETH(uint256 amountIn) external returns (uint256 amountOut) { - // Transfer DAI from sender to this contract and approve the Uniswap Router - IERC20(USDC).transferFrom(msg.sender, address(this), amountIn); - IERC20(USDC).approve(address(swapRouter), amountIn); - - // Set up the swap parameters - ISwapRouter.ExactInputSingleParams memory params = ISwapRouter.ExactInputSingleParams({ - tokenIn: USDC, - tokenOut: WETH9, - fee: poolFee, - recipient: msg.sender, - amountIn: amountIn, - amountOutMinimum: 0, // WARNING: Set to 0 for simplicity; consider slippage in production - sqrtPriceLimitX96: 0 - }); - - // Execute the swap - amountOut = swapRouter.exactInputSingle(params); - } -} -``` \ No newline at end of file diff --git a/src/content/docs/en/developers/what-to-build/stablecoin-payments-tutorial.mdx b/src/content/docs/en/developers/what-to-build/stablecoin-payments-tutorial.mdx deleted file mode 100644 index a646620f3..000000000 --- a/src/content/docs/en/developers/what-to-build/stablecoin-payments-tutorial.mdx +++ /dev/null @@ -1,419 +0,0 @@ ---- -section: developers -date: Last Modified -title: "Stablecoin Payments Tutorial" -lang: "en" -permalink: "developers/stablecoin-payments-tutorial" -excerpt: "Learn how to build a dApp that processes USDT payments and mints NFTs as receipts on Scroll" -whatsnext: { "Verify Your Smart Contracts": "/en/developers/verifying-smart-contracts" } ---- - -import Aside from "../../../../../components/Aside.astro" -import ClickToZoom from "../../../../../components/ClickToZoom.astro" -import ToggleElement from "../../../../../components/ToggleElement.astro" -import paymentDApp from "../../../../../assets/images/developers/stablecoin-payments-tutorial/payment-dapp.png" -import nftRecipt from "../../../../../assets/images/developers/stablecoin-payments-tutorial/nft-recipt.png" - -Welcome to the Scroll Stablecoin Payments Tutorial. This guide walks you through building a dApp that processes USDT payments and mints NFTs as receipts, from smart contract development to frontend integration. - - - -## What You'll Build - -By the time you're done, you'll have: -- Deployed a PaymentProcessor smart contract that handles USDT payments -- Created a React frontend that enables users to approve and make payments -- Implemented NFT minting as payment receipts -- Connected everything to Scroll's network - - -_What you'll build: a payments app that processes USDT payments and mints NFTs as recipts._ - - - -If you run into any issues, please reach out in [our Discord](https://discord.gg/scroll). - -## Install and Configure Foundry - -We'll use Foundry to compile and deploy our `PaymentProcessor` contract. - -Create a folder for the contract: - -```bash -# create a new contracts directory -mkdir contracts -cd contracts -# install and update foundry if you haven't -curl -L https://foundry.paradigm.xyz | bash -foundryup -# initialize a fresh Foundry project -forge init --no-git -# install openzeppelin contracts -npm install @openzeppelin/contracts -``` - -## Configure Contract Dependencies - -Create a `remappings.txt` file to help Foundry locate the OpenZeppelin contracts: - -`remappings.txt` -``` -openzeppelin-contracts/=node_modules/@openzeppelin/contracts/ -``` - - -`src/PaymentProcessor.sol` -```solidity -// SPDX-License-Identifier: MIT -// Compatible with OpenZeppelin Contracts ^5.0.0 -pragma solidity ^0.8.27; - -import {ERC721} from "openzeppelin-contracts/token/ERC721/ERC721.sol"; -import {IERC20} from "openzeppelin-contracts/token/ERC20/IERC20.sol"; - -// The following contract will process payments from users by debiting the item price and minting an NFT as recipt -contract PaymentProcessor is ERC721 { - // Internal NFT counter for ID generation - uint _nextTokenId; - // NFT metadata url for our demo - string _tokenURI = "https://raw.githubusercontent.com/Turupawn/erc721-nft-metadata-demo/refs/heads/main/metadata.json"; - // Set to the contract deployer, will receive each USDT payment - address public STORE_OWNER; - // USDT token address in mainnet - address public PAYMENT_TOKEN = 0xf55BEC9cafDbE8730f096Aa55dad6D22d44099Df; - // USDT uses 6 decimals, adapt accordingly if you use other token - uint8 PAYMENT_TOKEN_DECIMALS = 6; - // Item price will cost 0.05 USDT using the formula based on decimal amount - uint public ITEM_PRICE = 5 * 10**PAYMENT_TOKEN_DECIMALS / 100; - - constructor() ERC721("MyToken", "MTK") - { - STORE_OWNER = msg.sender; - } - - // During puchase, the item price will be debited from the user and transfered to the shop owner - function processPurchase() - public - { - uint tokenId = _nextTokenId++; - _safeMint(msg.sender, tokenId); - IERC20(PAYMENT_TOKEN).transferFrom(msg.sender, address(this), ITEM_PRICE); - IERC20(PAYMENT_TOKEN).transfer(STORE_OWNER, ITEM_PRICE); - } - - // Even though in our demo each item has the same metadata we still follow the ERC721 standard - function tokenURI(uint tokenId) - public - view - override(ERC721) - returns (string memory) - { - tokenId; - return _tokenURI; - } -} -``` - -## Deploy the Smart Contract - - - -Set your environment variables: - -`.env` -```bash -SCROLL_RPC_URL="https://rpc.scroll.io/" -PRIVATE_KEY= -``` - -Deploy with Foundry: - -```bash -source .env -forge create src/PaymentProcessor.sol:PaymentProcessor \ - --rpc-url $SCROLL_RPC_URL \ - --broadcast \ - --private-key $PRIVATE_KEY -``` - -You should see output confirming the deployer address, contract address, and transaction hash. Save the contract address under `Deployed to:`, you'll need it when configuring the frontend. - - -```bash -[⠊] Compiling... -No files changed, compilation skipped -Deployer: 0xbef34f2FCAe62dC3404c3d01AF65a7784c9c4A19 -Deployed to: 0xf0e9ceCAE516B2F5Ac297B3857453b07455f817F -Transaction hash: 0x2bca5934ad82ce26332847fdd6a9241b0da0e38e6928f06499ee58ebc967bbde -``` - -## Create and Configure the React Frontend - -Scaffold a React app with Vite, wagmi, and Viem: - -```bash -cd .. -pnpm create wagmi frontend -t vite-react -cd frontend -pnpm install -``` - -Add your deployed contract address to `.env.local`: - -`env.local` -```bash -VITE_PAYMENT_PROCESSOR_ADDRESS=0xYourNewContractAddress -``` - -## Implement the Frontend Logic - -Create a new payments component on `src/components/Payments.tsx`: - -`src/components/Payments.tsx` -```ts -import { useAccount, useWriteContract } from 'wagmi' -import { createPublicClient, http } from 'viem' -import { scroll } from 'viem/chains' -import { useState, useEffect } from 'react' - -const PAYMENT_PROCESSOR_ADDRESS = import.meta.env.VITE_PAYMENT_PROCESSOR_ADDRESS as `0x${string}` -const USDT_ADDRESS = '0xf55BEC9cafDbE8730f096Aa55dad6D22d44099Df' - -// Connect your webapp to Scroll Mainnet -const publicClient = createPublicClient({ - chain: scroll, - transport: http() -}) - -// ABI that allows connecting to our payments smart contract -const paymentProcessorABI = [ - { - inputs: [], - name: "processPurchase", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "ITEM_PRICE", - outputs: [{ type: "uint256" }], - stateMutability: "view", - type: "function", - }, -] as const - -// ERC20 ABI to be able to send USDT to our smart contract -const usdtABI = [ - { - inputs: [ - { name: "spender", type: "address" }, - { name: "amount", type: "uint256" } - ], - name: "approve", - outputs: [{ type: "bool" }], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { name: "owner", type: "address" }, - { name: "spender", type: "address" } - ], - name: "allowance", - outputs: [{ type: "uint256" }], - stateMutability: "view", - type: "function", - }, -] as const - -// Custom hook for payment functionality -function usePayment() { - const { address } = useAccount() - const [itemPrice, setItemPrice] = useState(null) - const [allowance, setAllowance] = useState(null) - const { writeContract: writePaymentProcessor, isPending: isProcessing } = useWriteContract() - const { writeContract: writeUSDT, isPending: isApproving } = useWriteContract() - - // Fetches the price of the item set on the smart contract: 0.05 USDT - const fetchItemPrice = async () => { - try { - const result = await publicClient.readContract({ - address: PAYMENT_PROCESSOR_ADDRESS, - abi: paymentProcessorABI, - functionName: 'ITEM_PRICE', - }) - setItemPrice(result) - } catch (error) { - console.error('Error reading item price:', error) - } - } - - // Check if the user already approved the smart contract - const fetchAllowance = async () => { - if (!address) return - try { - const result = await publicClient.readContract({ - address: USDT_ADDRESS, - abi: usdtABI, - functionName: 'allowance', - args: [address, PAYMENT_PROCESSOR_ADDRESS], - }) - setAllowance(result) - } catch (error) { - console.error('Error reading allowance:', error) - } - } - - useEffect(() => { - fetchItemPrice() - fetchAllowance() - }, [address]) - - // Approves USDT to be sent to our smart contract - const approveUSDT = () => { - if (!itemPrice) return - writeUSDT({ - address: USDT_ADDRESS, - abi: usdtABI, - functionName: 'approve', - args: [PAYMENT_PROCESSOR_ADDRESS, itemPrice], - }, { - onSuccess: (txHash) => { - publicClient.waitForTransactionReceipt({ hash: txHash }) - .then(() => fetchAllowance()) - .catch(console.error) - }, - }) - } - - // Process the payment - const processPurchase = () => { - writePaymentProcessor({ - address: PAYMENT_PROCESSOR_ADDRESS, - abi: paymentProcessorABI, - functionName: 'processPurchase', - }, { - onSuccess: (txHash) => { - publicClient.waitForTransactionReceipt({ hash: txHash }) - .then(() => fetchAllowance()) - .catch(console.error) - }, - }) - } - - return { - itemPrice, - allowance, - isProcessing, - isApproving, - approveUSDT, - processPurchase, - refreshAllowance: fetchAllowance - } -} - -// Payment Component -export function Payments() { - const account = useAccount() - const { - itemPrice, - allowance, - isProcessing, - isApproving, - approveUSDT, - processPurchase - } = usePayment() - - const needsApproval = allowance !== null && itemPrice !== null && allowance < itemPrice - - // Displays either the approval or purchase button depending on the state - return ( -
-

Purchase Item

-

Price: {itemPrice ? Number(itemPrice) / 1e6 : '...'} USDT

- {account.status === 'connected' && ( - <> - {needsApproval ? ( - - ) : ( - - )} - - )} -
- ) -} -``` - -Add that component to your app: - -`src/App.tsx` -```ts -import { useAccount, useConnect, useDisconnect } from 'wagmi' -// Add your new Payments component -import { Payments } from './components/Payments' - -function App() { - const account = useAccount() - const { connectors, connect, error } = useConnect() - const { disconnect } = useDisconnect() - - return ( -
-
-

Wallet

- {account.status === 'connected' ? ( - <> -

Connected: {account.addresses?.[0]}

- - - ) : ( - <> - {connectors.map((connector) => ( - - ))} - {error &&

{error.message}

} - - )} -
- // Render your new Payments component - -
- ) -} - -export default App -``` - -## Start the Frontend - -```bash -pnpm run dev -``` - -Open your browser at `http://localhost:5173`. Connect your wallet, approve USDT, and make a purchase to see your NFT receipt on any marketplace that supports Scroll, such as [Element](https://element.market/). - - \ No newline at end of file diff --git a/src/content/docs/en/user-guide/faucet.mdx b/src/content/docs/en/user-guide/faucet.mdx index 14d8b1cef..75697072c 100644 --- a/src/content/docs/en/user-guide/faucet.mdx +++ b/src/content/docs/en/user-guide/faucet.mdx @@ -39,6 +39,7 @@ If you don't want to interact with the bridge, some faucets directly distribute - [https://scroll.l2scan.co/faucet](https://scroll.l2scan.co/faucet) - [https://www.covalenthq.com/faucet/](https://www.covalenthq.com/faucet) - [https://faucet.quicknode.com/scroll/sepolia](https://faucet.quicknode.com/scroll/sepolia) +- [https://faucet.chainstack.com/scroll-sepolia-testnet-faucet](https://faucet.chainstack.com/scroll-sepolia-testnet-faucet) - [https://bwarelabs.com/faucets/scroll-testnet](https://bwarelabs.com/faucets/scroll-testnet) - [https://scroll.faucetme.pro](https://scroll.faucetme.pro) - [https://www.l2faucet.com/scroll](https://www.l2faucet.com/scroll) diff --git a/src/content/docs/es/developers/developer-quickstart.mdx b/src/content/docs/es/developers/developer-quickstart.mdx deleted file mode 100644 index 1e974accc..000000000 --- a/src/content/docs/es/developers/developer-quickstart.mdx +++ /dev/null @@ -1,268 +0,0 @@ ---- -section: developers -date: Last Modified -title: "Inicio rápido para desarrolladores" -lang: "es" -permalink: "developers/developer-quickstart" -excerpt: "Scroll Developer Quickstart te ayuda a adquirir testnet Ether, configurar tu red y acceder a todas tus herramientas favoritas" -whatsnext: { "Verifica Tus Smart Contracts": "/es/developers/verifying-smart-contracts" } ---- - -import Aside from "../../../../components/Aside.astro" -import ClickToZoom from "../../../../components/ClickToZoom.astro" -import networkSelection from "./_images/mmNetworkSelection.png" -import injectedProviderMM from "./_images/injectedProviderMM.png" -import ToggleElement from "../../../../components/ToggleElement.astro" - -Con Scroll, tus herramientas favoritas para la creación y prueba de smart contracts funcionan de manera intuitiva. - -Dado que Scroll es equivalente en código de bytes con la EVM, sólo tendrás que dirijir tus herramientas de creación favoritas a un proveedor RPC de Scroll. - -Si tienes algún problema, ponte en contacto con nosotros en [nuestro Discord](https://discord.gg/scroll). - -## Adquiriendo Ether - -Scroll usa ETH como moneda nativa, la cual se necesita para pagar comisiones de transacción para lanzar -smart contract e interactuar con la red. - -Para empezar construyendo en Scroll, es sugerido empezar con Scroll Sepolia testnet. Primero necesitarás -adquirir un poco de testnet ETH. Consulta la página sobre las [Faucets](/user-guide/faucet) para tips -sobre cómo obtener tokens en Sepolia. Luego de esto, puedes enviar por el bridge tu ETH de testnet hacia -Scroll Sepolia Testnet (Layer 2) usando nuestro [Bridge de Sepolia](https://sepolia.scroll.io/bridge), -tal y como se describe en el [artículo sobre el Bridge](/user-guide/bridge). - -Para obtener más información, consulta la página de [Setup](/es/user-guide/bridge) de la Guía del usuario. - -Una vez que estés listo para lanzar en Scroll mainnet, puedes usar nuestro -[bridge native](https://scroll.io/bridge/) o algún bridge de terceros. - -## Configuración de red - -### Scroll Mainnet - -Utiliza la siguiente tabla para configurar sus herramientas de Ethereum para la Scroll Mainnet. - -| Nombre de red | Scroll | Scroll Mainnet | -| ---------------------------- | ------------------------------------------------------------- | ----------------------------------------------------------- | -| RPC URL | [https://rpc.scroll.io/](https://rpc.scroll.io/) | [https://eth.llamarpc.com](https://eth.llamarpc.com) | -| Identificador de Cadena | 534352 | 1 | -| Símbolo de Moneda | ETH | ETH | -| URL de Explorador de Bloques | [https://scrollscan.com/](https://scrollscan.com/) | [https://etherscan.io](https://etherscan.io) | - - -
RPCs e Infra adicional de Scroll Mainnet
- - [Bridge Nativo de Scroll](https://scroll.io/bridge) - - [Proveedores de RPC de Scroll en ChainList.org](https://chainlist.org/chain/534352) - - [Proveedores de RPC de Scroll en ChainList.org](https://chainlist.org/chain/1) - {/* - Exploradores de bloques adicionales: - - [Dora](https://www.ondora.xyz/network/scroll/interactions) - - [L2Scan](https://scroll.l2scan.co/) */} - -
- -### Scroll Sepolia Testnet - -Utiliza la siguiente tabla para configurar sus herramientas de Ethereum para la Scroll Sepolia Testnet. - -| Nombre de Red | Scroll Sepolia | Ethereum Sepolia | -| ---------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------ | -| RPC URL | [https://sepolia-rpc.scroll.io/](https://sepolia-rpc.scroll.io/) | [https://rpc2.sepolia.org](https://rpc2.sepolia.org) | -| Identificador de Cadena | 534351 | 11155111 | -| Símbolo de Moneda | ETH | ETH | -| URL de Explorador de Bloques | [https://sepolia.scrollscan.com](https://sepolia.scrollscan.com/) | [https://sepolia.etherscan.io](https://sepolia.etherscan.io) | - - -
RPCs e Infra adicional de Scroll Sepolia
- - [Bridge Nativo de Scroll Sepolia](https://sepolia.scroll.io/bridge) - - [Proveedores de RPC de Scroll Sepolia en ChainList.org](https://chainlist.org/chain/534351) - - [Proveedores de RPC de Ethereum Sepolia en ChainList.org](https://chainlist.org/chain/11155111) - - Exploradores de bloque adicionales: - - [Dora](https://www.ondora.xyz/network/scroll-sepolia/interactions) - - [L2Scan](https://scroll.l2scan.co/) - -
- -## Configura tus herramientas - - - -### Hardhat - -Modifica tu archivo de configuración de Hardhat `hardhat.config.ts` para que se dirija al RPC público de Scroll Sepolia Testnet. - -```jsx -... - -const config: HardhatUserConfig = { - ... - networks: { - scrollSepolia: { - url: "https://sepolia-rpc.scroll.io/" || "", - accounts: - process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [], - }, - }, -}; - -... -``` - -### Foundry - -Para desplegar utilizando el RPC público de Scroll Sepolia Testnet, ejecuta: - -```bash -forge create ... --rpc-url=https://sepolia-rpc.scroll.io/ --legacy -``` - -### Remix Web IDE - -Después de compilar tus contratos, la forma más fácil de desplegar usando Remix es [configurando Metamask](/es/user-guide/setup#metamask) y seleccionando la red **Scroll Sepolia Testnet**. - - - -Ahora, en la pestaña "Deploy and Run Transactions", utiliza el desplegable "Environment" y selecciona "Injected Provider - MetaMask." - - - -Conecta tu wallet y selecciona el Scroll Sepolia Testnet. Tu cuenta debería seleccionarse automáticamente en Remix, y despues, puedes hacer clic en "Deploy." - -### Truffle - -Asumiendo que ya tienes un entorno de Truffle configurado, ve al [archivo de configuración](https://trufflesuite.com/docs/truffle/reference/configuration/) de Truffle, `truffle.js`. Asegúrate de tener instalado HDWalletProvider: `npm install @truffle/hdwallet-provider@1.4.0` - -```js -const HDWalletProvider = require("@truffle/hdwallet-provider") -... -module.exports = { - networks: { - scrollSepolia: { - provider: () => - new HDWalletProvider(process.env.PRIVATE_KEY, "https://sepolia-rpc.scroll.io/"), - network_id: '*', - }, - } -} -``` - -### Brownie - -Para añadir la Scroll Sepolia Testnet, ejecuta el siguiente comando: - -```bash -brownie networks add Ethereum scrollSepolia host=https://sepolia-rpc.scroll.io/ chainid=534351 -``` - -Para establecer esta red como predeterminada, añade lo siguiente en el archivo de configuración del proyecto: - -```yaml -networks: - default: scrollSepolia -``` - -Otra forma de añadir el Scroll Sepolia Testnet es crear un archivo `yaml` y ejecutar un comando para añadirlo. - -Este es un ejemplo de un archivo yaml llamado `network-config.yaml`. - -```yaml -live: -- name: Ethereum - networks: - - chainid: 534351 - explorer: https://sepolia-blockscout.scroll.io/ - host: https://sepolia-rpc.scroll.io - id: scrollSepolia - name: Scroll Sepolia Testnet -``` - -Para añadir la Scroll Sepolia Testnet a la lista de redes, ejecuta el siguiente comando: - -```bash -brownie networks import ./network-config.yaml -``` - -Para desplegar en Scroll, ejecuta el siguiente comando. En este ejemplo, `token.py` es el script para desplegar el smart contract. Sustitúyelo por el nombre de tu script: - -```bash -brownie run token.py --network scrollSepolia -``` - -### ethers.js - -Configuración de un proveedor de Scroll Sepolia Testnet en un script de `ethers`: - -```jsx -import { ethers } from "ethers" - -const provider = new ethers.providers.JsonRpcProvider("https://sepolia-rpc.scroll.io/") -``` - -### scaffold-eth - -Para desplegar usando Scaffold-eth, necesitarás dirigir tus configuraciones de Hardhat y React a la Testnet de Scroll Sepolia. - -#### Configure el Hardhat - -En el archivo `packages/hardhat/hardhat.config.js`, añadirás la red y la seleccionarás como red por defecto. - -```jsx -... -// -// Select the network you want to deploy to here: -// -const defaultNetwork = "scrollSepolia"; -... -module.exports = { -... - networks: { -... - scrollSepolia: { - url: "https://sepolia-rpc.scroll.io/", - accounts: { - mnemonic: mnemonic(), - }, - }, - } -... -} -``` - -Asegúrate de también agregar fondos en la wallet de despliegue. Ejecuta `yarn generate` para crear la wallet y `yarn account` para verificar sus fondos. Una vez tengas fondos, ejecuta `yarn deploy --network scrollSepolia` para desplegarlo en la Scroll Sepolia testnet. - - - -#### Configura el Frontend - -Para configurar tu frontend, tienes que añadir la Scroll Sepolia Testnet como opción de red, y luego seleccionarla como predeterminado. - -Para añadir la red, modifica `packages/react-app/src/constants.js`. - -```jsx -... -export const NETWORKS = { -... - scrollSepolia: { - name: "scrollSepolia", - color: "#e9d0b8", - chainId: 534351, - rpcUrl: "https://sepolia-rpc.scroll.io/", - blockExplorer: "https://sepolia-blockscout.scroll.io", - }, -... -} -``` - -A continuación, en `packages/react-app/src/App.jsx` modifica - -```jsx -... -/// 📡 What chain are your contracts deployed to? -const initialNetwork = NETWORKS.scrollSepolia; -... -``` diff --git a/src/content/docs/es/developers/guides/contract-deployment-tutorial.mdx b/src/content/docs/es/developers/guides/contract-deployment-tutorial.mdx deleted file mode 100644 index d9a682864..000000000 --- a/src/content/docs/es/developers/guides/contract-deployment-tutorial.mdx +++ /dev/null @@ -1,85 +0,0 @@ ---- -section: developers -date: Last Modified -title: "Tutorial de Despliegue de Contratos" -lang: "es" -permalink: "developers/guides/contract-deployment-tutorial" -excerpt: "La Testnet de Scroll Sepolia permite a la comunidad desplegar smart contracts en Scroll. En este tutorial, te enseñaremos a desplegar un contrato en Scroll Sepolia." -whatsnext: { "Interacción Cross-chain del Scroll Messenger": "/es/developers/guides/scroll-messenger-cross-chain-interaction" } ---- - -import Aside from "../../../../../components/Aside.astro" - -La Testnet de Scroll Sepolia permite a cualquiera desplegar un smart contract en Scroll. En este tutorial, aprenderás a desplegar un contrato en Scroll Sepolia utilizando herramientas comunes para desarrollar en Ethereum. Este [demo repo](https://github.com/scroll-tech/scroll-guides/tree/main/contract-deploy-demo) ilustra el despliegue de contratos con [Hardhat](https://hardhat.org/) y [Foundry](https://github.com/foundry-rs/foundry). - - - -## Despliegue de contratos con Hardhat - -1. Si aún no lo has hecho, instala [nodejs](https://nodejs.org/en/download/) y [yarn](https://classic.yarnpkg.com/lang/en/docs/install). -2. Clona el repositorio e instala las dependencias: - - ```shell - git clone https://github.com/scroll-tech/scroll-guides.git - cd scroll-guides/contract-deploy-demo - yarn install - ``` - -3. Crea un archivo `.env` siguiendo el ejemplo `.env.example` en el directorio raíz. Cambia `PRIVATE_KEY` por la clave privada de tu propia cuenta en el `.env`. - -4. Ejecuta `yarn compile` para compilar el contrato. - -5. Ejecuta `yarn deploy:scrollTestnet` para desplegar el contrato en la Scroll Sepolia Testnet. - -6. Ejecuta `yarn test` para realizar las pruebas hardhat. - -## Despliegue de contratos con Foundry - -1. Clona el repositorio: - - ```shell - git clone https://github.com/scroll-tech/scroll-guides.git - cd scroll-guides/contract-deploy-demo - ``` - -2. Instala el Foundry: - - ```shell - curl -L https://foundry.paradigm.xyz | bash - foundryup - ``` - -3. Ejecuta `forge build` para construir el proyecto. - -4. Despliega tu contrato con Foundry: - - ```bash - forge create --rpc-url https://sepolia-rpc.scroll.io/ \ - --value \ - --constructor-args \ - --private-key \ - --legacy \ - contracts/Lock.sol:Lock - ``` - - - `` es la cantidad de `ETH` de prueba que se bloqueará en el contrato. Intenta establecer una cantidad pequeña, como `0.0000001ether`. - - `` es la marca de tiempo Unix después de la cual los fondos bloqueados en el contrato estarán disponibles para su retirada. Intenta ponerlo en algún timestamp Unix en el futuro, como `1696118400` (este timestamp Unix corresponde al 1 de Octubre de 2023). - - Por ejemplo: - - ```bash - forge create --rpc-url https://sepolia-rpc.scroll.io/ \ - --value 0.00000000002ether \ - --constructor-args 1696118400 \ - --private-key 0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1 \ - --legacy contracts/Lock.sol:Lock - ``` - -## Preguntas y Feedback - -Gracias por participar y desarrollar en la Scroll Sepolia Testnet. Si tienes algún problema, únete a nuestro [Discord](https://discord.gg/scroll) y pregúntanos en el canal `#testnet-devs`. diff --git a/src/content/docs/tr/developers/developer-quickstart.mdx b/src/content/docs/tr/developers/developer-quickstart.mdx deleted file mode 100644 index 1f11d8384..000000000 --- a/src/content/docs/tr/developers/developer-quickstart.mdx +++ /dev/null @@ -1,260 +0,0 @@ ---- -section: developers -date: Last Modified -title: "Geliştirici Hızlı Başlangıcı" -lang: "tr" -permalink: "developers/developer-quickstart" -excerpt: "Scroll Geliştirici Hızlı Başlangıcı, test ağı Ether'i edinmenize, ağınızı yapılandırmanıza ve tüm favori araçlarınıza erişmenize yardımcı olur" -whatsnext: { "Akıllı Sözleşemenizi Doğrulayın": "/tr/developers/verifying-smart-contracts" } ---- - -import Aside from "../../../../components/Aside.astro" -import ClickToZoom from "../../../../components/ClickToZoom.astro" -import networkSelection from "./_images/mmNetworkSelection.png" -import injectedProviderMM from "./_images/injectedProviderMM.png" -import ToggleElement from "../../../../components/ToggleElement.astro" - -Scroll ile akıllı sözleşmeler oluştururken ve test ederken en sevdiğiniz araçlar oldukları gibi çalışırlar. - -Scroll, EVM ile bytecode olarak denk olduğu için en sevdiğiniz geliştirici araçlarınızı bir Scroll RPC sağlayıcısına yönlendirmeniz yeterli olacaktır. - -Herhangi bir sorunla karşılaşırsanız lütfen [Discord'umuzdan](https://discord.gg/scroll) bize ulaşın. - -## Ether Edinme - -Scroll yerel para birimi olarak ETH'yi kullanıyor ve bu ETH'ler, ağda akıllı sözleşme dağıtımı ve etkileşimleri için işlem ücretlerini ödemek için gerekli olacak. - -Scroll üzerinde inşa etmeye başlamak için Scroll Sepolia test ağımızı kullanarak başlamanızı öneririz. Öncelikle bir miktar test ağı ETH edinmeniz gerekecek. Sepolia'da test token'ları almayla ilgili ipuçları için [Musluk](/tr/user-guide/faucet) sayfasına bakın. Bundan sonra, [Köprü makalesinde](/tr/user-guide/bridge) açıklandığı gibi [Sepolia Köprümüzü](https://sepolia.scroll.io/bridge) kullanarak test ağı ETH'lerinizi Scroll Sepolia Test ağına (Katman 2) aktarabilirsiniz. - -Adım adım açıklama için Kullanım Kılavuzunun [Kurulum](/tr/user-guide/setup) sayfasıyla başlayın. - -Scroll ana ağında akıllı sözleşme dağıtmak için hazır olduğunuzda, [yerel köprümüzü](https://scroll.io/bridge/) veya 3. taraf köprülerden birini kullanarak ETH üzerinden köprü kurabilirsiniz. - -## Ağ Yapılandırması - -### Scroll Ana Ağı - -Ethereum araçlarınızı Scroll ana ağına yapılandırmak için aşağıdaki tabloyu kullanın. - -| Ağ Adı | Scroll | Ethereum Ana Ağı | -| ------------------ | -------------------------------------------------- | ---------------------------------------------------- | -| RPC URL'si | [https://rpc.scroll.io/](https://rpc.scroll.io/) | [https://eth.llamarpc.com](https://eth.llamarpc.com) | -| Zincir Kimliği | 534352 | 1 | -| Para Birimi Sembolü| ETH | ETH | -| Blok Gezgini URL'si| [https://scrollscan.com/](https://scrollscan.com/) | [https://etherscan.io](https://etherscan.io) | - - -
Ek Scroll Ana Ağ RPC'leri ve Altyapıları
- - [Scroll Yerel Köprüsü](https://scroll.io/bridge) - - [ChainList.org'daki Scroll RPC Sağlayıcıları](https://chainlist.org/chain/534352) - - [ChainList.org'daki Ethereum RPC Sağlayıcıları](https://chainlist.org/chain/1) - {/* - Ek Blok Gezginleri: - - [Dora](https://www.ondora.xyz/network/scroll/interactions) - - [L2Scan](https://scroll.l2scan.co/) */} - -
- -### Scroll Sepolia Test Ağı - -Ethereum araçlarınızı Scroll Sepolia Test ağına yapılandırmak için aşağıdaki tabloyu kullanın. - -| Ağ Adı | Scroll Sepolia | Ethereum Sepolia | -| ------------------ | ----------------------------------------------------------------- | ------------------------------------------------------------ | -| RPC URL'si | [https://sepolia-rpc.scroll.io/](https://sepolia-rpc.scroll.io/) | [https://rpc2.sepolia.org](https://rpc2.sepolia.org) | -| Zincir Kimliği | 534351 | 11155111 | -| Para Birimi Sembolü| ETH | ETH | -| Blok Gezgini URL'si| [https://sepolia.scrollscan.com](https://sepolia.scrollscan.com/) | [https://sepolia.etherscan.io](https://sepolia.etherscan.io) | - - -
Ek Scroll Sepolia RPC'leri ve Altyapıları
- - [Scroll Sepolia Yerel Köprüsü](https://sepolia.scroll.io/bridge) - - [ChainList.org'daki Scroll Sepolia RPC Sağlayıcıları](https://chainlist.org/chain/534351) - - [ChainList.org'daki Ethereum Sepolia RPC Sağlayıcıları](https://chainlist.org/chain/11155111) - - Ek Blok Gezginleri: - - [Dora](https://www.ondora.xyz/network/scroll-sepolia/interactions) - - [L2Scan](https://scroll.l2scan.co/) - -
- -## Araçlarınızı Yapılandırın - - - -### Hardhat - -Hardhat yapılandırma dosyanızı `hardhat.config.ts'yi Scroll Sepolia Test ağı public RPC'sini işaret edecek şekilde değiştirin. - -```jsx -... - -const config: HardhatUserConfig = { - ... - networks: { - scrollSepolia: { - url: "https://sepolia-rpc.scroll.io/" || "", - accounts: - process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [], - }, - }, -}; - -... -``` - -### Foundry - -Scroll Sepolia Test ağı Public RPC'sini kullanarak dağıtım yapmak için şunu çalıştırın: - -```bash -forge create ... --rpc-url=https://sepolia-rpc.scroll.io/ --legacy -``` - -### Remix Web IDE - -Sözleşmelerinizi derledikten sonra Remix kullanarak dağıtım yapmanın en kolay yolu, [Metamask'ı kurmak](/tr/user-guide/setup) ve ardından **Scroll Sepolia Test ağını** seçmektir. - - - -Şimdi, "Dağıt ve İşlemleri Çalıştır" sekmesinde, "Ortam" açılır menüsünü kullanarak "Enjekte Edilen Sağlayıcı - MetaMask"ı seçin. - - - -Cüzdanınızı bağlayın ve Scroll Sepolia Test ağını seçin. Hesabınız Remix'te otomatik olarak seçilmelidir ve "Dağıt"a tıklayabilirsiniz. - -### Truffle - -Zaten bir Truffle ortamı kurulumunuz olduğunu varsayarak Truffle [yapılandırma dosyasına](https://trufflesuite.com/docs/truffle/reference/configuration/), `truffle.js`ye gidin. HDWalletProvider'ı yüklediğinizden emin olun: `npm install @truffle/hdwallet-provider@1.4.0` - -```js -const HDWalletProvider = require("@truffle/hdwallet-provider") -... -module.exports = { - networks: { - scrollSepolia: { - provider: () => - new HDWalletProvider(process.env.PRIVATE_KEY, "https://sepolia-rpc.scroll.io/"), - network_id: '*', - }, - } -} -``` - -### Brownie - -Scroll Sepolia Test ağını eklemek için aşağıdaki komutu çalıştırın: - -```bash -brownie networks add Ethereum scrollSepolia host=https://sepolia-rpc.scroll.io/ chainid=534351 -``` - -Bunu varsayılan ağınız olarak ayarlamak için proje yapılandırma dosyanıza aşağıdakileri ekleyin: - -```yaml -networks: - default: scrollSepolia -``` - -Scroll Sepolia Test ağını eklemenin başka bir yolu da bir 'yaml' dosyası oluşturmak ve onu eklemek için bir komut çalıştırmaktır. - -'network-config.yaml' adlı bir yaml dosyası örneği vermek gerekirse: - -```yaml -live: -- name: Ethereum - networks: - - chainid: 534351 - explorer: https://sepolia.scrollscan.com/ - host: https://sepolia-rpc.scroll.io - id: scrollSepolia - name: Scroll Sepolia Testnet -``` - -Scroll Sepolia Test ağını ağ listesine eklemek için aşağıdaki komutu çalıştırın: - -```bash -brownie networks import ./network-config.yaml -``` - -Scroll'da dağıtmak için aşağıdaki komutu çalıştırın. Bu örnekte "token.py" akıllı sözleşmeyi dağıtan bir komut dosyasıdır. Bunu kendi komut dosyanızın adıyla değiştirin: - -```bash -brownie run token.py --network scrollSepolia -``` - -### ethers.js - -Bir 'ethers' komut dosyasında Scroll Sepolia Test ağı sağlayıcısının kurulması: - -```jsx -import { ethers } from "ethers" - -const provider = new ethers.providers.JsonRpcProvider("https://sepolia-rpc.scroll.io/") -``` - -### scaffold-eth - -Scaffold-eth'i kullanarak dağıtım yapmak için hem Hardhat hem de React ayarlarınızı Scroll Sepolia Test ağına yönlendirmeniz gerekir. - -#### Hardhat'i Yapılandırma - -'packages/hardhat/hardhat.config.js' dosyasına ağın eklenerek varsayılan ağ olarak seçilmesi gerekmektedir. - -```jsx -... -// -// Burada dağıtmak istediğiniz ağı seçin: -// -const defaultNetwork = "scrollSepolia"; -... -module.exports = { -... - networks: { -... - scrollSepolia: { - url: "https://sepolia-rpc.scroll.io/", - accounts: { - mnemonic: mnemonic(), - }, - }, - } -... -} -``` - -Dağıtım cüzdanına da fon sağladığınızdan emin olun! Cüzdanı oluşturmak için "yarn generate"i, fonlarını kontrol etmek için "yarn account"u çalıştırın. Fonlama sağlandıktan sonra Scroll Sepolia test ağına dağıtmak için `yarn deploy --network ScrollSepolia` komutunu çalıştırın. - - - -#### Kullanıcı Arayüzü Yapılandırması - -Kullanıcı arayüzünüzü yapılandırmak için Scroll Sepolia Test ağını bir ağ seçeneği olarak eklemeniz ve ardından bunu varsayılan olarak seçmeniz gerekir. - -Ağı eklemek için 'packages/react-app/src/constants.js' dosyasını değiştirin. - -```jsx -... -export const NETWORKS = { -... - scrollSepolia: { - name: "scrollSepolia", - color: "#e9d0b8", - chainId: 534351, - rpcUrl: "https://sepolia-rpc.scroll.io/", - blockExplorer: "https://sepolia.scrollscan.com", - }, -... -} -``` - -Daha sonra, 'packages/react-app/src/App.jsx' bölümünde değişiklik yapın - -```jsx -... -/// 📡 Sözleşmeleriniz hangi zincire dağıtıldı? -const initialNetwork = NETWORKS.scrollSepolia; -... -``` diff --git a/src/content/docs/tr/developers/guides/contract-deployment-tutorial.mdx b/src/content/docs/tr/developers/guides/contract-deployment-tutorial.mdx deleted file mode 100644 index fb0e2a2ab..000000000 --- a/src/content/docs/tr/developers/guides/contract-deployment-tutorial.mdx +++ /dev/null @@ -1,108 +0,0 @@ ---- -section: developers -date: Last Modified -title: "Sözleşme Dağıtımı Eğitimi" -lang: "tr" -permalink: "developers/guides/contract-deployment-tutorial" -excerpt: "Scroll Sepolia Test ağı, topluluğun Scroll üzerinde akıllı sözleşmeler dağıtmasına olanak tanır. Bu eğitimde size Scroll Sepolia'da bir sözleşmenin nasıl dağıtılacağını öğreteceğiz." -whatsnext: { "Scroll Messenger ile Zincirler Arası Etkileşim": "/tr/developers/guides/scroll-messenger-cross-chain-interaction/" } ---- - - -import Aside from "../../../../../components/Aside.astro" - - -Scroll Sepolia Test ağı, herkesin Scroll üzerinde akıllı sözleşme dağıtmasına olanak tanır. Bu eğitimde, Ethereum'da geliştirmeye yönelik ortak araçları kullanarak Scroll Sepolia'da bir sözleşmenin nasıl dağıtılacağını öğreneceksiniz. Bu [demo deposu](https://github.com/scroll-tech/scroll-guides/tree/main/contract-deploy-demo), [Hardhat](https://hardhat.org/) ve [Foundry](https://github.com/foundry-rs/foundry) ile sözleşme dağıtımını gösterir. - - - - - -## Hardhat ile sözleşmeleri dağıtın - - -1. Henüz yapmadıysanız [nodejs](https://nodejs.org/en/download/) ve [yarn](https://classic.yarnpkg.com/lang/en/docs/install) yükleyin . -2. Depoyu klonlayın ve gereksinimleri yükleyin: - - - ```shell - git clone https://github.com/scroll-tech/scroll-guides.git - cd scroll-guides/contract-deploy-demo - yarn install - ``` - - -3. Kök dizinde `.env.example` örneğini takip ederek bir `.env` dosyası oluşturun. `PRIVATE_KEY`i `.env`de kendi hesabınızın özel anahtarıyla değiştirin. - - -4. Sözleşmeyi derlemek için 'yarn compile'ı çalıştırın. - - -5. Sözleşmeyi Scroll Sepolia Test ağında dağıtmak için `yarn deploy:scrollTestnet'i çalıştırın. - - -6. Hardhat testleri için "yarn test"'i çalıştırın. - - -## Foundry ile sözleşmeleri dağıtın - - -1. Depoyu klonlayın: - - - ```shell - git clone https://github.com/scroll-tech/scroll-guides.git - cd scroll-guides/contract-deploy-demo - ``` - - -2. Foundry'yi kurun: - - - ```shell - curl -L https://foundry.paradigm.xyz | bash - foundryup - ``` - - -3. Projeyi oluşturmak için 'forge build'i çalıştırın. - - -4. Foundry ile sözleşmenizi dağıtın: - - - ```bash - forge create --rpc-url https://sepolia-rpc.scroll.io/ \ - --value \ - --constructor-args \ - --private-key \ - --legacy \ - contracts/Lock.sol:Lock - ``` - - - - ``, sözleşmede kilitlenecek test `ETH` miktarıdır. Bunu "0,0000001ether" gibi küçük bir miktara ayarlamayı deneyin. - - ``, sözleşmede kilitlenen fonların çekilmeye hazır olacağı Unix zaman damgasıdır. Bunu gelecekte "1696118400" gibi bir Unix zaman damgasına ayarlamayı deneyin (bu Unix zaman damgası 1 Ekim 2023'e karşılık gelir). - - - Örneğin: - - - ```bash - forge create --rpc-url https://sepolia-rpc.scroll.io/ \ - --value 0.00000000002ether \ - --constructor-args 1696118400 \ - --private-key 0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1 \ - --legacy contracts/Lock.sol:Lock - ``` - - -## Sorular ve Geri Bildirim - - -Scroll Sepolia Test ağına katıldığınız ve geliştirdiğiniz için teşekkür ederiz! Herhangi bir sorunla karşılaşırsanız [Discord'umuza](https://discord.gg/scroll) katılın ve "#testnet-devs" kanalından bize sorun. - - - diff --git a/src/content/docs/zh/developers/developer-quickstart.mdx b/src/content/docs/zh/developers/developer-quickstart.mdx deleted file mode 100644 index b88ca8045..000000000 --- a/src/content/docs/zh/developers/developer-quickstart.mdx +++ /dev/null @@ -1,220 +0,0 @@ ---- -section: developers -date: Last Modified -title: "开发者快速入门" -lang: "zh" -permalink: "developers/developer-quickstart" -excerpt: "Scroll Developer Quickstart helps you acquire testnet Ether, configure your network, and access all of your favorite tooling" -whatsnext: { "验证智能合约": "/zh/developers/verifying-smart-contracts" } ---- - -import Aside from "../../../../components/Aside.astro" -import ClickToZoom from "../../../../components/ClickToZoom.astro" -import networkSelection from "./_images/mmNetworkSelection.png" -import injectedProviderMM from "./_images/injectedProviderMM.png" - -在 Scroll 上,你最喜欢的智能合约开发测试工具都可以正常使用。 - -由于 Scroll 是字节码层面的 EVM 等效,你只需将你的开发工具指向 Scroll Sepolia Testnet RPC Provider。 - -如果你遇到任何问题,请联系[我们的 Discord](https://discord.gg/scroll)。 - -## 获取测试网ETH - -在Scroll上构建之前,您需要一些测试代币。查看我们的 [水龙头](/user-guide/faucet) 页面,在Sepolia上获得 ETH 测试代币。 然后,使用我们的 [跨链桥](/user-guide/bridge) 将 ETH 测试代币桥接到 Scroll Sepolia 测试网(Layer 2)。 - -如需详细指引,可以从用​​户指南的[设置](/user-guide/setup) 页面开始。 - -## 网络配置 - -使用下表将您的以太坊工具配置到 Scroll Sepolia 测试网。 - -| 网络名称 | Scroll Sepolia 测试网 | Sepolia 测试网 | -| ------------------ | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| RPC URL | [https://sepolia-rpc.scroll.io/](https://sepolia-rpc.scroll.io/) | [https://eth-sepolia-public.unifra.io](https://eth-sepolia-public.unifra.io) | -| 链 ID | 534351 | 11155111 | -| 代币符号 | ETH | ETH | -| 区块链浏览器链接 | [https://sepolia-blockscout.scroll.io](https://sepolia-blockscout.scroll.io/) | [https://sepolia.etherscan.io](https://sepolia.etherscan.io) | - -## 配置工具 - - - -### Hardhat - -修改你的 Hardhat 配置文件 `hardhat.config.ts` 以指向 Scroll Sepolia 测试网公共 RPC. - -```jsx -... - -const config: HardhatUserConfig = { - ... - networks: { - scrollSepolia: { - url: "https://sepolia-rpc.scroll.io/" || "", - accounts: - process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [], - }, - }, -}; - -... -``` - -### Foundry - -要使用 Scroll Sepolia 测试网公共 RPC, 运行: - -```bash -forge create ... --rpc-url=https://sepolia-rpc.scroll.io/ --legacy -``` - -### Remix Web IDE - -编译合约后,使用 Remix 进行部署的最简单方法是 [设置 Metamask](/user-guide/setup#metamask), 然后选择 **Scroll Sepolia 测试网** 。 - - - -现在,在“Deploy and Run Transactions”选项卡中,点击“Environment”下拉菜单并选择“Injected Provider - MetaMask”。 - - - -连接你的钱包并选择 Scroll Sepolia Testnet。Remix 中会自动选择帐户,然后你单击“部署”即可。 - -### Truffle - -假设你已经设置了 truffle 环境,请到 Truffle [配置文件](https://trufflesuite.com/docs/truffle/reference/configuration/),`truffle.js`,并确保已经安装了 HDWalletProvider: `npm install @truffle/hdwallet-provider@1.4.0` - -```js -const HDWalletProvider = require("@truffle/hdwallet-provider") -... -module.exports = { - networks: { - scrollSepolia: { - provider: () => - new HDWalletProvider(process.env.PRIVATE_KEY, "https://sepolia-rpc.scroll.io/"), - network_id: '*', - }, - } -} -``` - -### Brownie - -要添加 Scroll Sepolia 测试网,请运行以下命令: - -```bash -brownie networks add Ethereum scrollSepolia host=https://sepolia-rpc.scroll.io/ chainid=534351 -``` - -要将其设置为默认网络,请在项目配置文件中添加以下内容: - -```yaml -networks: - default: scrollSepolia -``` - -添加 Scroll Sepolia 测试网的另一种方法是创建一个 `yaml` 文件并运行命令来添加它。 - -这是一个名为 `network-config.yaml` 的 `yaml` 文件的示例 - -```yaml -live: -- name: Ethereum - networks: - - chainid: 534351 - explorer: https://sepolia-blockscout.scroll.io/ - host: https://sepolia-rpc.scroll.io - id: scrollSepolia - name: Scroll Sepolia Testnet -``` - -要将 Scroll Sepolia 测试网添加到网络列表,请运行以下命令: - -```bash -brownie networks import ./network-config.yaml -``` - -若要在Scroll上部署,请运行以下命令。在此示例中, `token.py` 是用于部署智能合约的脚本。将其替换为脚本的名称: - -```bash -brownie run token.py --network scrollSepolia -``` - -### ethers.js - -在`ethers`脚本中设置 Scroll Sepolia Testnet provider : - -```jsx -import { ethers } from "ethers" - -const provider = new ethers.providers.JsonRpcProvider("https://sepolia-rpc.scroll.io/") -``` - -### scaffold-eth - -要使用 Scaffold-eth 进行部署,你需要将 Hardhat 和 React 设置指向 Scroll Alpha 测试网。 Scroll Sepolia 测试网。 - -#### 配置Hardhat - -在`packages/hardhat/hardhat.config.js`文件中,你需要添加网络并选择其为默认网络。 - -```jsx -... -// -// Select the network you want to deploy to here: -// -const defaultNetwork = "scrollSepolia"; -... -module.exports = { -... - networks: { -... - scrollSepolia: { - url: "https://sepolia-rpc.scroll.io/", - accounts: { - mnemonic: mnemonic(), - }, - }, - } -... -} -``` - -确保为部署钱包提供了资金!运行 `yarn generate` 以创建钱包并 `yarn account` 检查其资金。资金到位后,运行 `yarn deploy --network scrollSepolia` 以在Scroll Sepolia测试网上部署。 - - - -#### 配置前端 - -要配置你的前端,你需要添加 Scroll Sepolia Testnet 作为网络,然后选择它为默认设置。 - -添加网络,请修改 `packages/react-app/src/constants.js` . - -```jsx -... -export const NETWORKS = { -... - scrollSepolia: { - name: "scrollSepolia", - color: "#e9d0b8", - chainId: 534351, - rpcUrl: "https://sepolia-rpc.scroll.io/", - blockExplorer: "https://sepolia-blockscout.scroll.io", - }, -... -} -``` - -接下来,修改 `packages/react-app/src/App.jsx` - -```jsx -... -/// 📡 What chain are your contracts deployed to? -const initialNetwork = NETWORKS.scrollSepolia; -... -``` diff --git a/src/content/docs/zh/developers/guides/contract-deployment-tutorial.mdx b/src/content/docs/zh/developers/guides/contract-deployment-tutorial.mdx deleted file mode 100644 index 3c5951e13..000000000 --- a/src/content/docs/zh/developers/guides/contract-deployment-tutorial.mdx +++ /dev/null @@ -1,84 +0,0 @@ ---- -section: developers -date: Last Modified -title: "合约部署教程" -lang: "zh" -permalink: "developers/guides/contract-deployment-tutorial" -excerpt: "The Scroll Sepolia Testnet allows the community to deploy smart contracts on Scroll. In this tutorial, we will teach you how to deploy a contract on Scroll Sepolia." -whatsnext: { "Scroll Messenger 跨链交互": "/zh/developers/guides/scroll-messenger-cross-chain-interaction/" } ---- - -import Aside from "../../../../../components/Aside.astro" - -Scroll Sepolia测试网允许任何人在Scroll上部署智能合约。在本教程中,您将学习如何使用以太坊上开发的常用工具在 Scroll Sepolia 上部署合约。该[仓库](https://github.com/scroll-tech/scroll-guides/tree/main/contract-deploy-demo)展示了如何使用 [Hardhat](https://hardhat.org/) 和 [Foundry](https://github.com/foundry-rs/foundry) 进行合约部署。 - - - -## 使用 Hardhat 部署合约 - -1. 如果你还没有 Hardhat, 安装 [nodejs](https://nodejs.org/en/download/) 和 [yarn](https://classic.yarnpkg.com/lang/en/docs/install)。 -2. 克隆仓库并安装依赖项: - - ```shell - git clone https://github.com/scroll-tech/scroll-guides.git - cd scroll-guides/contract-deploy-demo - yarn install - ``` - -3. 按照根目录下`.env.example`的例子,创建 `.env`。 将`.env`中的 `PRIVATE_KEY` 更改为您自己的账户私钥。 - -4. 运行 `yarn compile` 以编译合约。 - -5. 运行 `yarn deploy:scrollTestnet` 在 Scroll Sepolia 测试网上部署合约。 - -6. 运行 `yarn test` 进行 hardhat 测试。 - -## 使用 Foundry 部署合约 - -1. 克隆仓库: - - ```shell - git clone https://github.com/scroll-tech/scroll-guides.git - cd scroll-guides/contract-deploy-demo - ``` - -2. 安装 Foundry: - - ```shell - curl -L https://foundry.paradigm.xyz | bash - foundryup - ``` - -3. 运行 `forge build` 来构建项目. - -4. 使用 Foundry 部署合约: - - ```bash - forge create --rpc-url https://sepolia-rpc.scroll.io/ \ - --value \ - --constructor-args \ - --private-key \ - --legacy \ - contracts/Lock.sol:Lock - ``` - - - `` 是锁定在合约中 `ETH` 测试代币。尝试将其设置为很小的数量,例如 `0.0000001ether`。 - - `` 是Unix时间戳,在此之后锁定在合约中的资金将可提取。尝试在将其设置为未来的某个 Unix 时间戳,例如 1696118400 (此 Unix 时间戳对应于 2023 年 10 月 1 日)。 - - 例如: - - ```bash - forge create --rpc-url https://sepolia-rpc.scroll.io/ \ - --value 0.00000000002ether \ - --constructor-args 1696118400 \ - --private-key 0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1 \ - --legacy contracts/Lock.sol:Lock - ``` - -## 问题和反馈 - -感谢您参与并开发Scroll Sepolia测试网!如果您遇到任何问题,请加入我们的 [Discord](https://discord.gg/scroll) 并在 `#testnet-devs` 频道中询问我们。