blind_transpiler.controllers package¶
The controllers package defines the protocol-level
orchestration logic for blind quantum computation (BQC).
Controllers are responsible for converting a transpiled
quantum circuit into its blind delegated counterpart using
translation rules defined in the translators layer.
The layered architecture of BlindTranspiler separates:
protocol orchestration
translation rules
intermediate blind instructions
framework-specific primitives
This modular separation improves:
reusability
maintainability
scalability to new protocols
robustness against Qiskit changes
Role of Controllers¶
Controllers operate on circuits already transpiled into compatible basis sets.
Each controller:
iterates over circuit instructions
invokes translation rules
generates
BOPobjectsconstructs
BQCInstructionoutputsmanages protocol-specific ancilla assumptions
handles client/server gate separation
The resulting BQCInstruction object defines the
complete delegated execution process.
Controller Workflow¶
Typical workflow:
Receive transpiled Qiskit circuit
Iterate over circuit gates
Translate each gate using protocol rules
Generate corresponding
BOPobjectsPackage operations into
BQCInstruction
The output can then be:
analyzed for communication overhead
converted back into executable circuits
simulated in delegated settings
Implemented Controllers¶
Orchestrator¶
The orchestrator acts as the main entry point of
the library.
Responsibilities include:
blind transpilation orchestration
key-size estimation
random key generation
basis-set transpilation
controller dispatching
Core functions include:
estimate_keysize()generate_random_key()generate_bqc()transpile_circuit()
blind_transpiler.controllers.orchestrator¶
- class blind_transpiler.controllers.orchestrator.BQC[source]¶
Bases:
BaseController- estimate_keysize(format, circ)[source]¶
Estimate the size of random key needed to perform classically assisted blind quantum computation. The size of key will be dependent on the format in which the circuit is needed to be blinded, and the circuit itself.
- Parameters:
format (str) – is a str having one of the four available format: ‘qhe’, ‘fdqc’, ‘ssdqc’, and ‘ubqc’
circ (QuantumCircuit) – the circuit that need to be blinded.
- Returns:
size of the random key needed.
- Return type:
n_keys (int)
- Raises:
ValueError(f'Instr – {instr.name} not in basis_set’)
- generate_bqc(circ, format='qhe', basis_gates=None, keys=None)[source]¶
Controller function to translate a circuit to one to the four available formats:
qhe (Quantum Homomorphic Encryption)
fdqc (UBQC using ordered set of universal gates)
ssdqc (UBQC using fixed rotation gates)
ubqc (UBQC using recursive rotation gates)
- Parameters:
circ (QuantumCircuit) – object of quantum circuit
format (str) – accepted formats are the four available format: ‘qhe’, ‘fdqc’, ‘ssdqc’, and ‘ubqc’
basis_gates (list[str]) – righnow not supported, might be helpfull later
keys (str) – string of binary random integers, need to generated using .generate_random() function of this class or need to generated size of random keys using .estimate_keysize() function
- Returns:
list of all the instruction of BOP class
- Return type:
bqc_instructions (BQCInstruction)
- Library Dependency:
random
- generate_random_key(key_size=None, format=None, circ=None, key_style='rand')[source]¶
Generate random key needed to perform classically assisted blind quantum computation. The size of key will be dependent on the format in which the circuit is needed to be blinded, and the circuit itself. Need to give either key_size pregenerated with ‘estimate_key’ function or circ and format to generate the keysize using estiamte_key and then generate key.
- Parameters:
key_size (int) – size of random key needed to blind the given circuit in given format.
format (str) – is a str having one of the four available format: ‘qhe’, ‘fdqc’, ‘ssdqc’, and ‘ubqc’
circ (QuantumCircuit) – the circuit that need to be blinded.
key_style – attain four values ‘rand’, ‘all_0’, ‘all_1’, ‘rand_fix’
- Returns:
size of the random key needed.
- Return type:
n_keys (int)
- Raises:
ValueError('Give one of the two (key_size or (circ and format)) to generate the random key') –
- Library Dependency:
random
- Future Work:
take random seed from user, as optional choice
- transpile_circuit(circ: QuantumCircuit, format: str) QuantumCircuit[source]¶
Transpiles the circuit into given basis set to be translated into blind form as written in translator library.
- Parameters:
circ (QuantumCircuit) – object of quantum circuit
basis_gates (list[str]) – rightnow, based on the default basis gates defined in init function of this class.
- Returns:
output of transpiled circuit.
- Return type:
transpiled_circ (QuantumCircuit)
- Library Dependency:
- qiskit.transpiler.preset_passmanager:
generate_preset_pass_manager
Base Controller¶
Base controller abstraction used by all protocol-specific controllers.
Defines:
common protocol interfaces
delegation assumptions
controller lifecycle methods