Transpile-Compile

Transpile

This endpoint is use to convert solidity script into sCrypt. We need to pass base64 version of solidity script and in response we will get sCrypt script.

Transpile solidity code to sCrypt.

POST https://api.relysia.com/v1/transpile

Takes base64 string of solidity code and converts it to sCrypt.

Headers

Name
Type
Description

force

boolean

Request Body

Name
Type
Description

sourceCode*

string

base64 of solidity script

{
  "statusCode": 200,
  "data": {
    "status": "success",
    "msg": "Transpiled successfully",
    "scrypt": "contract Counter {\n  @state\n  public int count;\n\n  public function get(int retVal, SigHashPreimage txPreimage) {\n    require(this.count == retVal);\n    require(this.propagateState(txPreimage, SigHash.value(txPreimage)));\n  }\n\n  public function inc(SigHashPreimage txPreimage) {\n    this.count += 1;\n    require(this.propagateState(txPreimage, SigHash.value(txPreimage)));\n  }\n\n  public function dec(SigHashPreimage txPreimage) {\n    this.count -= 1;\n    require(this.propagateState(txPreimage, SigHash.value(txPreimage)));\n  }\n\n  function propagateState(SigHashPreimage txPreimage, int value) : bool {\n    require(Tx.checkPreimage(txPreimage));\n    bytes outputScript = this.getStateScript();\n    bytes output = Utils.buildOutput(outputScript, value);\n    return hash256(output) == SigHash.hashOutputs(txPreimage);\n  }\n}",
    "errorLogs": []
  }
}

Compile

This endpoint is use to convert sCrypt script into bitcoin script. We need to pass base64 version of sCrypt script and in response we will get bitcoin script.

Compile sCrypt code to Bitcoin Script.

POST https://api.relysia.com/v1/compile

Takes base64 string of sCrypt code and converts it to Bitcoin Script.

Request Body

Name
Type
Description

sourceCode*

string

base64 of sCrypt script

Last updated