Compute
Blind computation requires three elements:
- Storing of a Program (via self or by someone else)
- Invoking the program with your parameters
- Retrieving the computed results
Note: in order to use these functions, you (as the developer) should have created Nada programs to interact with. See this guide if you have not done this process.
useNilStoreProgram
To store a program, you would have computed a XXX.nada.bin
file after you built a successful nada program. You will need to upload this file via the FileReader to upload the program. The mutation.execute({ name, program })
part should automatically take in your program + name.
loading...
useNilInvokeCompute
To invoke a program, you pass in the programId
of the program you have uploaded with considerations of the inputs you want to provide in your options
. computeTimeValues
with respect to name
and value
are what you want to adjust.
const options = {
programId,
inputBindings: [{ party: "Party1", user: client.id }],
outputBindings: [{ party: "Party1", users: [client.id] }],
valueIds: [],
computeTimeValues: [
{
name: "A",
value: NadaValue.new_secret_integer("10"),
},
{
name: "B",
value: NadaValue.new_secret_integer("4"),
},
],
};
loading...
useNilRetrieveComputeResults
To retrive, you simply pass in the id
from the previous invocation.
loading...