ErgoScript playground using Kiosk

I created a tool called Kiosk that allows one to play with ErgoScript using a basic web-based UI. In particular, we can do the following:

  1. Define boxes with arbitrary ErgoScript code and register values
  2. Create transaction outputting some predefined boxes

URL: https://github.com/scalahub/Kiosk

Kiosk is opensource and written in Scala. To run it from source, first, clone the repository and do
sbt run (requires SBT to be installed). The web-interface will open in http://localhost:8080

Kiosk requires a fully configured Ergo node running and by default assumes that its REST API is available at http://localhost:9052. This can be changed 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 sbt assembly.

Use it as follows:

  1. Set the environment to use in ErgoScript. This is a map of (key, value) pairs where keys will be referenced within ErgoScript code and also for setting registers of boxes. See the first image.
  2. Define one or more boxes using ErgoScript code and some registers if needed. See the second image.
  3. Create and send a transaction with some given boxes defined earlier in Step 2. See the third image.

The final output will be txid of the transaction along with the request that was made to the Ergo node’s API.

Please provide suggestions for improvement and feel free to contribute.

3 Likes

It seems Kiosk is the most powerful tool to work with the scripts right now. Unlike other tools it is supporting context variables. Will play with it more in coming days.

Sent a transaction using Kiosk on mainnet fb8261828d8955c15d9ff6d7e1e0c3d6935228ff3c0af5effd95ce08018ecc76 The last two boxes are protected by the script “1<2” (one P2SH and one P2S). Anyone reading this, feel free to spend.

Please use release 0.2 or higher, since 0.1 is broken.

2 Likes

I was able to claim the P2S box (it was quite straightforward as no additional information was required to spend the box, since the script already evaluates to true).

However, I’m having trouble spending the P2SH box. My script matches the expected blake2b-256 hash. But I get the following error:

Malformed transaction: Scripts of all transaction inputs should pass verification. 6ab7e2e0d8bb2c62b2209c80dec88227f6af83f6ccfdb61ff3df864933e1acca: #1 => Failure(org.ergoplatform.validation.ValidationException: Validation failed on ValidationRule(1000,Deserialized script should have expected type) with args WrappedArray(DeserializeContext(1,SSigmaProp), ConstantNode(Coll(-1),Coll[SInt$])))

It’s possible I’m not serialising the context variable correctly and I’m missing some kind of wrapper. Or perhaps there’s a bug in the P2SH contract?

1 Like