Ancient8 백서

Ancient8

원문

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

ereum-sepolia) * Ancient8 Testnet Faucet: Coming soon #### Bridging Sepolia ETH from Ethereum Sepolia 1. Get Sepolia ETH via [Sepolia Faucets](https://sepoliafaucet.com) to your wallet address 2. Connect wallet to [Ancient8 Testnet Bridge](https://bridgev2-testnet.ancient8.gg/) 3. Deposit **Sepolia ETH** to **Ancient8 Testnet** <div align="left"><figure><img src="https://2872752532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzTPAeEr3HyZhmijpV6ll%2Fuploads%2FFlC5DIQCTbryDAaMGfvU%2FScreenshot%202023-08-15%20at%2009.58.43.png?alt=media&amp;token=4d399bcc-9cac-4ef1-a929-0130f839501f" alt="" width="375"><figcaption></figcaption></figure></div> #### Get Testnet Ether[​](https://docs.base.org/guides/deploy-with-remix#get-testnet-ether) <a href="#get-testnet-ether" id="get-testnet-ether"></a> Testnet tokens have no real value, but the supply is not unlimited. You can use a faucet to get a small amount of Sepolia Ether to pay gas fees for testing. Most faucets allow you to ask for a small amount each day, and some won't send you more if your balance is too high. You can find many faucets by searching, and it's good to keep a few bookmarked because they have a tendency to go down from time to time. Faucet providers are constantly combating bad actors and sometimes need to disable their faucets while doing so. {% hint style="info" %} INFO Remember to bridge the Ethereum (Layer 1) Sepolia Ether to Ancient8 Testnet via our [bridge](https://bridge-testnet.ancient8.gg/). {% endhint %} Once you have Ancient8 Testnet Sepolia Ether, you can view your balance by selecting the Ancient8 Testnet from the network dropdown in Metamask.&#x20; ### Deploying to Testnet[​](https://docs.base.org/guides/deploy-with-remix#deploying-to-testnet) Once you have testnet Ether, you can deploy the `Storage` contract! #### Selecting the Environment[​](https://docs.base.org/guides/deploy-with-remix#selecting-the-environment) <a href="#selecting-the-environment" id="selecting-the-environment"></a> Open the *Deploy & Run Transactions* tab. Under *Environment*, select *Injected Provider*. It will list *Metamask* or any other wallet you have activated here. <div align="left"><figure><img src="https://2872752532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzTPAeEr3HyZhmijpV6ll%2Fuploads%2FrwtmLPIZE18OgNsrYV27%2FScreenshot%202023-08-14%20at%2022.59.57.png?alt=media&amp;token=bc0d6f21-0431-409d-b521-15636e9a62bd" alt="" width="301"><figcaption></figcaption></figure></div> The first time you do this, your wallet will ask you to confirm that you want to connect this dApp (Remix) to your wallet. Once you are connected, you'll see the name of the network below the *Environment* dropdown. <div align="left"><figure><img src="https://2872752532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzTPAeEr3HyZhmijpV6ll%2Fuploads%2FGhrRh5DKB7OjBgr26R1U%2FScreenshot%202023-08-14%20at%2023.03.20.png?alt=media&amp;token=457f1ecc-4369-47f0-9d16-58e717bb713a" alt="" width="297"><figcaption></figcaption></figure></div> For **Ancient8 Testnet**, you should see `Custom (2863311531) network`&#x20; If you don't see the correct network, change the active network in your wallet. ### Deploy the Contract[​](https://docs.base.org/guides/deploy-with-remix#deploy-the-contract) Click the orange *Deploy* button. Because it costs gas to deploy a contract, you'll be asked to review and confirm a transaction. <div align="left"><figure><img src="https://2872752532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzTPAeEr3HyZhmijpV6ll%2Fuploads%2FPGN4nCsMmOoKeqHyKIV2%2FScreenshot%202023-08-14%20at%2023.17.23.png?alt=media&amp;token=ad21eb1d-b387-4f49-9746-1b425bc6004d" alt="" width="358"><figcaption></figcaption></figure></div> {% hint style="danger" %} **DANGER** Always carefully review all transactions, confirming the transaction cost, assets transferred, and network. As a developer, you'll get used to approving transactions regularly. Do the best you can to avoid getting into the habit of clicking *Confirm* without reviewing the transaction carefully. If you feel pressured to *Confirm* before you run out of time, it is almost certainly a scam. {% endhint %} After you click the *Confirm* button, return to Remix and wait for the transaction to deploy. Copy its address and navigate to [scanv2-testnet.ancient8.gg](https://scanv2-testnet.ancient8.gg/).&#x20; ### Verify the Contract[​](https://docs.base.org/guides/deploy-with-remix#verify-the-contract) {% hint style="info" %} **INFO** You don't need to verify the contract if you've deployed one identical to a contract that has already been verified. {% endhint %} You can interact with your deployed contract using Remix, the same as before, but it's also possible to interact with it through Etherscan. Paste your address in the search field to find it. On this page, you can review the balance, information about, and all the transactions that have ever occurred with your contract. Click the *Contract* tab in the main panel. If you've deployed a unique contract, at the top is a message asking you to *Verify and Publish* your contract source code. <div align="left"><figure><img src="https://2872752532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzTPAeEr3HyZhmijpV6ll%2Fuploads%2FTBUrnpTMeU1grN2iXX9C%2Fverify-and-publish-937d8f1fd6626a36862dd12e8946995f.png?alt=media&amp;token=5662de25-ab56-424e-8687-0f99f769651b" alt=""><figcaption></figcaption></figure></div> Verifying your contract maps the names of your functions and variables to the compiled byte code, which makes it possible to interact with the contract using a human-readable interface. Click the link. Your contract address is already entered. Under *Please select Compiler Type* choose \_Solidity (Single file) For *Please Select Compiler Version* select the version matching the `pragma` at the top of your source file. Our examples are currently using *v0.8.18+commit.87f61d96*. For *Please select Open Source License Type* pick the license that matches what you selected for your contract as the `SPDX-License-Identifier`. Pick *None* if you followed the Solidity-recommended practice of using `UNLICENSED`. On the next page, copy and paste your source code in the window. Verify that you are not a robot, and click *Verify and Publish*. You should see a success message. <figure><img src="https://2872752532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzTPAeEr3HyZhmijpV6ll%2Fuploads%2FNuBuOkqswcUzN05349Dp%2FScreenshot%202023-08-14%20at%2023.30.35.png?alt=media&amp;token=93272b92-6f69-4ced-8d9b-c96286e1adeb" alt=""><figcaption></figcaption></figure> Click the linked address to your contract to return to the contract page. You'll now see your code! #### Interact with the Contract[​](https://docs.base.org/guides/deploy-with-remix#interact-with-the-contract) <a href="#interact-with-the-contract" id="interact-with-the-contract"></a> You can now interact with your contract using Etherscan. Click the *Read Contract* button. Both of your functions will be listed here and can be tested using the web interface. You won't have anything under *Write Contract* because this contract doesn't have any functions that save data to state. ### Conclusion[​](https://docs.base.org/guides/deploy-with-remix#conclusion) You now have the power to put smart contracts on the blockchain! You've only deployed to a test network, but the process for real networks is exactly the same - just more expensive! # Using thirdweb [thirdweb](https://thirdweb.com/) is a development framework that allows you to build web3 functionality into your applications. In this guide, we'll give you an overview of using the [thirdweb CLI](https://portal.thirdweb.com/cli) to deploy a contract to the **Ancient8 Testnet**. ### Objectives[​](https://docs.base.org/guides/deploy-with-thirdweb#objectives) <a href="#objectives" id="objectives"></a> By the end of this lesson you should be able to: * Create a project with a smart contract using thirdweb * Deploy smart contracts using thirdweb * Interact with deployed smart contracts using thirdweb ### Prerequisites[​](https://docs.base.org/guides/deploy-with-thirdweb#prerequisites) <a href="#prerequisites" id="prerequisites"></a> The interactive thirdweb [command line interface](https://portal.thirdweb.com/cli) has everything you need to create, build and deploy smart contracts and apps to Ancient8 Testnet. We recommend using npx to always get the latest version. Alternatively, you can install the CLI as a global command on your machine: ``` npm i -g @thirdweb-dev/cli ``` ### Creating a project[​](https://docs.base.org/guides/deploy-with-thirdweb#creating-a-project) <a href="#creating-a-project" id="creating-a-project"></a> You can use the thirdweb [CLI](https://portal.thirdweb.com/cli) to create a new project that contains a smart contract, alternatively, you can deploy a prebuilt contract for NFTs, Tokens or Marketplace directly from the thirdweb [Explore](http://thirdweb.com/explore) page. To create a new project using the CLI, run: ``` npx thirdweb create contract ``` This will kick off an interactive series of questions to help you get started: * Give your project a name * Select `Hardhat` as the framework * Select `ERC721` as the base contract * Select None for optional [extensions](https://portal.thirdweb.com/contractkit/extensions) #### Exploring the project[​](https://docs.base.org/guides/deploy-with-thirdweb#exploring-the-project) <a href="#exploring-the-project" id="exploring-the-project"></a> The create command generates a new directory with your project name. Open this directory in your text editor. Inside the `contracts` folder, you'll find a `Contract.sol` file; this is our smart contract written in Solidity! If we take a look at the code, you can see that our contract is inheriting the functionality of [`ERC721Base`](https://portal.thirdweb.com/contractkit/base-contracts/erc-721/erc721base), by: 1. [Importing](https://solidity-by-example.org/import/) the contract 2. [Inheriting](https://docs.soliditylang.org/en/v0.8.17/contracts.html#inheritance) the contract; by declaring that our contract is ERC721Base 3. Implementing any [required methods](https://portal.thirdweb.com/contractkit/base-contracts/erc-721/erc721base#implementing-the-contract) such as the [constructor](https://docs.soliditylang.org/en/v0.8.17/contracts.html#constructors). ```solidity // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@thirdweb-dev/contracts/base/ERC721Base.sol"; contract Contract is ERC721Base { constructor( string memory _name, string memory _symbol, address _royaltyRecipient, uint128 _royaltyBps ) ERC721Base(_name, _symbol, _royaltyRecipient, _royaltyBps) {} } ``` This inheritance pattern lets us use functionality from other contracts inside of ours, modify it, and add custom logic. For example, our contract currently implements all of the logic inside the [`ERC721Base.sol`](https://github.com/thirdweb-dev/contracts/blob/main/contracts/base/ERC721Base.sol) contract; which implements the [`ERC721A`](https://github.com/thirdweb-dev/contracts/blob/main/contracts/eip/ERC721A.sol) standard with several useful [extensions](https://portal.thirdweb.com/contractkit/extensions). ### Deploying the contract[​](https://docs.base.org/guides/deploy-with-thirdweb#deploying-the-contract) <a href="#deploying-the-contract" id="deploying-the-contract"></a> You can use the thirdweb [CLI](https://portal.thirdweb.com/cli) to deploy a smart contract to Ancient8. To deploy your smart contracts, from the root directory of your project, run: ``` npx thirdweb deploy ``` Running this command will: * Compile all the contracts in the current directory. * Allow you to select which contract(s) you want to deploy. * Uploads your contract source code ([ABI](https://docs.soliditylang.org/en/v0.8.17/abi-spec.html)) to [IPFS](https://docs.ipfs.tech/concepts/what-is-ipfs/) * Open the deploy flow in the dashboard From the dashboard, you will need to first enter the values for our contract's constructor: * `_name`: The name of our contract * `_symbol`: The symbol or "ticker" given to our contracts tokens * `_royaltyRecipient`: The wallet address that will receive the royalties from secondary sales * `_royaltyBps`: The basis points (bps) that will be given to the royalty recipient for each secondary sale, e.g. 500 = 5% Finally, select the **Ancient8 Testnet** as the [network](https://blog.thirdweb.com/guides/which-network-should-you-use/) you want to deploy to, and click **Deploy Now**. {% hint style="info" %} **INFO** For production / mainnet deployments select **Ancient8 Mainnet** as the network rather than **Ancient8 Testnet**. {% endhint %} Once your contract is deployed, you'll be redirected to a [dashboard](https://portal.thirdweb.com/dashboard) for managing your contract. ### Interacting with your contract[​](https://docs.base.org/guides/deploy-with-thirdweb#interacting-with-your-contract) <a href="#interacting-with-your-contract" id="interacting-with-your-contract"></a> Thirdweb provides SDKs for various programming languages, including [React](https://portal.thirdweb.com/react), [React Native](https://portal.thirdweb.com/react-native), [TypeScript](https://portal.thirdweb.com/typescript), [Python](https://portal.thirdweb.com/python), [Go](https://portal.thirdweb.com/go), and [Unity](https://portal.thirdweb.com/unity). To interact with your smart contract, you can use the thirdweb [CLI](https://portal.thirdweb.com/cli) to create a web application that is pre-configured with the [thirdweb React SDK](https://portal.thirdweb.com/react). To create a web application preconfigured with the thirdweb SDK, run: ``` npx thirdweb create app –evm ``` This will kick off an interactive series of questions to help you get started: * Give your project a name * Select [`Create React App`](https://reactjs.org/docs/create-a-new-react-app.html#create-react-app) as the framework * Select `TypeScript` as the language #### Exploring the project[​](https://docs.base.org/guides/deploy-with-thirdweb#exploring-the-project-1) <a href="#exploring-the-project-1" id="exploring-the-project-1"></a> The create command generates a new directory with your project name. Open this directory in your text editor. Inside the [`index.tsx`](https://github.com/thirdweb-example/cra-typescript-starter/blob/main/src/index.tsx#L17-L19) file, you'll find the [`ThirdwebProvider`](https://portal.thirdweb.com/sdk/set-up-the-sdk/frontend#manual-installation) wrapping the entire application. This wrapper allows us to use all of the [React SDK](https://portal.thirdweb.com/react)'s hooks and [UI Components](https://portal.thirdweb.com/react/react.web3button) throughout the application, as well as configure an `activeChain`; which declares which chain our smart contracts are deployed to. Since we deployed our smart contract to the **Ancient8 Testnet**, we'll set the `activeChain` to **Ancient8 Testnet**: ```tsx ... import { ThirdwebSDKProvider } from "@thirdweb-dev/react"; const App = () => { return ( <ThirdwebSDKProvider activeChain={{ // === Required information for connecting to the network === \\ chainId: 2863311531, // Chain ID of the network // Array of RPC URLs to use rpc: ["https://rpc-testnet.ancient8.gg"], // === Information for adding the network to your wallet (how it will appear for first time users) === \\ // Information about the chain's native currency (i.e. the currency that is used to pay for gas) nativeCurrency: { decimals: 18, name: "Sepolia ETH", symbol: "ETH", }, shortName: "czkevm", // Display value shown in the wallet UI slug: "a8testnet", // Display value shown in the wallet UI testnet: true, // Boolean indicating whether the chain is a testnet or mainnet chain: "Ancient8 Testnet", // Name of the network name: "Ancient8 Testnet", // Name of the network }} > <YourApp /> </ThirdwebSDKProvider> ); }; ``` #### Interacting with the contract[​](https://docs.base.org/guides/deploy-with-thirdweb#interacting-with-the-contract) <a href="#interacting-with-the-contract" id="interacting-with-the-contract"></a> To connect to your smart contract in the application, provide your smart contract address (which you can get from the [dashboard](https://portal.thirdweb.com/dashboard)) to the [`useContract`](https://portal.thirdweb.com/sdk/interacting-with-contracts/custom-contracts/getting-a-contract#connect-to-a-contract) hook like so: ``` import { useContract } from '@thirdweb-dev/react'; export default function Home() { const { contract } = useContract('<CONTRACT_ADDRESS>'); // Now you can use the contract in the rest of the component! } ``` You can now call any function on your smart contract with [`useContractRead`](https://portal.thirdweb.com/sdk/interacting-with-contracts/custom-contracts/using-contracts#read-contract-data) and [`useContractWrite`](https://portal.thirdweb.com/sdk/interacting-with-contracts/custom-contracts/using-contracts#write-transactions) hooks. For example, you can call `useContractRead` to get the name of the contract: ``` const { data, isLoading } = useContractRead(contract, 'name'); ``` The thirdweb SDK also provides hooks for various interfaces and [extensions](https://portal.thirdweb.com/contractkit/extensions) that make reading and writing data easier. For example, we could use the [ERC721 hooks](https://portal.thirdweb.com/sdk/interacting-with-contracts/erc721) to fetch the metadata for our NFT contract. For more information on interacting with smart contracts using the thirdweb SDK, visit the [thirdweb developer documentation](https://portal.thirdweb.com/react). #### Deploying the project[​](https://docs.base.org/guides/deploy-with-thirdweb#deploying-the-project) <a href="#deploying-the-project" id="deploying-the-project"></a> To [host your application on IPFS](https://blog.thirdweb.com/guides/how-to-host-your-web-app-on-ipfs/), run the following command: ``` yarn deploy ``` This command uses [Storage](https://portal.thirdweb.com/storage) to: * Create a production build of your application * Upload the build to IPFS * Generate a URL where your app is permanently hosted. That's it! You now have a web application that interacts with smart contracts deployed to **Ancient8 Testnet**! # Deploying DApps&#x20; In this guide you will learn how to build a DApp on **Ancient8 Testnet**. To achieve this, you will deploy a smart contract for a NFT collection and create an NFT gallery DApp for viewing the metadata details of each NFT within the collection. # Using thirdweb thirdweb is a comprehensive development framework that empowers you to seamlessly build, launch, and manage web3 applications and games across any EVM-compatible blockchain. ### Objectives[​](https://docs.base.org/guides/build-with-thirdweb#objectives) <a href="#objectives" id="objectives"></a> By the end of this guide, you should be able to: * Create an NFT collection and mint new NFTs using thirdweb. * Develop an NFT gallery DApp using a prebuilt thirdweb templates. ### Prerequisites[​](https://docs.base.org/guides/build-with-thirdweb#prerequisites) <a href="#prerequisites" id="prerequisites"></a> #### 1. Setting Up a Metamask Wallet[​](https://docs.base.org/guides/build-with-thirdweb#1-setting-up-a-coinbase-wallet) <a href="#id-1-setting-up-a-coinbase-wallet" id="id-1-setting-up-a-coinbase-wallet"></a> To begin developing a DApp on Ancient8, you first need to set up a web3 wallet. We recommend using the Metamask Wallet, which can be easily created by downloading the Metamask Wallet browser extension. [Download Metamask Wallet](https://metamask.io/download/) #### 2. Wallet Funding[​](https://docs.base.org/guides/build-with-thirdweb#2-wallet-funding) Blockchain transactions, including deploying smart contracts, necessi
프로젝트로 돌아가기