RADON API
Last updated
Was this helpful?
Last updated
Was this helpful?
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.
Constructor Parameters:
Request Methods:
source
RADRequest
aggregator
RADRequest
tally
RADRequest
witnesses
,
min_consensus_percentage
RADRequest
collateral
RADRequest
reward
,
commit_and_reveal_fee
RADRequest
timestamp
RADRequest
timestamp
RADRequest
none
Map
addSource
The addSource
method pushes a source to the retrieve
array and sets the data point type to the last type of the source.
Method to set the tally for data aggregation.
rejects unsupported operators
sanitize malformed filters and reject unsupported filters
Method to set the quorum parameters
witnesses
: the number of witnesses
min_consensus_percentage
: the minimum consensus percentage
collateral
: the collateral amount in nanoWIT which needs to be >= 1 WIT e.g. 1000000000 nanoWIT
reward
: the witness reward
commit_and_reveal_fee
: the commit and reveal fee
timestamp
timestamp
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.
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 Request
RNG
: A request to generate a secure random number.
HTTP-POST
: A request to generate a secure random number.
0x00
Unknown
An unknown RAD Request type.
0x01
HTTP-GET
A HTTP GET Request
0x02
RNG
A request to generate a secure random number.
0x03
HTTP-POST
A request to generate a secure random number.
filters
: An array of RADFilters.
reducer
: A Single RADReducer.
A RADTally has an array of of type RADFilter and a single RadonReducer.
Constructor Parameters:
op
: The op parameter refers to a RADONFilter OP Code, the available codes are listed below.
args
:
RADFilter
:
RadonReducer
:
A RADAggregate
has an array of type RADFilter
and a single RadonReducer
.
Discards any result that is more than the provided input times the standard deviations times away from the average.
OP Code: 0x05
Discards any result that is the different from the mode.
OP Code: 0x08
Computes the mode of the values.
OP Code: 0x02
Computes the average mean.
OP Code: 0x03
Computes the average median.
OP Code: 0x05
Computes the standard deviation.
OP Code: 0x07
Computes the hash and concatenates the values.
OP Code: 0x0B
The setAggregator
method sets a aggregate field
() for data aggregation.
kind
: The enum value representing the .