Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time

RADON encoding

RADON scripts are encoded using CBOR, a very efficient, compact and widely supported data structure encoding.

Look for example at this succinct (28 bytes) serialized RADON script:

// As Hex string

// As Base64 string

Once decoded, the resulting structure will represent this RADON script:

    STRING_PARSEJSON,       // 0x45
    MIXED_ASMAP,            // 0x74
    [ MAP_GET, "weather" ], // [ 0x61, "weather" ]
    MIXED_ASMAP,            // 0x74
    [ MAP_GET, "temp" ],    // [ 0x61, "temp" ]
    MIXED_ASFLOAT           // 0x72

!!! tip RADON scripts are pure byte code sequences, and at the same time represent high-level abstractions. In the Javascript-like representation of RADON that the Witnet Truffle box uses, the script above may resemble:

new Witnet.Script()

!!! info "Constants" All across this documentation, unquoted uppercase names like STRING_PARSEJSON identify different operators and constants that equate to a single byte when encoded.

A list of constants can be found in the [Constants section][constants].