Deploy
After developing your circuit, you may want to deploy it. However, sharing the details of your circuit with every client might not be desirable. You might want to perform the computation in dedicated servers, as well. In this case, you can use the Client
and Server
features of Concrete.
Development of the circuit
You can develop your circuit like we've discussed in the previous chapters. Here is a simple example:
Once you have your circuit, you can save everything the server needs:
Then, send server.zip
to your computation server.
Setting up a server
You can load the server.zip
you get from the development machine:
You will need to wait for requests from clients. The first likely request is for ClientSpecs
.
Clients need ClientSpecs
to generate keys and request computation. You can serialize ClientSpecs
:
Then, you can send it to the clients requesting it.
Setting up clients
After getting the serialized ClientSpecs
from a server, you can create the client object:
Generating keys (on the client)
Once you have the Client
object, you can perform key generation:
This method generates encryption/decryption keys and evaluation keys.
The server requires evaluation keys linked to the encryption keys that you just generated. You can serialize your evaluation keys as shown:
After serialization, send the evaluation keys to the server.
Serialized evaluation keys are very big in size, so you may want to cache them on the server instead of sending them with each request.
Encrypting inputs (on the client)
Now encrypt your inputs and request the server to perform the computation. You can do it like so:
Then, send serialized args to the server.
Performing computation (on the server)
Once you have serialized evaluation keys and serialized arguments, you can deserialize them:
You can perform the computation, as well:
Then, send the serialized public result back to the client, so they can decrypt it and get the result of the computation.
Decrypting the result (on the client)
Once you have received the public result of the computation from the server, you can deserialize it:
Then, decrypt the result:
Last updated