I've been trying to figure out how to create a simple circuit in Qiskit to create a check (cheque ) generation and verification as described in this paper.

I started with 3 qubits, first one with the bank (q0), second one with Alice (q1) and 3rd one with Bob (q2). Initially, I created a single GHZ state between the bank and Alice. Then Alice encodes a state in her qubit - right now simply applying a U3 gate, followed by a Bell measurement (not quite clear what is going on here). Finally, the SWAP test which determines whether the two states (Alice's and Bob's) are the same or not; if the states are same we get one state with a probability of 1 ideally, and if the states are different (invalid check/cheque) we get differing probabilities for 0 and 1 states.

include "qelib1.inc";

qreg q[3];
creg c[1];

x q[0];
cx q[0],q[1];
barrier q[0],q[1],q[2];

// random state
u3(pi/4,0,0) q[1];
barrier q[0],q[1],q[2];

// bell measurement
h q[1];
cx q[1],q[2];
barrier q[0],q[1],q[2];

// any change to state here will make the swap test fail
barrier q[0],q[1],q[2];

// swap test
h q[0];
cswap q[0],q[1],q[2];
h q[0];
barrier q[0],q[1],q[2];

// measure first qubit
measure q[0] -> c[0];

Is this the way it's intended to work?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.