ErgoScript playground using Kiosk#
Kiosk lets anyone play with ErgoScript using a basic web-based UI. In particular, it can do the following:
- Define boxes with arbitrary ErgoScript code and register values
Create transaction outputting some predefined boxes
An online instance of Kiosk for experimental use is deployed at ergo.kioskweb.org/
- This is running the exact code from GitHub
- Please use the above instance only for experiments and not for transferring any large amounts.
- For actual use, run your local instance as explained below.
Kiosk requires a fully configured Ergo node running and, by default, assumes that its REST API is available at http://localhost:9052. You can change this by calling the method
org.sh. Kiosk.ergo.ErgoAPI.setUrl from the web-UI.
A precompiled jar is available here, which can be run using
java -jar <jarfile>.
You can generate the jar from sources by issuing the command
To run a local copy (which is the recommended way to use it), you must clone the project and do one of the following.
Run sbt using the command
sbtThen inside the sbt prompt, type the following
jetty:startThis will run the project using a built-in Jetty web server on port 8080, which you can access at http://localhost:8080
Compile the war file using the
sbt package. (the file is in
target/scala-2.12folder in my case). Then run the war file as you would run any other J2EE app.
Kiosk currently depends only on ergo-appkit and uses the public explorer to post transactions. In particular, it does not require a local running Ergo node.
Signing is performed via Appkit, which replicates a large part of the Ergo node wallet's functionality locally. After all, both are JVM based).
The Kiosk is "multi-tenant" because each URL corresponds to a private copy of the script environment and box storage. Hence you can bookmark a URL and visit it later, and your declared variables and boxes should be present. Without the same URL, no one else will be able to see or modify your environment.
- Set the environment to use in ErgoScript. This is a map of (key, value) pairs where keys will be referenced within ErgoScript code and set boxes' registers. See the first image.
- Define one or more boxes using ErgoScript code and some registers if needed. See the second image.
- Create and send a transaction with some given boxes defined earlier in Step 2. See the third image.
The final output will be the transaction's ID and the request we made to the Ergo node's API.