NetX Network Smart Contract Deployment Guide

NetX World
7 min readJul 31, 2024

--

Essential Tools & Websites

https://chromewebstore.google.com/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn

https://remix.ethereum.org/#lang=en&optimize=true&runs=200&evmVersion=paris&version=solj son-v0.8.26+commit.8a97fa7a.js

https://www.tscscan.io/

Smart Contract

The NetX Network adopts a well-established approach to smart contract execution by leveraging the Ethereum Virtual Machine (EVM). This selection facilitates the utilization of Solidity, a high-level object-oriented programming language specifically designed for blockchain environments. By adopting these industry-standard tools, NetX Network fosters a familiar development environment for programmers, streamlining the creation of secure and dependable applications on its platform.

The NetX­ Network’s virtual machine (EVM) is currently compatible with the Paris version and is working on adding support for newer versions like Shanghai and Cancun.

Development Tools

MetaMask

MetaMask is a browser extension that allows users to interact with the Ethereum blockchain. As a Crypto wallet, MetaMask can store users’ private keys, thereby protecting their assets.

How to Install MetaMask

1️⃣ Download and Install the MetaMask Extension

  • Open your web browser (Chrome, Firefox, Brave, Microsoft Edge, etc.) and search for MetaMask in your browser’s extension store. Alternatively, you can open the following download link and install the appropriate MetaMask extension for your browser: https://metamask.io/download/
  • Once the installation is complete, click on the MetaMask icon in the top right corner of your browser to open the wallet interface. Upon first opening, you will need to set a password to ensure the security of your wallet.

2️⃣ Create or Import a Wallet

  • Next, you will need to create a new wallet or import an existing one. If you are using MetaMask for the first time, it is recommended to choose “Create New Wallet” and keep your private keys and seed phrase safe.

Additional Resources

For more information on using MetaMask, web3 and blockchain basics, please visit the MetaMask website: https://metamask.io/

Remix

We will be using Remix to run the Solidity smart contract. Remix is the official Ethereum-recommended integrated development environment (IDE) for smart contracts. It is beginner-friendly and allows for quick development and deployment of contracts directly in the browser, without the need to install any software locally.

Website: https://remix.ethereum.org

TscScan

TscScan is a block explorer and analytics platform for the Trust Smart Chain. TscScan provides a wide range of tools to help users understand what is happening on the Trias blockchain, manage their accounts, and track transactions.

Your First Trust Smart Chain Smart Contract

Your First Trust Smart Chain Smart Contract:

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.26;

contract HelloTRIAS {

string public greeting = “Hello TRIAS !”;

}

Let’s break down the program and learn about the structure of Solidity smart contract source code files:

  1. The first line is a comment that explains the software license used by the code. In this case, the MIT license is used. If the license is not specified, a warning will be issued during compilation, but the program will still run. Solidity comments start with “//”, followed by the comment content. Comments are not executed by the program.

// SPDX-License-Identifier: MIT

2. The second line declares the Solidity version used by the source file, as there are differences in syntax between different versions. This line of code indicates that the source file will not allow compilers that are less than version 0.8.26 or greater than or equal to version 0.9.0 to compile (the second condition is provided by the keyword “require”). Solidity statements end with a semicolon (;).

pragma solidity ^0.8.26;

3. 1. Lines 3–4 define the smart contract itself. The contract keyword marks the beginning of the contract definition, followed by the contract name HelloTRIAS. This name serves as an identifier for the contract on the blockchain.

Within the contract curly braces, the contract’s state variables and functions are declared. Line 4 introduces a state variable named greeting of type string. This variable stores a text message that can be accessed and modified through the contract's functions.

The greeting variable is declared as a string type, indicating that it can hold a sequence of characters. The initial value of the variable is set to "Hello TRIAS!", a message that the contract can later retrieve and return.

Deploying Smart Contracts on the NetX Network

  1. Open the Remix IDE and Create a New HelloTRIAS Workspace

2. Create the first contract file HelloTRIAS.sol and copy the contract code into the file.

3. Compile HelloTRIAS.sol

4. To add the NetX Network in MetaMask, open the TscScan website and add the NetX network to MetaMask.

5. Return to the Remix website, navigate to the deployment page, select the network to deploy to, and choose the account address for the contract deployment.

6. Obtain TAS Tokens.
Check out the details here to see if you’ve received TAS, and if not, keep an eye out for us at the upcoming series or contact the team on the official NetX X (Twitter).

7. Confirm the contract to be deployed and the deployer's address.

Once you’ve successfully deployed your smart contract, you’ll need to wait for the transaction to be processed and confirmed before you can view it on TscScan.

8. Publishing a smart contract on TscScan.

9. Select the appropriate contract open-sourcing method and compilation parameters.

10. Publish the contract code as open-source after pasting it.

11. The deployed smart contract code will be viewable on the TscScan browser shortly.

🎉 Congratulations on successfully deploying and open-sourcing your first smart contract on TRIAS’s NetX blockchain network!

Obtain your first NFT on the NetX Mainnet

The Trias developers have prepared an NFT for users, which all users can mint for free.

Create a new file in Remix, name it NetXNFT.sol, and copy the following token code into it.

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.20;
interface INetXGenesis {
function mint() external;
}

Similarly, the NFT interface smart contract has only 1 comment and 3 lines of code:

1.The first line is a comment that specifies the software license used by the code, which is the AGPL-3.0-only license.

// SPDX-License-Identifier: AGPL-3.0-only

2. The second line declares the Solidity version used by the source file, as different versions have different syntax. This line indicates that the source file will not allow compilation with a version lower than 0.8.20 or greater than or equal to 0.9.0 (the second condition is provided by ^). Solidity statements end with a semicolon (;).

pragma solidity ^0.8.20;

3. The third and fourth lines are the contract part. The third line creates a contract interface and declares the contract name as INetXGenesis. The fourth line is the contract content, declaring a mint interface function.

interface INetXGenesis {

function mint() external;

}

After compiling (the compilation parameters are not important), select the NetXNFT file on the deployment page, then click the At Address button (this button will not deploy the contract but will instantiate an on-chain contract for us to interact with). Fill in the NFT contract address: 0x00000000266EFafEa8C117C9fd1c7d3Ba71693e7. Then, in the contract interaction window, select the mint function and click the mint button. In the MetaMask plugin that pops up, click the confirm button to mint the NFT.

After waiting for the transaction confirmation, you can view the newly minted NFT in the TscScan browser.

About NetX

A modular economic network by TRIAS ECO. Integrates blockchain and AI, pioneering AI Agent-based interaction models.

🔹Website: https://www.netx.world/
🔹Twitter: https://x.com/netx_world
🔹Telegram: https://t.me/netx_world
🔹Medium: https://medium.com/@netxworld

--

--

NetX World

A modular economic network by #TRIAS ECO. Integrates #blockchain and #AI, pioneering #AI #Agent-based interaction models.