# US 2019/0244290 A1 · Method and apparatus for distributed, privacy-preserving and integrity-preserving exchange, inventory and order book

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2019/0244290 A1
- Document ID: US20190244290A1
- Status: Published application
- Kind: A1
- Application number: 16/265,130
- Filed: 2019-02-01
- Published: 2019-08-08
- Earliest claimed: 2018-02-02
- Assignees: Universita' Degli Studi Di Trento
- Applicants: Universita' Degli Studi Di Trento
- Inventors: Fabio MASSACCI; Chan Nam NGO; Jing NIE; Daniele VENTURI; Julian Mark WILLIAMS
- Web page: https://patentgrep.com/patent/US20190244290A1

## CPC

- G06Q 40/04: Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
- G06F 21/64: Protecting data integrity, e.g. using checksums, certificates or signatures
- G06Q: INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method and apparatus for the distributed, privacy preserving and integrity preserving technical implementation of an order book where a group of computing devices belonging to agents (traders, brokers, or groups thereof) wishing to engage in distributed double auctions and markets can (1) keep private the information about the solvency of the individual agent owing the trader's computer; (2) publicly register the values of buy and sell orders while (a) maintaining confidential the information about the owner of the buy (resp. sell) order and (b) still having the possibility to accrue matched buy/sell transactions to the accounts of the computing devices of the individual agents owing those orders; (3) maintain the financial integrity of the market as implemented by a distributed systems of computing devices; and (4) keep private the possible exit from the market by computing devices operated by agents who could no longer meet their contractual obligations.

## Claims

### Claim 1

A computer implemented method for implementing a distributed exchange with a distributed, privacy-preserving and integrity-preserving order book among traders wishing to engage in distributed double auctions and markets, wherein each trader has his own computing device, the method comprising:
i) generating and broadcasting, by a trader's computing device of a trader wishing to post or cancel an order, a cryptographic commitment to a valid initial inventory;
ii) generating and broadcasting, by said trader's computing device, a Non Interactive Zero-Knowledge proof that said initial inventory is valid;
iii) generating, by all the other trader's computing devices, a Non Interactive Zero-Knowledge verifier configured to verify said proof;
iv) performing, by all the trader's computing devices, a Multi Party Computation (MPC) to check if there are new broke trader's computing devices;
v) if there is no new broke devices:
vi) go back to step i) for a new round, or
vii) fulfilling the order by at least one of the other trader's computing devices matching the posted order, or
viii) at the last round, generating, by all the trader's computing devices, a Non Interactive Zero-Knowledge function performing a marking to market procedure;
ix) if there is at least one broke device:
x) net out each broke device, and
xi) go to step v).

### Claim 2 (depends on 1)

Method according to claim 1, wherein the order book comprises a Private Order Book, a Public Pending Transaction Book, and a Public Trader Commitment Book, the Public Trader Commitment Book being implemented by means of a Merkle Hash Tree.

### Claim 3 (depends on 1)

Method according to claim 1, wherein information about the traders are stored into an Inventory Book comprising a Private Trader Status Book, a Private Inventory Book, for each trader Pi, a Trader Status Crypto Token linking the entries of the Private Trader Status Book and of the Private Inventory Book, a Public Trader Commitment Book and a Public Trader Commitment Book Backup.

### Claim 4 (depends on 3)

Method according to claim 3, comprising a submission protocol, “Π-put”, comprising:
a trader device using a commitment module to generate a token commitment corresponding to the current trader device inventory;
said trader device using a network module to broadcast the generated token commitment;
said trader device using a token proof generation module (F-token-gen) to generate a zero-knowledge proof to prove that the token is correctly constructed;
said trader device using the network module to broadcast the generated zero-knowledge proof;
each receiving trader device using a token proof verification module (F-token-ver) to verify the received zero-knowledge proof;
upon the verification module accepting the zero knowledge proof, the receiving trader device adding the new token as a leaf to the current Merle Tree and computing the new Merkle Tree root.

### Claim 5 (depends on 3)

Method according to claim 3, wherein the Public Trader Commitment Book is implemented by means of a Merkle Hash Tree, the method comprising a receiving protocol, “Π-get”, comprising:
the trader device broadcasts the pre-image of a leaf in the current Merkle Tree;
all other trader devices check that the pre-image has not appeared before;
the trader device uses a merkle proof generation module (F-merkle-gen) to generate and broadcast a zero-knowledge proof to prove that the said pre-image is of a leaf in the current Merkle Tree;
all other trader devices use a merkle proof verification module (F-merkle-ver) to verify the zero-knowledge proof;
the trader device uses a commitment module to generate and broadcast a commitment to a first token corresponding to the current trader device inventory;
the trader device uses an inventory proof generation module (F-inv-gen) to generate and broadcast a zero-knowledge proof to prove that the first token is correctly constructed from the said pre-image;
the trader device broadcasts the new order or the wish to cancel a pending order;
the trader device locally updates the trader device inventory with respect to the new order or the newly cancelled order;
the trader device uses the commitment module to generate and broadcast a commitment to a second token corresponding to the new trader device inventory;
the trader device uses a inventory-update proof generation module (F-invupdate-gen) to generate and broadcast a zero-knowledge proof to prove that the second token is correctly constructed from the new trader device inventory;
all other trader devices use an inventory-update verification module (F-invupdate-ver) to verify the zero knowledge proof;
all the trader devices add the new token as a leaf to the current Merle Tree and compute the new Merkle Tree root.

### Claim 6 (depends on 5)

Method according to claim 5, wherein the trader device inventory comprises binary flags, including:
a broke device flag, “f-bad”, representing the information on whether the trader owning the corresponding device is broke;
a pending orders flag, “f-cancel”, representing the status of a trader's device pending orders;
a contracts flag, “f-out”, representing the status of a trader's device holding contracts;
wherein all flags are 0 initially (f-bad=0, f-cancel=0 and f-out=0) to represent that a trader device inventory is in good standing,
and wherein
if the trader device is broke, “f-bad” is switched to 1, while “f-cancel” and “f-out” both stay at 0;
in margin settlement, “f-cancel” is switched to 1 if all pending orders of the broke trader device have been cancelled and “f-out” is switched to 1 if all holding contracts of the broke trader device have been bought or sold,
the method comprising a validation protocol, “Π-valid”, comprising:
all trader devices run the receiving protocol, “Π-get” protocol;
the trader device broadcasts the pre-image of the trader device inventory flags;
all other trader devices check:
in case of a posting/cancelling an order, if the broke device flag “f-bad”=0;
in case of cancelling all pending orders in margin settlement, if the broke device flag “f-bad”=1 and “f-cancel”=0;
in case of posting a new order to liquidate current trader device holding contracts, if the flags “f-bad”=1, “f-cancel”=1 and “f-out”=0;
if the trader device wishes to cancel a pending order:
the trader device broadcasts the commitment coupled with the to-be-cancelled order;
the trader device uses an ownership proof generation module (F-own-gen) to generate and broadcast the zero-knowledge proof to prove that it owns the pre-image of the said commitment;
all other trader devices use an ownership proof verification module (F-own-ver) to verify the zero-knowledge proof;
the trader device locally computes the new net position of the trader device inventory with respect to the new order or newly cancelled order;
the trader device uses the commitment module to generate and broadcast a commitment to the volume and price ranges used to compute the new net position corresponding to the new trader device inventory;
the trader device uses a range proof generation module (F-range-gen) to generate and broadcast a zero-knowledge proof to prove that the volume and price ranges used to compute the new net position is correctly computed from the new trader device inventory;
all other trader devices use a range proof verification module (F-range-ver) to verify the zero knowledge proof;
the trader device uses the commitment module to generate and broadcast a commitment to the new net position corresponding to the new trader device inventory;
the trader device uses a net position proof generation module (F-netpos-gen) to generate and broadcast a zero-knowledge proof to prove that the new position is correctly computed from the new trader device inventory;
all other trader devices use a net position verification module (F-netpos-ver) to verify the zero knowledge proof;
the trader device uses the commitment module to generate and broadcast a commitment to the new flags corresponding to the new trader device inventory and new position;
the trader device uses a flag proof generation module (F-flags-gen) to generate and broadcast a zero-knowledge proof to prove that the new flags is correctly computed from the new trader device inventory and new position;
all other trader devices use a flag verification module (F-flags-ver) to verify the zero knowledge proof;
the trader device uses a margin proof generation module (F-nonneg-gen) to generate and broadcast a zero-knowledge proof to prove that the new net position is above the margin requirement;
all other trader devices use a margin verification module (F-nonneg-ver) to verify the zero knowledge proof;
all trader devices run the submission protocol, “Π-put”.

### Claim 7 (depends on 5)

Method according to claim 5, comprising a matching protocol, “Π-match”, comprising:
all trader devices run the receiving protocol, “Π-get” for the first trader device;
all trader devices run the submission protocol, “Π-put”, for the first trader device;
the steps above are repeated for the second trader device.

### Claim 8 (depends on 1)

Method according to claim 1, comprising a check protocol, “F-check”, comprising:
each trader device uses the MPC module to generate the input encoding of the private parameters, said private parameters including its own net position in the current round, and the private random numbers from a random generator module;
each trader device broadcasts the input encoding so computed to the other trader devices using the network module;
each receiving trader device uses the MPC module to compute an encoded output based on the public input and the received encoded inputs;
each receiving trader device uses the network module to send the encoded output to the network module of other trader devices;
each trader device receiving the encoded output uses the MPC module to:
check whether all other traders devices' respective private input, i.e. net position in the current round, correspond to the public input commitments of net position in the current round, and return 0 if at least one check fails;
compare the net position of all trader devices with 0 and return 0 if any net position is less than 0;
return 1 if no value has been already returned.

### Claim 9 (depends on 8)

Method according to claim 8, comprising a backup protocol, “Π-backup”, comprising:
repeating, for all trader devices:
all trader devices run the receiving protocol, “Π-get”;
all trader devices run the submission protocol, “Π-put”;
all trader devices run the check function, “F-check”;
if the check function, “F-check” is successful, all trader devices run the submission protocol, “Π-put”.

### Claim 10

Method according to the previous claim, wherein the comparing function, “F-compare”, comprises:
each trader device uses the MPC module to generate the input encoding of private parameters including its own old inventory flags in the previous round, its own new inventory flags in the current round, and the private random numbers from the random generator module;
each trader device broadcasts the input encoding so computed to the other trader devices using the network module;
each receiving trader device uses the MPC module to compute an encoded output based on the public input and the received encoded inputs;
each receiving trader device uses the network module to send the encoded output to the network module of other trader devices;
each receiving trader device uses the MPC module to:
check whether all other traders devices' respective private old inventory flags in the previous round, new inventory flags in the current round, correspond the public input commitments of old inventory flags in the previous round and new inventory flags in the current round, and return 0 if at least one check fails;
compute the sum across all trader devices of all mentioned private new flags and the sum across all trader devices of all mentioned private old flags and returning 0 if the two sums are different;
return 1 if no value has been already returned.

### Claim 11 (depends on 6)

Method according to claim 6, comprising an optimized comparing function, comprising:
each trader device uses the MPC module to generate the input encoding of the private parameters including its own old inventory flags in the previous round, its own new inventory flags in the current round, and the private random numbers from the random generator module, where necessary;
each trader device broadcasts the input encoding so computed to the other trader devices using the network module;
each receiving trader device uses the MPC module to compute an encoded output based on the public input and the received encoded inputs;
each receiving trader device uses the network module to send the encoded output to the network module of other trader devices;
each receiving trader device uses the MPC module to compute the sum across all trader devices of all mentioned private new flags and the sum across all trader devices of all mentioned private old flags and return 1 if the two sums are equal;
if the sums are equal,
each trader device uses a status proof generation module (F-equal-gen) to prove in zero-knowledge that the status unchanged;
each other trader device use a status verification module (F-equal-ver) to verify the zero knowledge proof;
otherwise return 0 and,
each trader device uses the MPC module to compute a random trader device that changes status;
the random trader device uses the proof generation module (F-nequal-gen) to prove in zero-knowledge the status changes;
each other trader device use the verification module (F-nequal-ver) to verify the zero knowledge proof.

### Claim 12 (depends on 6)

Method according to claim 6, wherein:
the three binary flags (f-bad, f-cancel and f-out) are replaced by a single integer; and/or
the merkle proof generation module and verification module and the inventory update proof generation module and verification module are combined into optimized proof generation module (F-minv-gen) and verification module (F-minv-ver), so that the receiving protocol, “Π-get”, is replaced by an optimized receiving protocol, “Π-get-opt”, in which:
the trader device broadcasts the pre-image of a leaf in the current Merkle Tree;
all other trader devices check that the pre-image has not appeared before;
the trader device broadcasts the new order or the wish to cancel a pending order;
the trader device uses the commitment module to generate and broadcast a commitment to the token corresponding to the current trader device inventory updated with respect to the new order or the newly cancelled order;
the trader device uses the optimized proof generation module (F-minv-gen) to generate and broadcast a zero-knowledge proof to prove that the first token is correctly constructed from the said pre-image and updated with respect to the new order or the newly cancelled order;
all other trader devices use the optimized verification module (F-minv-ver) to verify the zero knowledge proof;
and/or
the range proof generation and verification modules and the net position proof generation and verification modules are combined into optimized net position proof generation module (F-rnetpos-gen) and optimized position verification modules (F-rnetpos-ver), so that:
the trader device uses the commitment module to generate and broadcast a commitment to the new position corresponding to the new trader device inventory;
the trader device uses the proof generation module (F-rnetpos-gen) to generate and broadcast a zero-knowledge proof to prove that the new net position is correctly computed from the new trader device inventory;
all other trader devices use the verification module (F-rnetpos-ver) to verify the zero knowledge proof;
and/or
parallelization of the proof generation module, in which all the proof generation modules (F-merkle-gen, F-inv-gen, F-invupdate-gen, F-own-gen, F-range-gen, F-netpos-gen, F-flags-gen, F-nonneg-gen, F-equal-gen, F-nequal-gen, F-minv-gen, F-rnetpos-gen, F-neg-gen) are executed in parallel.

### Claim 13 (depends on 9)

Method, according to claim 9, comprising an optimized check function comprising:
each trader device uses the MPC module to generate the input encoding of private parameters including its own net position in the current round, and the private random numbers from a random generator module, where necessary;
each trader device broadcasts the input encoding so computed to the other trader devices using the network module;
each receiving trader device uses the MPC module to compute an encoded output based on the public input and the received encoded inputs;
each receiving trader device uses the network module to send the encoded output to the network module of other trader devices;
each receiving trader device uses the MPC module to compare the net position of all trader devices with 0 and returns 1 if no net position is less than 0, and
each trader device uses the proof generation module F-nonneg-gen to prove in zero-knowledge the status unchanged;
each of the other trader devices uses the verification module F-nonneg-ver to verify the zero knowledge proof;
each trader device returns 1 if no value has been already returned;
otherwise each trader device uses the MPC module to compute a random trader device that has negative net position;
the random trader device uses the proof generation module, “F-neg-gen”, to prove in zero-knowledge the negative position;
all other trader devices use the verification module, “F-neg-ver”, to verify the zero knowledge proof.

### Claim 14 (depends on 1)

Method according to claim 1, wherein the cryptographic commitment includes an arithmetic/boolean formula for determining whether the trader outstanding position is still acceptable for the other traders, based on the memoized variable of previous positions and the value of current positions.

### Claim 15

Distributed apparatus for implementing a distributed exchange with a distributed, privacy-preserving and integrity-preserving order book among traders wishing to engage in distributed double auctions and markets, comprising hardware and software means configured to implement the method according to any of the previous claims.

### Claim 16 (depends on 1, 15)

Distributed apparatus according to claim 15, wherein said software and hardware means comprise:
a distributed order book, wherein confidential information about a trader's position (margin, posted orders, etc.) is stored privately at a trader's own computing device, the distributed order book comprising a ledger accessible to all trader's devices or individually by each of the traders, a commitment of the above information being stored publicly in said ledger;
a network module in each trader's computing device to send a certified piece of data representing a non-interactive proof;
a processing module coupled to the network module in the trader's device, said processing module being configured to execute the method of claim 1;
a storage module coupled with the processing module to store private confidential information about the ledger, such as the cash available in the trader account, the volume of holding contracts, the pending orders and other information where necessary;
a random generator module to generate cryptographically strong random numbers;
an encryption and proof generation module that use the random generator module to generate the certified piece of data representing a non-interactive zero-knowledge (NZK) proof;
a commitment module that uses the random generator module to augment the piece of data so that the resulting generation of the module is a piece of data representing the commitment to trader's private information while being disassociated from the actual content of the piece of data to be used in the non-interactive proof;
a verifier module to check the received piece of data corresponding to the non-interactive proof from other trader devices;
an MPC module that uses the random generator module to privately compute a global function's output with other trader's devices regarding the trader device's secret input;
wherein the network module is adapted to broadcast the non interactive proof of a piece of data to the other network modules,
wherein the network module is adapted to broadcast anonymously an order and the non-interactive proof of a piece of data to the other network modules;
wherein the processing module has access to a possibly different storage module either directly or indirectly through the network module to retrieve or store information about the public part of the distributed order book.
