RADON API
RADON is a scripting language that retrieves, attests to, and delivers data within the Witnet Decentralized Oracle Network, facilitating the conversion of the request into a CBOR representation and subsequently into a protobuf bytes schema.
There are several components that are used to build a RADON Request.
RADRequest
Constructor Parameters:
Request Methods:
addSource
addSource
The addSource
method pushes a source to the retrieve
array and sets the data point type to the last type of the source.
setAggregator
The setAggregator
method sets a aggregate field
(RADAggregate
) for data aggregation.
setTally
Method to set the tally for data aggregation.
rejects unsupported operators
sanitize malformed filters and reject unsupported filters
setQuorum
Method to set the quorum parameters
witnesses
: the number of witnessesmin_consensus_percentage
: the minimum consensus percentage
setCollateral
collateral
: the collateral amount in nanoWIT which needs to be >= 1 WIT e.g. 1000000000 nanoWIT
setFees
reward
: the witness rewardcommit_and_reveal_fee
: the commit and reveal fee
schedule
timestamp
setTimestamp
timestamp
asJson
RADRetrieve
kind
: The enum value representing the RADKind.script
: the RADON script that specifies the retrieval from the source data.url
: The URL of the retrieval.body
: The body is an optional field used for the HTTP request.headers
: The headers are an optional field used for the HTTP request.
RADKind
Each RADRetrieve
object is associated with a RADKind
, represented by an enum with values ranging from 0 to 3. The possible enum values are "Unknown," "HTTP-GET," "RNG," and "HTTP-POST."
Unknown
: An unknown RAD Request type.HTTP-GET
: A HTTP GET RequestRNG
: A request to generate a secure random number.HTTP-POST
: A request to generate a secure random number.
RADTally
filters
: An array of RADFilters.reducer
: A Single RADReducer.
A RADTally has an array of of type RADFilter and a single RadonReducer.
RADFilter
Constructor Parameters:
op
: The op parameter refers to a RADONFilter OP Code, the available codes are listed below.args
:
RADAggregate
RADFilter
:RadonReducer
:
A RADAggregate
has an array of type RADFilter
and a single RadonReducer
.
RAD Filters
deviationStandard
Discards any result that is more than the provided input times the standard deviations times away from the average.
OP Code: 0x05
mode
Discards any result that is the different from the mode.
OP Code: 0x08
RAD Reducers
mode
Computes the mode of the values.
OP Code: 0x02
averageMean
Computes the average mean.
OP Code: 0x03
averageMedian
Computes the average median.
OP Code: 0x05
deviationStandard
Computes the standard deviation.
OP Code: 0x07
hashConcatenate
Computes the hash and concatenates the values.
OP Code: 0x0B
Last updated