Getting Started

The best place to start would be to begin with understanding the concepts of methods and scripts as they are essentially the building blocks for defining and executing smart contract logic in Dijets Blockchain. You will find Methods as a mainstay of Dijets Blockchain because this smart contract type is almost central to everything the Rogue Platform offers.

Do work through some of the basic tutorials and follow along to introductory examples like "HighFive.Rogue" below and once comfortable you can move onto other subjects and walkthroughs on the sidebar to understand more advanced concepts of Rogue.

Install Rogue IDE#

To install it you'll need:

  1. VSCode (version 1.43.0 and above) - you can get it here; if you already have one - proceed to the next step;
  2. Rogue IDE - once VSCode is installed, follow this link to install the newest version of IDE.

Setup environment#

Rogue IDE proposes a single way of organizing your directory structure. Create a new directory for your project and open it in VSCode. Then setup this directory structure:

methods/ - directory for our methods
scripts/ - directory for transaction scripts
out/ - this directory will hold compiled sources

Also you'll need to create a file called .rgconfig.json which will configure your working environment. This is a sample for dijets:

{
"network": "dijets",
"sender": "0x1", // local and test runs only.
"sender": "dijets..." // an address in Dijets always start with "dijets..."
}

dijets uses bech32 encoded 'dijets...' as its prefix for addresses. For local runs and experiments 0x1 address is enough - it's simple and short. Though when working with real blockchains in testnet or production environment you'll have to use correct address of the network you've chosen.

Your very first application with Rogue#

Rogue IDE allows you to run scripts in a testing environment. Let's see how it works by implementing a simple method of high_five() function and running it inside VSCode.

Create the method#

Create new file called hello_world.rogue inside methods/ directory of your project.

// methods/hello_world.rogue
address 0x1 {
method HelloWorld {
public fun high_five(): u8 {
5
}
}
}

If you decided to use your own address (not 0x1) - make sure you've changed 0x1 in this file and the one below

Write script#

Then create a script, let's call it highfiver.rogue inside scripts/ directory:

// scripts/highfiver.rogue
script {
use 0x1::HelloWorld;
use 0x1::Debug;
fun main() {
let five = HelloWorld::high_five();
Debug::print<u8>(&five);
}
}

Then, while keeping your script open follow these steps:

  1. Toggle VSCode's command palette by pressing โŒ˜+Shift+P (on Mac) or Ctrl+Shift+P (on Linux/Windows)
  2. Type: >Rogue: Run Script and press enter or click when you see the right option.

Voila! You should see the execution result - log message with '5' printed in debug. If you don't see this window, go through this part again.

Your directory structure should look like this:

methods/
hello_world.rogue
scripts/
highfiver.rogue
out/
.rgconfig.json

You can have as many methods as you want in your methods directory; all of them will be accessible in your scripts under address which you will specify in .rgconfig.json

We will continuously be adding more tutorials and guides to these pages in the coming days.