Coin Hunters Services
  • Introduction
  • Mainnet
    • Avail
      • Installation
      • Upgrade
    • Babylon
      • Installation
      • Service
      • Useful commands
      • Snapshot
    • CrossFi
      • Service
      • Installation
      • Useful commands
    • Dymension
      • Service
      • Installation
      • Snapshots
      • Useful commands
      • Upgrade
    • Lava Network
      • Service
      • Installion
      • Snapshots
      • Useful commands
    • Nibiru
      • Service
      • Installation
      • Useful commands
      • Snapshot
    • Zeta Chain
      • Service
      • Installation
      • Useful commands
      • Upgrade
    • Mantra Chain
      • Installation
      • Service
      • Useful commands
      • Snapshot
    • Rivalz
      • zNode
    • Kopi Money
      • Installation
      • Service
      • Useful commands
      • Snapshot
      • Upgrade
    • Story Protocol
      • Story Mainnet
        • Installation
        • Snapshots
        • Service
        • Upgrade
    • Side Protocol
      • Installation
      • Snapshots
      • Useful commands
    • Fuel Network
      • Installation
      • Snapshots
      • Useful commands
  • Testnet
    • 0G Labs
      • Service
      • Installation
      • Useful commands
      • 0G-Newton
        • Service
        • Installation
        • Useful commands
        • Snapshots
    • Airchains
      • Varanasi
        • Service
        • Installation
        • Snapshots
        • Useful commands
      • Junction
        • Service
        • Installation
        • Snapshots
        • Useful commands
      • Rollup Evm Airchains
      • Auto TX Script
    • AligendLayer
      • Installation
    • Allora Network
      • Service
      • Installation
      • Snapshots
      • Useful commands
      • Worker Node
    • Artela Network
      • Service
      • Installation
      • Snapshots
      • Useful commands
    • Avail
      • Installation
      • Update v2.2.1
    • Babylon
      • Installation
      • Useful commands
    • CrossFi
      • Service
      • Installation
      • Useful commands
      • Snapshots
    • Dill
      • Andes
      • Alps
    • Dymension
      • Service
      • Installation
      • Useful commands
    • Elys Network
      • Service
      • Installation
      • Snapshots
      • Useful commands
    • Empeiria
      • Service
      • Installation
      • Snapshots
      • Useful commands
    • Ethernity Chain
      • Deploy a Smart Contract and Verify
      • Create an ERC-20 token and Verify
      • Create an NFT Collection and Verify
    • Farcaster Node Hubble
      • Upgrade
    • Fiamma Chain
      • Service
      • Installation
      • Snapshots
      • Useful commands
    • Initia
      • Service
      • Installation
      • Snapshots
      • Useful commands
    • Lava Network
      • Service
      • Installation
      • Useful commands
    • Mantra Chain
      • Hongbai Testnet
        • Service
        • Installation
        • Snapshots
        • Useful commands
      • Dukong Testnet
        • Service
        • Installation
        • Snapshot
        • Useful commands
    • Nillion Network
      • Service
      • Installation
      • Snapshots
      • Useful commands
      • Verifier Program
    • Nubit
      • Light Node
      • Installation Validator
    • PINGPONG
      • Installation
      • 0G Storage Kurulumu
      • Grass Kurulumu
    • Rivalz
      • Linux Client
    • Side Protocol
      • S3 Tesnet
        • Service
        • Installation
        • Useful commands
      • S2 Incentivized Testnet
        • Installation
        • Useful commands
      • S4 Incentivized Tesnet
        • Service
        • Installation
        • Useful commands
        • Snapshots
    • Sunrise Layer
      • Service
      • Installation
      • Snapshots
      • Useful commands
      • Manual upgrade
    • Union
      • Service
      • Testnet-9
        • Installation
        • Snapshots
        • Useful commands
      • Testnet-8
        • Installation
        • Snapshots
        • Useful commands
    • Warden Protocol
      • Service
      • Installation
      • Snapshots
      • Useful commands
      • Chiado Testnet
        • Installation
        • Useful commands
    • Zero Network
      • Deploy a Smart Contract
    • Story Protocol
      • illiad Testnet
        • Installation
        • Snapshots
        • Upgrade
      • Odyssey testnet
        • Service
        • Installation
        • Snapshots
        • Useful Tool
      • Story Aeneid
        • Installation
        • Snapshots
        • Service
    • Hemi Network
    • Axone Chain
      • Service
      • Installation
      • Snapshots
      • Useful commands
    • Glacier Network
      • Installation
    • Pipe Network
      • Installation
    • Pell
      • Service
      • Installation
      • Snapshots
      • Useful commands
    • Native Network
      • Service
      • Installation
      • Snapshots
      • Useful commands
    • XRPL EVM
      • Installation
      • Useful commands
      • Snapshot
      • Service
    • Lumera Protocol
      • Installation
      • Useful commands
      • Snapshot
      • Service
Powered by GitBook
On this page
  • Gereksinimleri Yükleyelim..
  • Hello adında dosya açalım
  • Hardhat için gereksinimleri yükleyelim.
  1. Testnet
  2. Ethernity Chain

Deploy a Smart Contract and Verify

PreviousEthernity ChainNextCreate an ERC-20 token and Verify

Last updated 9 months ago

Aşağıdaki tüm adımları yapmadan önce Cüzdanınızda Sepolia ETH ağında biraz test ETH olması gerekiyor. Oradaki ETH'ları Ethernity test ağına geçirmeyi unutmayın. Yoksa işlemleriniz onaylanmaz.

Herhangi bir VPS Ubuntu 22.04 sunucu içerisinde çalıştırabilirsiniz.github codespace üzerinden tüm adımları yapabilirsiniz. Size kalmış.

Gereksinimleri Yükleyelim..

curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs

Hello adında dosya açalım

mkdir hello && cd hello
npm init -y

Aşağıdakine benzer bir çıktı alırsanız işlem tamamdır.

Hardhat için gereksinimleri yükleyelim.

npm install --save-dev hardhat ts-node typescript @nomicfoundation/hardhat-toolbox ethers@^6.1.0 dotenv

npm install --save-dev @nomicfoundation/hardhat-verify
npx hardhat

Size seçenekler sunacak TypeScript project seçin diğerlerine enter yaparak ilerleyebilirsiniz.

cd contracts
rm Lock.sol
nano Hello.sol

Hello sol adında açtığımız akıllı kontrata aşağıdaki bilgileri değiştirmeden ekliyoruz.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract Hello {
    function hi() public pure returns (string memory) {
        return "Hey there!";
    }
}
cd ..
nano hardhat.config.ts

hardhat config dosyasını aşağıdaki gibi ekliyoruz. Ekledikten sonra CTRL X Y enter yapmayı unutmayın.

   import { HardhatUserConfig } from "hardhat/config";
   import "@nomicfoundation/hardhat-toolbox";
   import "@nomicfoundation/hardhat-verify";
   import * as dotenv from "dotenv";

   dotenv.config();

   const config: HardhatUserConfig = {
     etherscan: {
       apiKey: {
         ernscan: "ernscan", // apiKey is not required, just set a placeholder
       },
       customChains: [
         {
           network: "ernscan",
           chainId: 233,
           urls: {
             apiURL: "https://api.routescan.io/v2/network/testnet/evm/233/etherscan",
             browserURL: "https://testnet.ernscan.io"
           }
         }
       ]
     },
     networks: {
       ernscan: {
         url: 'https://testnet.ethernitychain.io',
         accounts: [process.env.PRIVATE_KEY!]
       },
     },
     solidity: "0.8.0",
   };

   export default config;

Metamask cüzdanımızın private key'ini ekleyeceğiz

nano .env
PRIVATE_KEY=a43b28caca8..................

şeklinde private keyimizi ekleyip CTRL X Y enter yapıyoruz.

npx hardhat compile

bu şekilde çıktı alırsanız işlem tamamdır. Şimdi devam edelim.

mkdir scripts
nano scripts/deploy.ts
import { ethers } from "hardhat";

async function main() {
    const Hello = await ethers.getContractFactory("Hello");
    const hello = await Hello.deploy();
    await hello.waitForDeployment();
    console.log("Hello deployed to:", await hello.getAddress());
}

main()
  .then(() => process.exit(0))
  .catch(error => {
    console.error(error);
    process.exit(1);
  });

Hiçbir şeye dokunmadan direkt olarak yapıştırıp. kayıt ediyoruz.

npx hardhat run scripts/deploy.ts --network ernscan

Böyle bir çıktı aldığınızda tebrikler. Ethernity ağında akıllı kontrat yayınladıınız. Sıra geldi verify etmeye.

npx hardhat verify --network ernscan <deployed_contract_address>

Bir önceki komutta aldığınız kontrat adresiniz <> dahil silip oraya yazdığınızda, ağda yayınlamış olduğunuz kontratı verify yapmış olursunuz.

adresinden kontrat adresinizi kontrol edebilirsiniz.

https://testnet.ernscan.io/
BURADAN
BURADAN