Docker Hub Documentation for SDK 0.1
Rholang SDK 0.1 License: GPL v2: http://openjdk.java.net/legal/gplv2+ce.html
The first release of the Rholang SDK includes the Rholang compiler, and the C++ Rosette runtime. With this release, you will be able to compile and run smart contracts on the Rosette Virtual Machine.
Docker Hub Instructions
General Docker Notes
In order to ensure that you have the most up-to-date version of an image, issue a docker pull
of that image. For example:
docker pull rchain/rholang-cli
will update your local docker's image with any changes since the last time it was pulled. A docker run
command will not necessarily update the image.
rchain/rholang-cli
This image provides an all-in-one compile-and-run mechanism for contracts written in Rholang. It takes an input file (the Rholang source), executes it displaying the output. For example, if you wish to run a file called /path/to/contract.rho
, issue
docker run -ti -v /path/to/contract.rho:/tmp/input.rho rchain/rholang-cli
This command causes that locally stored file to be made available to the container at the location /tmp/input.rho
, which is where the compiler expects its input.
If no -v
mapping is given, then the compilation step is skipped and the Rosette interpreter is run by itself. You can experiment with Rosette this way. For example:
$ docker run -ti rchain/rholang-cli Rosette System, Version 4.0.0 - Copyright 1989, 1990, 1991, 1992 MCC - Copyright 2017, 2018 RChain Cooperative rosette> (+ 1 2) 3 rosette>
Note that the VM may be exited by typing Control-d (^D) or by typing the form
(exit)
followed by enter at the rosette>
prompt.
Arguments
Additional arguments given to this command (arguments after the image name) will be passed to Rosette. One useful argument is -i
which will cause the interpreter to drop into a read-eval-print loop after execution, where it will accept and execute Rosette or RBL code, which may be useful for debugging a contract. Try also the --help
option, which will indicate what arguments are understood by Rosette:
$ docker run -ti -v /path/to/contract.rho:/tmp/input.rho rchain/rholang-cli --help Usage: /usr/local/bin/rosette [OPTION]... [FILE]... [-- <program_args> ...] Run FILEs in the rholang VM, possibly passing <program_args> to the program as its argv. -h, --help Prints this message and exits. -v, --verbose Verbose mode -q, --quiet Disable verbose mode -t, --tenure=NUM_GCS Number of GCs before tenuring an object -p, --paranoid-gc Enable paranoid GC -I, --infant-size=KB RAM to allocate for infant objects -s, --survivor-size=KB RAM to allocate for the survivors -o, --old-size=KB RAM to allocate for the old generation -d, --boot-dir=DIR BOOT directory -b, --boot=FILE BOOT file -i, --interactive-repl Always run the REPL, even if passed a script file to run.
Note that not all of the options make sense to pass from outside the running container. Also note that this release does not support passing a file directly to Rosette, bypassing the compiler.
Important notes on paths
Passing a file to the docker container is a very specific process. Both of these rules must be followed:
- The filename exposed to the container (the path to the left of the colon) must be an absolute path; in other words, it must start with a slash. In practice, this is only an inconvenience, since the path does not have to be canonical. A construction like
docker run -ti -v ${PWD}/../../examples/foo.rho:/tmp/input.rho rchain/rholang-cli
can work. - The filename to which the source file is mapped (appearing to the right of the colon) must be
/tmp/input.rho
or the compiler will not find it.
Example contracts
Although the command-line image does not ship with any, there are several example contracts in the examples directory of the GitHub repository.
Source and Further reading
Visit http://developer.rchain.coop/tutorial for code examples and a guide to coding in Rholang. You can also visit Github (link: https://github.com/rchain/rchain/tree/master/rholang ) where the source code lives, and on Confluence : RChain wiki
Feedback
We welcome feedback on our Gitter Channel (https://gitter.im/rchain/Releases) . You may file a bug here too: https://rchain.atlassian.net/secure/CreateIssueDetails!init.jspa?pid=10106&issuetype=10103&versions=10011&assignee=medha&summary=issue+created%20via+link
ToDo's
- Medha Parlikar (Unlicensed): Include a link to file a bug for each Docker image
- Medha Parlikar (Unlicensed): Include text for support / questions → Developer forum