The evaluation of rholang code is done on a rnode client. This tutorial explains how to setup everything to run rholang code in VSCode with the use of a rholang extension
The VSCode extension runs with Windows, Linux, Mac. This tutorial describes the installing process for windows.
Prerequisites: Windows 10
Install the latest updates for windows 10 and install the latest version of docker. Click on Get Docker and install it on your pc. Restart the pc.
After restart run the Docker Desktop application.
There has to be a white docker logo on the windows taskbar.
If the docker logo ist red, then there is a docker problem with your pc (sometimes wsl_update_x64.msi has to be additionally installed).
Install the VSCode extension for rholang. Search for the rholang extension, install it and then got to setting for this extension.
The checkbox for Enable Docker and the Rnode Docker Image (rchain/rnode:v0.12.1) has to be set.
Open to the command line in vscode and to the OUTPUT tab. Then select rholang on the dropdown menu on the right. Wait for a minute until there is the output Rholang VM is ready!.
Create a new file with the .rho extension. And write some rholang code:
new helloworld, stdout(`rho:io:stdout`) in {
contract helloworld( world ) = {
for( @msg <- world )
{ stdout!(msg) }
}
| new world, world2 in {
helloworld!(*world)
| world!("Hello World")
| helloworld!(*world2)
| world2!("Hello World again")
}
}
Save the hello.rho file with strg+s. After every save the rholang file is evaluated on the rnode instance in docker.
Open a terminal in VSCode, go to OUTPUT and select Rholang in the navbar. The evaluated result of the code in this example is: "Hello World again" "Hello World".
⚠️ If you get the following errors in your console:
docker: Error response from daemon: open \.\pipe\docker_engine_linux or
docker: Error response from daemon: status code not OK but 500: then wait and restart vscode again.