🐣Hello World

Hello World on Zayn Network

Welcome to Zayn Network! This section is designed to help you take your first steps into the world of Zayn Network by guiding you through creating and deploying a simple "Hello World" smart contract. Whether you're a seasoned blockchain developer or new to the space, this tutorial will provide you with a practical introduction to the capabilities and functionalities of Zayn Network.

Introduction to Zayn Network

Before you begin, let's briefly discuss what Zayn Network is and why it's significant. Zayn Network is a Layer 2 blockchain solution designed to enhance scalability, speed, and cost-efficiency for developers and businesses in the MENAP and SEA regions. Leveraging advanced technologies such as ZK Rollups and dual data availability with Near and Bitcoin, Zayn Network offers a robust platform for building decentralized applications.

Setting Up Your Environment

  1. Install Required Software:

    • Ensure you have Node.js installed on your computer. If not, download and install it from Node.js official website.

    • Install the necessary Node packages and set up your development environment. You'll need a code editor like Visual Studio Code, which you can download from here.

  2. Install Zayn Network Tools:

    • To interact with Zayn Network, you'll need to install our CLI tool. Run the following command in your terminal:

      bashCopy codenpm install -g zayn-cli

Writing Your First Smart Contract

Now that your environment is set up, let's write your first smart contract.

  1. Create a New Directory for Your Project:

    bashCopy codemkdir HelloWorld
    cd HelloWorld
  2. Initialize a New Project:

    bashCopy codezayn-cli init
  3. Write the Smart Contract:

    • Create a new file called HelloWorld.sol in the contracts directory.

    • Open HelloWorld.sol and paste the following Solidity code:

      solidityCopy code// SPDX-License-Identifier: MIT
      pragma solidity ^0.8.0;
      
      contract HelloWorld {
          string public greeting = "Hello, Zayn Network!";
      
          function setGreeting(string memory _greeting) public {
              greeting = _greeting;
          }
      
          function getGreeting() public view returns (string memory) {
              return greeting;
          }
      }

Deploying and Testing Your Smart Contract

  1. Compile Your Smart Contract:

    bashCopy codezayn-cli compile
  2. Deploy Your Smart Contract to Zayn Network:

    bashCopy codezayn-cli deploy
  3. Interact with Your Smart Contract:

    • Use the Zayn CLI or our web interface to call the getGreeting and setGreeting functions.

Congratulations! You've successfully deployed your first smart contract to Zayn Network. This simple example is just the beginning of what you can build on our platform. Explore our documentation further to learn about more complex functionalities and how you can leverage Zayn Network's unique features for your projects.

Last updated