đMulti Step FHE Request
In this example, we show how to make a multi-step request to Sight Oracle and get the response.
Explanation
makeRequest Function:
This function initiates a new multi-step request to the Sight Oracle.
A new request is created using
RequestBuilder.newRequest
, specifying the sender, the number of steps in the computation (2 steps in this example), the address to which the callback should be sent, and the callback function.The
getEuint64
function is called to load an encrypted value into the request execution context.The
add
function is used to add the loaded encrypted value (_target
) with a plaintext input.The
complete
function finalizes the request build process.The
send
function sends the request to the Sight Oracle.
callback Function:
This function is called by the Sight Oracle once the computation is complete.
It decodes the returned values using the
ResponseResolver
.The first value (
values[0]
) is the same as the current_target
, as values are immutable in the Sight Network.The second value (
values[1]
) is the new encrypted target value, which is then stored in the_target
variable.
Last updated