API Reference
WitnetRandomness contract
IWitnetRandomness interface
Functions defined within the IWitnetRandomness
interface:
Function | Description |
| Returns amount of wei required to be paid as a fee when requesting randomization with a transaction gas price as the one given. |
| Retrieves data of a randomization request that got successfully posted to the WRB within a given block. Returns zero values if no randomness request was actually posted within a given block. |
| Retrieves the randomness generated upon solving a request that was posted within a given block, if any, or to the first request posted after that block, otherwise. Should the intended request happen to be finalized with errors on the Witnet oracle network side, this function will recursively try to return randomness from the next non-faulty randomization request found in storage, if any. Fails if: (a) no |
| Tells what is the number of the next block in which a randomization request was posted after the given one. |
| Gets previous block in which a randomness request was posted before the given one. |
| Returns |
| Returns latest block in which a randomness request got sucessfully posted to the WRB. |
| Generates a pseudo-random number uniformly distributed within the range |
| Generates a pseudo-random number uniformly distributed within the range |
| Requests the Witnet oracle to generate an EVM-agnostic and trustless source of randomness. Only one randomness request per block will be actually posted to the WRB. Should there already be a posted request within current block, it will try to upgrade Witnet fee of current's block randomness request according to current gas price. In both cases, all unused funds shall be transfered back to the tx sender. |
| Increases Witnet fee related to a pending-to-be-solved randomness request, as much as it may be required in proportion to how much bigger the current |
| Returns address to the |
Clonable base contract
Public functions inherited from the Clonable
abstract pattern:
Function | Description |
| Tells whether this contract is a clone of another (i.e. |
| Deploys and returns the address of a minimal proxy clone that replicates contract behaviour while using its own EVM storage. |
| Deploys and returns the address of a minimal proxy clone that replicates contract behaviour while using its own EVM storage. This function uses the CREATE2 opcode and a |
| Returns the address of the underlying logic implementation contract. |
UsingWitnet base contract
Public function inherited from the UsingWitnet
abstract contract:
Function | Description |
| Returns the immutable address of the Witnet Request Board that interacts with the Witnet oracle's sidechain, for both posting new data requests and receiving results from it. |
WitnetRequestRandomness contract
IWitnetRequest interface
Functions defined within the IWitnetRequest
interface:
Function | Description |
| The Witnet Data Request reflecting the RADON script that will be processed by the Witnet oracle on every single price update. The returned |
| Returns the SHA256 hash of the |
WitnetRequestMalleableBase base contract
Public and restricted functions inherited from the WitnetRequestMalleableBase
abstract contract:
Function | Description |
| Sets amount of nanowits that a witness solving the request will be required to collateralize in the commitment transaction. Only callable by the |
| Specifies how much you want to pay for rewarding each of the Witnet nodes: (a) amount of nanowits that every request-solving witness will be rewarded with; (b) amount of nanowits that will be earned by Witnet miners for each each valid commit/reveal transaction they include in a block. Only callable by the |
| Sets how many Witnet nodes will be "hired" for resolving the request: (a) number of witnesses required to be involved for solving this Witnet Data Request; (b) threshold percentage for aborting resolution of a request if the witnessing nodes did not arrive to a broad consensus. Only callable by the |
| Returns bytecode of the immutable RAD (Retrieve-Attest-Delivery) script's bytecode. Encoded using Protocol Buffers. |
| Returns total amount of nanowits that witnessing nodes will need to collateralize all together. |
| Returns total amount of nanowits that will have to be paid in total for this request to be solved. |
| Returns witnessing parameters of current Witnet Data Request. |
Clonable base contract
Public functions inherited from the Clonable
abstract pattern:
Function | Description |
| Tells whether this contract is a clone of another (i.e. |
| Deploys and returns the address of a minimal proxy clone that replicates contract behaviour while using its own EVM storage. |
| Deploys and returns the address of a minimal proxy clone that replicates contract behaviour while using its own EVM storage. This function uses the CREATE2 opcode and a |
| Returns the address of the underlying logic implementation contract. |
Ownable base contract
Public function inherited from the Ownable
abstract pattern:
Function | Description |
| Tells who the current owner of this contract is. Owner may only modify the witnessing parameters of the contained Witnet Data Request, not the actual RAD (Retrieval-Attest-Deliver) script to be executed by Witnet nodes when solving the Data Request. Ownership can only be transferred by current owner. Ownership of this Data Request can only be gained by cloning the |
Last updated