Hướng dẫn deploy contract trên hệ sinh thái Zksync Era

FFRCYPTO COMMUNITY

FFRCYPTO COMMUNITY

LƯU Ý: KHÔNG NÊN SỬ DỤNG VÍ CHÍNH CHUYÊN SĂN RETRO ĐỂ TEST KÈO DÙNG VÍ PHỤ

Phần hướng dẫn được thực hiện dựa trên tài liệu của team NFD và chỉnh sửa by SnowFlower9x

  1. Tải các phần mềm hỗ trợ việc deploy

  • Download VS Code và cài đặt

  • Download NodeJS và cài đặt (quá trình này sẽ mất kha khá thời gian)

  • Tải file deploy contracts: https: /github.com/ZAZIK3/zksync-era-deploy

  • Truy cập link chọn vào Code => Download ZIP => Lưu file sau đó giải nén file ra 1 folder riêng

post image
  1. Tương tác với VS CODE

  • Mở phần mềm VS CODE

post image
  • Click File => Open Folder

post image
  • Chọn vào thư mục lưu file deploy vừa lưu xuống ở bước 1

  • Cài đặt Extension Solidity: File => Preferences => Extensions

post image
  • Ở ô tìm kiếm gõ vào Solidity

post image
  • Ấn vào Install

post image
  • Mở bảng Terminal

post image
  • Click vào file .Secret điền private key sau dòng 0x sau đó ấn Save

post image
  • Ở ô Terminal gõ lệnh sau: npx hardhat compile

  • Kết quả thành công "Successfully compiled 1 Solidity file".

post image
  • Tiếp tục gõ tiếp lệnh sau: npx hardhat deploy-zksync

  • Contracts được deploy như hình dưới, copy contracts chuẩn bị cho bước tiếp

post image

  1. Verify contracts

post image
  • Contracts chưa verify

post image
  • Click vào Contracts

post image
  • Click Verify Smart Contract

post image
  • Copy dòng code dưới đây:

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

    contract Greeter {
       string private greeting;

       constructor(string memory greeting) {
           greeting = greeting;
       }

       function greet() public view returns (string memory) {
           return greeting;
       }

       function setGreeting(string memory greeting) public {
           greeting = greeting;
       }
    }

  • Điền các thông số sau:

    • Zksolc Verision: v1.3.5

    • Solc Version: 0.8.17

    • Contracts Name: Greeter

    • Enter the Solidity Contract Code: Điền dòng code copy phía trên

post image
  • Dòng Contstructor Arguments điền như sau:

0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000094869207468657265210000000000000000000000000000000000000000000000

  • Click Verify Smart Contract

post image
  • Done

post image
post image

Hướng dẫn deploy contract trên hệ sinh thái Zksync Era