Setup Boilerplate

This article will get you started with AElf's Boilerplate project. You will learn the following items:

  • setting up the basic environment for developing contracts and dApps.

  • downloading AElf Boilerplate's code and setting up Visual Studio Code.

  • running a template contract and basic interactions from a dApp frontend with the Javascript SDK demo and the browser extension.



Strictly speaking you don't need an IDE for this tutorial but it is highly recommended. If you don't already have one we recommend you try Visual Studio Code (vscode) with the C# extension:

  • installation instructions here.

  • working with C# here.

Clone the repository

Open a terminal in your system and clone the tutorial with the following command:

git clone

This command will create a aelf-boilerplate folder with the code inside it.

Run the contract

Open the project

If not already done open vscode and open the aelf-boilerplate folder.

If asked to add some "required assets" say yes. There may also be some dependencies to restore: for all of them choose Restore.

Open vscode's Integrated Terminal and build the project with the following command. Note: you can find out more about vscode's terminal here.

Install script

If you don't already have protobuf installed, run the following script:

  • On Mac or Linux:

    sh chain/scripts/
  • On Windows: Windows is slightly more complex. You need to open a PowerShell console as administrator. Enter your clone directory so your PowerShell is currently in the root of aelf-boilerplate clone. Run the following:


Note: if you prefer or have problems, you can refer to the following guide to manually install protobuf on your system.

Build and run

cd chain/src/AElf.Boilerplate.Launcher/
dotnet build

To actually run the node, use the following command.

dotnet run bin/Debug/netcoreapp3.0/AElf.Boilerplate.Launcher

At this point the smart contract has been deployed and is ready to use. You should see the node's logs. You can now stop the node by killing the process (usually control-c or ctrl-c in the terminal).

If you want to run the tests, simply navigate to the HelloWorldContract.Test folder. From here run:

cd ../../test/HelloWorldContract.Test/
dotnet test

The output should look somewhat like this:

Total tests: 1. Passed: 1. Failed: 0. Skipped: 0.