Deploying a Neo Contract to Testnet

Apr 29, 2024 11:46:57 PM

Deploying the Smart Contract

You can deploy your smart contract to the TestNet using different methods:

  • Linkd Dev Tools extension for Visual Studio Code
  • Neo Nova.
  • SDKs
    • Available in Javascript, Python, Java, and Go.
  • Neo CLI
  • Neo Go CLI
  • Neo GUI

Deploying a Contract using the Linkd Dev Tools Extension

Find the _deploy method in the smart contract file and click on the Deploy to Remote button. The extension will ask you to select an . Select one that has at least 10 TestNet $GAS. The extension will compile the smart contract and deploy it to the TestNet.

Deploying a Contract using Neo Nova

Neo Nova is a tool developed by the Rentfuse team. It allows you to deploy using a web interface. Neo Nova supports both Neo Line and Neon .

To deploy a contract using Neo Nova, follow these steps:

  • Visit the Neo Nova website.
  • Select the Contract tab in the left sidebar.
  • Click on Select Wallet in the top right corner.
    • Select the wallet you want to use.
    • Click Connect.
  • Once the wallet is connected, click Import.
    • Click to import the NEF and Manifest.
  • Click Deploy.

If the deployment fails, try other methods.

Deploying a Contract using the Neo SDKs using a WIF

Use the following code to deploy a smart contract using the Neo SDKs. Replace the wif value with your private key. The code exposes the user’s private key and should not be used in production.

Deploying a Contract using the Neo CLI

Neo CLI is a full-node implementation for the Neo . It needs to sync before it can be used. Neo CLI is a command-line application and must be run in a terminal. Follow these steps to download and configure Neo CLI:

  • Download the latest Neo CLI release for your operating system.

  • Extract the files to a folder.

  • Copy the contents of config.testnet.json and replace the contents of config.json with it.

    • The application uses MainNet by default. This step will change it to TestNet.
  • To run Neo CLI, navigate to the folder where you extracted the files and run the following command:

  • This will start the Neo CLI application. It will automatically start syncing with the TestNet.

Once Neo CLI is running, use the following commands to import your account and deploy the contract:

Verifying the Deployment

After deploying the smart contract, visit the Dora Explorer and search for your contract.

You should see your contract on the list. Click on it to see the contract details. If you can’t find your contract, it means that the transaction has failed. Ensure that the account you are using has more than 10 TestNet $GAS.