Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
52 lines (41 sloc) 1.53 KB

RADON encoding

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

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

// As Hex string

// As Base64 string

Once decoded, the resulting structure will actually 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 but 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].
You can’t perform that action at this time.