Creating a Smart Contract

Creating a Smart Contract

Let’s begin by creating a “Hello World” contract. This contract will have a single method that returns a string.

Important: Make sure you have the Linkd Dev Tools extension installed and configured.

Create a New Project

First, create a new folder for your project. Then, open the folder in Visual Studio Code.

Next, use the extension to create a new smart contract project.

  • Press Ctrl+Shift+P to open the command palette.
  • Type Linkd and select Linkd: New Smart Contract Project.
  • Name it Coin and press Enter.

The extension will create a new project in your folder. It will also create a file with instructions on how to build and deploy your project.

Next, add some code to your project source file:

Note: Neo uses lower camel case for method names. We suggest you follow this convention until you get more familiar with Neo.

Running the Hello World Contract

Use the extension to run your contract:

Run Extension Use the Run button above the method name.

The extension will compile and deploy the contract. It will send the transaction to a local Neo blockchain running on your computer. If you don’t have a local Neo blockchain, the extension will create one for you using .

The extension will also add an update method to your contract. This method will allow you to update your contract after it has been deployed. Note that the update method template is not secured and should be changed before deploying your contract to the Mainnet or Testnet environment.

The output window will display the result of the transaction. You should see the following message: