This is the notary server for the TLSNotary protocol.
It is primarily intended to be run inside a sandboxed AWS EC2 instance (https://github.com/tlsnotary/pagesigner-oracles). It can also be run as a regular server (you'll have to start it with --no-sandbox and pass the file public.key to the client).
- MPC circuits unpack the files
- Node 16.14
- CMake 3.16+
- GCC 9+
- Python 3
ecdsa
0.18.0 python library
-
Make sure Node.js 16 LTS is installed in the system.
-
Install
ecdsa>=0.18.0b1
Python library -
Clone this repo, then initialize submodules
git submodule update --init --recursive
-
Generate an ECDSA signing key in PEM format and save it to
signing.key
Example:
openssl ecparam -name secp256r1 -genkey -noout -out signing.key
-
Generate keys of desired size
- Copy all circuits from ProveThis to some local directory.
- Create main circuit of desired size using main_N.circom template. Replace
NUMBER_OF_AES_BLOCKS_HERE
with a number of AES blocks this circuit should be able to reveal. - Compile the circuits:
circom ./path/to/main_N.circom --r1cs --O1 --output .
. This will create amain_N.r1cs
file. - Generate a proving key (needs snarkjs CLI):
snarkjs groth16 setup main_N.r1cs ./path/to/ptau/file.ptau N.zkey
. This will create aN.zkey
proving key file. - Export a verification key (needs snarkjs CLI):
snarkjs zkey export verificationkey N.zkey N.json
. This will create aN.json
verification key file. - Place
N.zkey
andN.json
intozkey-content
directory in your working directory. - Repeat steps 2-6 for every N AES blocks you want to be able to prove, e.g. if you want to prove 1 AES block in one proof, and 4 AES blocks in another proof, you need to repeat those steps with N=1 and N=4
-
Compile:
cd src/aesmpc
, then build server according to READMEcd src/softspoken
, then build Go wrapper according to READMEcd ..
CGO_LDFLAGS="-lcrypto -lssl -ldl -lpthread -laesmpc" go build -o notary
-
Run on a local machine with:
LD_LIBRARY_PATH=$(pwd)/src/aesmpc:$(pwd)/src/softspoken/pkg ./notary --no-sandbox
Returns a list of supported ZK key pair sizes. For proving 1 AES block you need a key pair of size 1, and so on.
Example response:
{
"sizes": [1, 2]
}
Returns a ZK key pair of required size if it exists on the server. The keys must be generated beforehand.
Required query params:
size
- key pair size - Example:/zkey?size=1
Note: This endpoint uses chunked transfer limited to ~16MB/s
Example response:
{
"pk": "base64 string",
"vk": "base64 string",
"size": 1,
"error": "optional, error message"
}
If a key pair of requested size doesn't exist, the endpoint will return 404 Not Found with an error message in JSON body
Returns tag verification signing key in PEM format.
Content-Type
header will be set to application/x-pem-file
Example response:
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEvssE2tGCz8iN8Ppv9iuQPh3Wgrt7
SfwKK95seuhYF6kwXoEHRZ29uCQGVl43rJmlO8nDFH0gtqF/oaiwTLMjHA==
-----END PUBLIC KEY-----