## 5 System Construction
### System Setup  
Security parameter \(\lambda\) and Circuit C are the input parameters for calculating structured reference string (srs) that consists of key pairs (Pk,Vk) such that Pk is the proving key use and Vk is the verification key. Pk is used to generate zk-proof (\(\pi\)) and Vk is used to verify the zk-proof. The master public key \(\left( \begin{matrix}F&P\\ K_{CA}\end{matrix} \right)\) and master private key \(\left(\begin{matrix}K_{CA}  
Proof is generated using Algorithm 2. ```
Input: Leaf index of identity commitment (\(\mathrm{l_{id}}\)), corresponding Path (p), hash function (h), Salt function (S), Public Key of Vehicle (PK\({}_{v}\)), Root of Merkle tree (rt), Nonce (nu), Structured Reference String (srs) Output: Witness w, Argument x, Proof \(\pi\) CA sends [\(\mathrm{l_{id}}\),p, h (S (PK\({}_{v}\)))] to Vehicle v \(\mathrm{v}\rightarrow\)[\(\mathrm{l_{id}}\),p, h (S(PK\({}_{v}\)))] = w CA send rt and nut to Vehicles \(\mathrm{v}\rightarrow\)(rt, nut) = x \(\mathrm{v}\rightarrow\)(srs, x,w) = \(\pi\) Vehicle v sends Vid and \(\pi\) to CA for verification end end
```  
**Algorithm 2**Prove ( ) zk-SNAKR Protocol  
The proof is constructed using the latest value of 'nu,' which is updated in a timely way by the blockchain network and hence cannot be forged or reused by any adversary. Vehicle v sends (ID\({}_{v}\), \(\pi\)) to CA; using Equation (2), CA computes x and performs verification as follows:  
\[\mathrm{Verify\ (srs,\ x,\pi)=1} \tag{4}\]  
Verification process is performed in Algorithm 3. ```
Input: Root of Merkle tree (rt), Nonce (nu), Structured Reference String (srs) Output: Argument x, Integer b CA \(\rightarrow\)(rt, nu) = x CA verifies the proof using srs, x and \(\pi\) if b = = 1 then  return True else  return False end
```  
**Algorithm 3**Verify ( ) zk-SNAKR Protocol  
```
Input: Root of Merkle tree (rt), Leaf index of identity commitment (\(\mathrm{l_{id}}\)), corresponding Path Map (p), Identity of Vehicle (ID\({}_{v}\)), Hash function (h), Salt function (S), commitment (cmt), Vehicle V = {a\({}_{1}\), a\({}_{2}\),a\({}_{3}\),..., a\({}_{\mathrm{l}}\)} Output: Public Key of vehicle (PK\({}_{v}\)) and Private Key of Vehicle (SK\({}_{v}\)), Merkle tree node (MT\({}_{\mathrm{node}}\)), Root value (rt) Vehicle v sends its Vid to CA CA CA \(\rightarrow\)(Vid, \(\mathbf{C^{s}_{CA}}\)) = (PK\({}_{v}\),SK\({}_{v}\)) \(\mathrm{MT}_{\mathrm{node}}\) consists of cmt(h(S(PK\({}_{v}\)),Vid) \(\mathrm{MT}_{\mathrm{node}}\) consists of cmt(h(S(PK\({}_{v}\)),Vid) \(\mathrm{MT}_{\mathrm{node}}\) consists of cmt(h, a\({}_{2}\), a\({}_{3}\),..., a\({}_{\mathrm{l}}\),..., a\({}_{\mathrm{l}}\)) \(\mathrm{MT}_{\mathrm{r}}\) = MT (\(\mathbf{a}_{\mathrm{l}/2}\) + 1, a\({}_{\mathrm{l}}\) + 2,..., a\({}_{\mathrm{l}}\)) \(\mathrm{h(rt)}\) = h(MT\({}_{\mathrm{l}}\) \(\mathrm{l}\) \(\mathrm{l}\) \(\mathrm{l}\) \(\mathrm{l}\) \(\mathrm{MT}_{\mathrm{r}}\))  Update rt Return (rt, p and \(\mathrm{l_{id}}\)) to Vehicle v End
```  
**Algorithm 4**Vehicle Registration and Merkle tree Creation  
``` Input: Root of Merkle tree (rt), Leaf index of identity commitment (\(\mathrm{l_{id}}\)), corresponding Path Map (p), Identity of Vehicle (ID\({}_{v}\)), Hash function (h), Salt function (S), commitment (cmt), Vehicle V = {a\({}_{1}\), a\({}_{2}\),a\({}_{3}\),..., a\({}_{\mathrm{l}}\)} Output: Public Key of vehicle (PK\({}_{v}\)) and Private Key of Vehicle (SK\({}_{v}\)), Merkle tree node (MT\({}_{\mathrm{node}}\)), Root value (



### Communication

Once a vehicle is authenticated on a blockchain network, it can start communicating with other vehicles. V\({}_{\text{i}}\) computes its signature first and sends the signature as token of the initiating communication to vehicle j as follows:

\[\sigma_{\text{i}}=(\pi\mid\mid\text{SK}_{\text{i}}\mid\mid\text{T})^{\text{PKi}} \tag{5}\]

T' denotes the timestamp in order to justify if the message is new or old message and is being circulated by the vehicle.