The Verity Prover includes a mechanism to initialise warm MPC connection threads by server domain.

This feature significantly improves time to response (TTR) and time to proof (TTP).

By default, each request to the /proxy endpoint triggers the setup of a new MPC connection thread in a cold start manner. This process takes 2–3 seconds per request, depending on the geographic distance between the Prover and the source server.

With thread management, the Prover can pre-prepare these connections for expected requests to the source server domain. This enables a warm start, cutting the response time for verifiable requests by 2–3 seconds.

Note: TTR increases proportionally with the size of the request/response:

  1. For data transfers < 3 KB, TTR is 1–5 seconds.
  2. For data transfers ~25 KB, TTR increases to around 20 seconds.

Managing Thread Pools

GET http://localhost:8080/pools

###

GET http://localhost:8080/pools/example.com

###

POST http://localhost:8080/pools
Content-Type: application/json

{
  "domain": "example.com",
  "capacity": 2
}

###

DELETE http://localhost:8080/pools/example.com

###

Pool management via /pools API endpoint

To get statistics of all the pools

curl http://localhost:8080/pools

To get statistics of pool for a specific domain

curl http://localhost:8080/pools/api.coingecko.com

To create a pool for a domain

curl \
  -X POST http://localhost:8080/pools \
  -H 'content-type: application/json' \
  -d '{ "domain": "api.coingecko.com", "capacity": 2 }'

To drop an existing pool

curl \
  -X DELETE http://localhost:8080/pools/api.coingecko.com

Creating a pool via /prepare API endpoint and T-PREPARE header

curl http://localhost:8080/prepare \
  -H 'T-PROXY-URL: https://api.coingecko.com' \
  -H 'T-PREPARE: 2'

Creating a pool via /proxy API endpoint and T-PREPARE header

This works only for the very first proxy request, when there is no pool for the domain. If the pool already exists, the T-PREPARE header is ignored.

curl http://localhost:8080/proxy \
  -H 'T-PROXY-URL: https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd' \
  -H 'T-PREPARE: 2'

Proxying requests concurrently

set +m
jobs=()
for currency in "bitcoin" "ethereum" "solana"
do
  {
    curl http://localhost:8080/proxy \
      -w "\ntime: %{time_total}\n" \
      -H "T-PROXY-URL: https://api.coingecko.com/api/v3/simple/price?ids=$currency&vs_currencies=usd"
  } &
  jobs+=($!)
done
wait "${jobs[@]}"