# Quantum Cheque

(02/04/2021)

This post was prepared by Bikash's Quantum for QuantumComputing.com.

A quantum cheque scheme is mainly composed of three algorithms, Gen, Sign and Verify. Gen algorithm produces a cheque book and a key for the customer, who issues a cheque. Sign algorithm creates a quantum cheque state, QC, and Verify algorithm checks the validity of a cheque. A quantum cheque has mainly three properties, Verifiability, i.e., it can be verified by a Bank's main branch or any of its acting branches, Non-repudiation, i.e, after issuing a cheque, a customer must not be able to disclaim it, and Unforgeability, i.e., a quantum cheque can not be fabricated or it can not be reused.

## The Quantum Cheque Scheme

The quantum cheque scheme can be described by considering three parties, Alice, Bob and Bank. Here, the Bank is denoted as the main branch, which can have several branches securely connected by a classical channel. In this protocol, only Alice and Bank are considered to be trusted parties, and not necessarily the branches. After a cheque is issued by Alice, Bob goes to Bank or any of its branches to withdraw money.

The following three schemes are followed for a successful quantum cheque transaction.

1. Gen Algorithm:

Initially, a shared key, kk​, is prepared by Alice and the Bank. Then Alice gives her public key, pkpk​, to the Bank and collects her Private Key, sksk​.

The Bank prepares a set of mm​ number of GHZ states,

∣ϕGHZ(i)⟩=12(∣0(i)⟩A1∣0(i)⟩A2∣0(i)⟩B+∣1(i)⟩A1∣1(i)⟩A2∣1(i)⟩B)|\phi^{(i)}_{GHZ} \rangle=\frac{1}{\sqrt{2}}(|0^{(i)}\rangle_{A_1}|0^{(i)}\rangle_{A_2}|0^{(i)}\rangle_{B}+ |1^{(i)}\rangle_{A_1}|1^{(i)}\rangle_{A_2}|1^{(i)}\rangle_{B})​​

where 1≤i≤m1 \leq i \leq m​, along with the respective unique serial number s∈{0,1}ns \in \{0,1\}^n​. From every GHZ entangled state, the Bank gives two qubits, named ∣ϕ⟩A1|\phi\rangle_{A_{1}}​ and ∣ϕ⟩A2|\phi\rangle_{A_{2}}​, and the serial number to Alice, while keeping the third qubit, ∣ϕ⟩B|\phi\rangle_{B}​, and other information, secretly in a database.

Here, ∣ϕ(i)⟩GHZi=1:m{|\phi^{(i)}\rangle_{{GHZ}_{i=1:m}}}​ stands for {∣ϕ(1)⟩GHZ,∣ϕ(2)⟩GHZ,…,∣ϕ(m)⟩GHZ}\{|\phi^{(1)}\rangle_{GHZ}, |\phi^{(2)}\rangle_{GHZ}, \ldots, |\phi^{(m)}\rangle_{GHZ} \}​.

At the end, Alice possesses (id,pk,sk,k,s,{∣ϕ(i)⟩A1,∣ϕ(i)⟩A2}i=1:m)(id, pk, sk, k, s, \{|\phi^{(i)}\rangle_{A_1}, |\phi^{(i)}\rangle_{A_2} \}_{i=1:m})​, and the Bank carries (id,pk,k,s,{∣ϕ(i)⟩B}i=1:m)(id, pk, k, s, \{|\phi^{(i)}\rangle_{B} \}_{i=1:m})​.

2. Sign Algorithm:

Alice prepares a random number by using a random number generation procedure, r←U{0,1}Lr \leftarrow U_{\{0,1\}^L}​ to sign a cheque of amount MM​ and creates a nn​-qubit state by using the following one way function,

{∣ψ⟩}alice=f(k∣∣id∣∣r∣∣M)\{|\psi\rangle\}_{alice} = f(k || id || r || M)​​

where, kk​ and idid​, are respectively the secret key and the identity of Alice. The symbol ∣∣||​' concatenates two bit strings.

Alice also prepares mm​ states {∣ψM(i)⟩}i=1:m\{|\psi_M^{(i)} \rangle \}_{i=1:m}​ corresponding to the amount M, using the one way function g:{0,1}∗×∣0⟩→∣ψ⟩g: \{0,1\}^* \times |0\rangle \rightarrow |\psi\rangle​, as {∣ψM(i)⟩}=g(r∣∣M∣∣i)\{|\psi_M^{(i)} \rangle \} = g(r || M || i)​​

Subsequently, Alice encodes ∣ψM(i)⟩|\psi_M^{(i)} \rangle​ with the entangled qubit, ∣ϕ(i)⟩A1|\phi^{(i)}\rangle_{A_1} after which she performs a Bell measurement on her first two qubits.

The state of the four-qubit entangled system can be written in the following form,

∣ϕ(i)⟩=∣ψM(i)⟩⊗∣ϕ⟩GHZ|\phi^{(i)}\rangle = |\psi_M^{(i)}\rangle \otimes |\phi\rangle_{GHZ}​​

=12{∣Ψ+⟩A1(αi∣00⟩A2B+βi∣11⟩A2B)+∣Ψ−⟩A1(αi∣00⟩A2B−βi∣11⟩A2B)+∣Φ+⟩A1(βi∣00⟩A2B+αi∣11⟩A2B)+∣Φ−⟩A1(βi∣00⟩A2B−αi∣11⟩A2B)}=\frac{1}{2} \{ |\Psi^{+}\rangle_{A_1} (\alpha_i |00\rangle_{A_2B} + \beta_i |11\rangle_{A_2B})+ |\Psi^{-}\rangle_{A_1} (\alpha_i |00\rangle_{A_2B} - \beta_i |11\rangle_{A_2B})+ |\Phi^{+}\rangle_{A_1} (\beta_i |00\rangle_{A_2B} + \alpha_i |11\rangle_{A_2B})+ |\Phi^{-}\rangle_{A_1} (\beta_i |00\rangle_{A_2B} - \alpha_i |11\rangle_{A_2B})\}​​

where ∣Ψ+⟩,∣Ψ−⟩,∣Φ+⟩|\Psi^{+}\rangle, |\Psi^{-}\rangle, |\Phi^{+}\rangle​, and ∣Φ−⟩|\Phi^{-}\rangle​ denote four Bell states.

Now, Alice applies an appropriate Pauli gate operation on her qubit ∣ϕ(i)⟩A2|\phi^{(i)}\rangle_{A_2}​, according to the Bell state measurement outcomes:

∣Ψ+⟩→I|\Psi^{+}\rangle \rightarrow I​, ∣Ψ−⟩→Z|\Psi^{-}\rangle \rightarrow Z​, ∣Φ+⟩→X|\Phi^{+}\rangle \rightarrow X​ and ∣Φ−⟩→Y|\Phi^{-}\rangle \rightarrow Y​​

It is to be noted that the encoding procedure of quantum cheque needs to be repeated mm​ times.

Alice then uses sign algorithm to sign the serial number ss​ as σ←Signsk(s)\sigma \leftarrow Sign_{sk}(s)​, and generates a quantum cheque QC=(id,s,r,σ,M,∣ϕ(i)⟩A2i=1:m,∣ψalice⟩)QC = (id, s, r, \sigma, M, {|\phi^{(i)}\rangle_{A_2}}_{i=1:m}, |\psi_{alice}\rangle)​ for Bob to encash.

Swap Test:

In the swap test, the measurement of ancilla (first qubit) on a computational basis yields zero if the two states ∣Ψ⟩|\Psi\rangle​ and ∣Ψ′⟩|\Psi^{\prime}\rangle​ are equal. In this case, swap test is said to be successful. However, if the two states are different, then the measurement of ancilla yields both ∣0⟩|0\rangle​ and ∣1⟩|1\rangle​ each associated with some probability. For ⟨Ψ∣Ψ′⟩≥λ\langle \Psi|\Psi^{\prime}\rangle \geq \lambda​, the swap test is successful with probability 1+λ22\frac{1+\lambda^2}{2}​, and unsuccessful with probability 1−λ22\frac{1-\lambda^2}{2}​. It is evident that, for the same input states, the swap test is successful with probability 1 and for different outputs, it is successful with probability less than 1. The efficiency of this test can be amplified by repeating it a large number of times.

3. Verify Algorithm:

In the verification process, Bob produces the quantum cheque QC at any of the acting branches of the Bank. The branch communicates with the Bank (main branch) to check the validity of the (id,s)(id,s)​ pair, and a verification is run by using Vrfypk(σ,s)Vrfy_{pk}(\sigma, s)​. As described below, the Bank proceeds with the verification process if it finds (id,s)(id,s)​ and σ\sigma​ to be valid, otherwise cancels the quantum cheque transaction.

The Bank then measures its qubit, ∣ϕB⟩|\phi_{B}\rangle​in Hadamard basis to get ∣+⟩|+\rangle​ or ∣−⟩|-\rangle​ as output and conveys the results to the acting branch. The branch applies the appropriate Pauli gate operation on ∣ϕ(i)⟩A2|\phi^{(i)}\rangle_{A_2}​ to retrieve the unknown state ∣ψM(i)⟩|\psi_M^{(i)}\rangle​.

A similar procedure is followed $m$ times to get mm​ unknown states {∣ψM(i)⟩}i=1:m\{|\psi_M ^{(i)}\rangle \}_{i=1:m}​. The Bank generates ∣ψalice′⟩=f(k∣∣id∣∣r∣∣M)|\psi'_{alice}\rangle = f(k || id || r || M)​, and {∣ψM,(i)⟩}i=1:m={g(r∣∣M∣∣i)}i=1:m\{|\psi_M^{,(i)} \rangle \}_{i=1:m} = \{g(r || M || i) \}_{i=1:m}​ by using these one way functions, and then performs a swap test on m+1m+1​ set of states, {∣ψalice⟩,∣ψalice′⟩}\{|\psi_{alice}\rangle, |\psi'_{alice}\rangle\}​, and {∣ψM(i)⟩,∣ψM,(i)⟩}i=1:m\{|\psi_M^{(i)} \rangle, |\psi_M^{,(i)} \rangle \}_{i=1:m}​.

The cheque is accepted if the swap test is successful, i.e., if ⟨ψalice∣ψalice′⟩≥λ1\langle \psi_{alice} \vert \psi'_{alice}\rangle \geq \lambda_1​ and {⟨ψM(i)∣ψM,(i)⟩≥λ2}i=1:m\{ \langle \psi_M^{(i)} \vert \psi_M^{,(i)}\rangle \geq \lambda_2 \}_{i=1:m}​, where λ1\lambda_1​ and λ2\lambda_2​ are constants fixed by the Bank. Else, the branch terminates the transaction.

## Quantum Circuit

# Create a Quantum Circuit with 4 quantum and 1 classical registers respectively
qc = QuantumCircuit(4, 1)

# Prepare a quantum cheque state on qubit q0
qc.u3(pi/4,0,0)

#create a GHZ state on qubits q1, q2 and q3
qc.h(1)
qc.cx(1,2)
qc.cx(1,3)

Now the quantum cheque state is encoded into four qubits q0, q1, q2, and q3.

#perform a Bell-basis measurement on qubit q0 and q1
qc.cx(0, 1)
qc.h(0)

#apply a quantum equivalent circuit for classical channel
qc.cx(1,2)
qc.cz(0,2)

After performing Bell-basis measurement, and applying conditional operations on the qubit 2, the quantum cheque state can be obtained at qubit q2. Hence, by measuring on the qubit q2, we can confirm the quantum cheque state.

# Measure qubit q2
qc.measure([2],[0])

# get a Strangeworks backend
backend = get_backend("qasm_simulator")

# execute circuit
execute(qc, backend, shots=1024)
​

## Results

After executing the circuit, we get 0 with 85% probability and 1 with 15% probability, which was the quantum cheque state initially prepared. Now the state has been teleported to the third qubit q[2]q[2]​.

The first three qubits (q0,q1,q2) are in the possession of Alice, the Bank contains the fourht qubit (q3).  Alice uses one of her entangled qubits (2nd qubit), and ∣ϕ(i)⟩A1|\phi^{(i)}\rangle_{A_1}​, provided by Bank, to encode the unknown state ∣ψM(i)⟩|\psi_M^{(i)} \rangle​. Here, this unknown state can not be generated by using the one way function, gg​, since we model only the quantum aspect and for simplicity only assume the g spits out a description of the following state, that is known to the preparation device but unknown to anybody else as,

∣ψM(i)⟩=cos(π/8)∣0⟩+sin(π/8)∣1⟩|\psi_M^{(i)}\rangle = cos(\pi/8)|0\rangle + sin(\pi/8)|1\rangle ​

It can be computed by operating U3(θ,0,0)U_3(\theta,0,0)​ on the qubit q0 initially prepared in ∣0⟩|0\rangle​ state. As this state is now split between Alice's qubit (3rd qubit) and Bank's qubit (4th qubit), measuring the 3rd qubit in computational basis, it is expected to have ∣0⟩|0\rangle​ with probability ≈0.85\approx 0.85​ and $|1\rangle$ with probability≈0.15 \approx 0.15​.

The encoding procedure should be done mm​ times by using mm​ similar quantum circuits. Now, we take two initial states ∣0⟩|0\rangle​, and ∣0⟩|0\rangle for comparison test.

"""
Quantum circuit for verifying the quantum cheque state
"""

from qiskit import QuantumCircuit, execute
from strangeworks.qiskit import get_backend

# Create a Quantum Circuit with 4 quantum and 1 classical register respectively
qc = QuantumCircuit(4, 1)

# apply Hadamard operation on q0 qubit
qc.h(0)

#apply controlled-swap operation on q0, q1 and q2 qubits
qc.cx(1,2)
qc.cx(0,2)
qc.h(1)
qc.t(0)
qc.t(1)
qc.tdg(2)
qc.cx(1,2)
qc.cx(0,1)
qc.t(2)
qc.cx(0,2)
qc.tdg(1)
qc.tdg(2)
qc.cx(0,1)
qc.cx(1,2)
qc.h(1)
qc.t(2)
qc.cx(1,2)

#apply Hadamard operation on q0 qubit
qc.h(0)

#measure q0 qubit
qc.measure([0],[0])

# get a Strangeworks backend
backend = get_backend("qasm_simulator")

# execute circuit
execute(qc, backend, shots=1024)
​`

## Results

The above code prepares the quantum circuit for quantum cheque verification, where two states are compared. In this case, both the initial states (2nd qubit and 3rd qubit) are taken as, ∣0⟩|0\rangle​. It is expected to have ∣0⟩|0\rangle​ with probability 1, after measuring the ancilla qubit (1st qubit) in computational basis. After executing the quantum circuit, ∣0⟩|0\rangle​ is resulted on the ancilla qubit with 100% probability.

## Conclusion

To conclude, we have demonstrated here an experimental procedure of quantum cheque transaction in a quantum networked environment. Quantum cheque state is prepared and then encoded with the GHZ states and then verified with the swap test. Fredkin gate (controlled-swap operation) has been constructed, by using single qubit and CNOT gates, for verification of quantum cheque.

## References

[1]Subhayan Roy Moulick, and Prasanta K. Panigrahi, Quantum cheques, Quantum Inf. Process. 15, 2475–2486 (2016), [DOI: 10.1007/s11128-016-1273-4]

[2]Bikash K. Behera, Anindita Banerjee, and Prasanta K. Panigrahi, Experimental realization of quantum cheque using a five-qubit quantum computer, Quantum Inf. Process. 16, 312 (2017), [DOI: 10.1007%2Fs11128-017-1762-0]