Q:How those messages are sent actually since those are two different blockchains with different Consensus and state machines rules ? Who is transporting the packages/messages?
a data relayer is responsible for transporting the physical packet data, although they're not trusted for safety since all the proofs are checked on the blockchains (Edited)
Q:since anyone can encrypt and send encrypted balances, how the system preserves malicious entities be it users, or the blockchain itself just sending incorrect balances from transactions that do not exist?)
not entirely sure that I understand the question, what sequence of actions by an attacker are you concerned about here? (Edited)
Blockchain B is informed by the relayer (who copies the note commitment and light client proofs) that the transaction on Blockchain A happened (blockchain B can check the light client proofs) and now that user needs to mint in total m tokens of type **c**.(Q: where the information that user U owns those c tokens is recorded? in bridge A, bridge B or both?)
blockchain B just needs to isolate denominations of created tokens so that any tokens sent by chain A are "prefixed" under A somehow - then it can safely accept notes from A (Edited)
**Disadvantages**: Threshold assumptions might be a bit wavy: If all validators collude they can reveal all the private information which is secret shared. Can we make assumptions on that as in research papers that all parties cannot collude? Validators might collude under the table. Can we enforce/incentivize correct behavior, otherwise slashed?
preserving secrecy unless all validators collude is actually quite good in this case, but the problem is that we want to retain liveness when <1/3 validators are offline, so we probably need a 2/3 threshold (and correspondingly weaker collusion assumptions) (Edited)
Q:since anyone can encrypt and send encrypted balances, how the system preserves malicious entities be it users, or the blockchain itself just sending incorrect balances from transactions that do not exist?)
initiate cross chain transactions from thin air. User does not have the amount of coins it claims in the counter. What is encrypted/secret shared with MPC it is not validated that it is a valid. So what stops users from flooding with MPC encrypted gibberish data? (Edited)
Q:since anyone can encrypt and send encrypted balances, how the system preserves malicious entities be it users, or the blockchain itself just sending incorrect balances from transactions that do not exist?)
There are some interoperability issues between the MPC encrypted value and the validaty thereof: there should be a technical connection between valid notes of a user and the MPC encrypted value: somehow validators should validate that the underlying MPC encrypted values comes from a valid note, which is an open problem (Edited)
Here, I am unwrapping more the logic without privacy as digested from IBC relayers for my own understanding of the workflow.
Blockchain A with tokens a,b,c
Blockchain B with tokens d,e,f
User U from blockchain A with N tokens of type a wants to exhange n a's for m d's within a transaction object, .
A sends a message to B
B opens the message and sends back an ack
A burns n tokens and sends a proof(what is that proof?) that those tokens have been actually burnt. Certificate of transaction is sent.
B validates the proof and creates a voucher which authorizes the creation of m d's to bc B and are equivalent to n d's of bc A.
Q:How those messages are sent actually since those are two different blockchains with different Consensus and state machines rules ? Who is transporting the packages/messages?
A: The relayers are responisble to act as the transporters of packages messages between A and B. Those relayers are light-clients who perform validations and orchestrate the networking between A and B. They are not full nodes in the sense that they do not need to download the entire state but they can still validate/verify
A has each own light-client LC-A and B has each own LC-B All LCs constitute the relayer/bridge logic
Seems like those relayers are centralized components who hold logic for cross chain transactions.
IBC world: client, connections, channels, ports, and packets:
Chain A <––––––––––> LC-A<->LC-B<–––––––––>Chain B Client
create_client(type b on chain A and type a on chain B)
update_client
https://github.com/informalsystems/hermes-ibc-workshop/blob/main/docs/clients.md
Bridges (Functionality goal: Transfer tokens from bc A to bc B, with privacy)
Blockchain A with tokens a,b,c
Blockchain B with tokens d,e,f
User U from blockchain A with N tokens of type a wants to exhange n a's for m d's within a transaction object, . That is:
Blockchain A keeps balance sheet for total amount (total outstanding balance) of transactions that happen from A to B for all tokens of A: a,b,c. Lets call those balance sheets BSa, BSb and BSc. Those BS's are encrypted with the public key of the blockchain(Q:since anyone can encrypt and send encrypted balances, how the system preserves malicious entities be it users, or the blockchain itself just sending incorrect balances from transactions that do not exist?)
U encrypts transaction data: token type:tt ,token amount: ta with the public key of the blockchain A pkA: . The bridge module in blockchain A, updates the state of BSa with in a private way such that the BS keeps the correct encrypted amount.
U publishes note commitment to blockchain A that includes (d, amount, recipientAddress) marked as to-be-sent (cross-chain transaction) to blockchain B, and U provides a proof that amount == ta from the encrypted amount in the previous step.
Blockchain B is informed by the relayer (who copies the note commitment and light client proofs) that the transaction on Blockchain A happened (blockchain B can check the light client proofs) and now that user needs to mint in total m tokens of type c.(Q: where the information that user U owns those c tokens is recorded? in bridge A, bridge B or both?)
On the way back, if U sends token d back to blockchain A, where token d on blockchain B corresponds to token a on blockchain A, blockchain A, when it receives a new note commitment from blockchain B over the bridge which contains a tokens, will decrement the BSa encrypted counter and check that it is non-negative (thus preventing blockchain B from sending more token a back than it was originally sent by blockchain A).
Private Counters
MPC Approach:
Each user additively secret shares the value inside a transaction with validators responsible to act as watchdogs for the counter.
For , where #validators, U picks random numbers and distributes one to each validator . Finally it computes and distributes it to the last validator Observe that the sum of all shares equals the total value . There is full threshold security here: All validators need to collude to reveal .
Correctness of shares: We assume at the first version that secret shares are computed correctly (does that sound very powerful assumption? If user U secret shares gibberish data what can go wrong?Is that captured at a later stage? Can we force user to produce proofs that secret share equal the that has been part of the commitment? We need a protocol as follows: User(prover) secret shares sum to without revealing and is input to a note where a commitment has been put on the MT. )
For additive properties (accumulating the total balance) additive secret sharing over a group is fine but for comparison we need to transform additive shares to boolean (edaBits/daBits: https://eprint.iacr.org/2021/119.pdf, https://mkskeller.github.io/files/programming.pdf). The general idea is: to check whether we check whether . If subtraction result is negative it is equivalent to otherwise when the subtraction is a positive number. It suffices to check only the sign of the subtraction which can be done by extracting the MSB of and check in two complement's notation.
Having additively secret shares of two numbers in and perform:
perform subtraction and publish
run to such that is been shared with boolean shares in
run )
Plaintext example:
Assume we are in a digits register computer for simplicity and and . denotes the ith bit of starting rightmost from position , i.e: , etc. We want to compute the function:
In their bit decomposition thinking in big-endian machines(most significant bit is leftmost) we are looking to extract the the first leftmost bit where two numbers first differ. Obviously whichever's number bit is 0 at that position is less than the other one. So the task of comparing two numbers in their bit decomposition is reduced into:
finding the first position where the numbers start to differ starting from the most significant part (leftmost part)
Extract from both numbers their bit at position
if then
In bitwise arithmetics the above algorithm is translated as follows:
Compute bitwise XOR of and and store it to . That will result in a bit vector where at positions and are equal and at positions they differ.
Compute the OR of each bit of starting from the leftmost bit and store it to . ,… That results in a bit vector of 's followed with 's starting at the position where and started to differ from leftmost.
Perform component wise subtraction at vector starting leftmost as in the previous step and store it in . That will result in a bit vector with only a single at the position where and started to differ from leftmost.
Sum all individual bits of the value with . is a one bit vector so that operation extracts the bit value of in that positions where
Finally
Running example:
position
3
2
1
0
0
0
1
0
0
1
0
0
First step:
xor
3
2
1
0
0
1
1
0
Second step:
or
3
2
1
0
0
1
1
1
Third step:
subtruct d
3
2
1
0
0
1
0
0
Fourth step:
3
2
1
0
0
1
0
0
Fifth step: so output 1, meaning , which is true:
Multiplicative shares
OR and AND gates require multiplication circuit which cannot be computed separately by the existing additive shares parties hold.
E.g: Two computing parties and and two users and with two values , respectively. secret shares with and giving and to . respectively secret shares giving and to : Notice that without colluding and know nothing about the values and . and can do any computation requires addition/subtraction locally: meaning without the need of extra secret from additional parties or extra communication:
A computes and reveals it, accordingly computes and reveals it and now anyone can compute .
multiplition only from additive shares does not work: Setting :
and can be computed locally by and respectively but and not because parties hold additive shares and sharing any of the shares from A to B and vice versa is not allowed as it will reveal parties' values in cleartext.
Here is beaver trick:
Imagine an imaginary party choosing uniformly at random and such that and additively secret shares all values and with and .
A and B compute locally: and and reveal and which are perfectly hiding and .
Both compute:
Full protocol with passive security and honest users
Architecture
A lot of users: 's wishing to perform cross chain transactions from A to B blockchains.
Some validators being deployed by anoma, running anoma software: .
A smart contract controlled by the target blockchain B:
A subset of validators called MPC computing parties ('s) responsible for the bridging protocol act as MPC computing parties receiving the secret shared data inputs by the user.
A locking account on issue blockchain A acting as a vault:
Phases
Issue():
Redeem():
Asssumptions
A trusted dealer distributing correlated randomness and not communicating with CPs during online phase (when data are secret shared among CPs which also hold the correlated randomness)
Fixed set of CP's which are available at the beginning of a computation period. We assume parties are fixed within a computation period and
Description
Building Blocks
(,n): holding private data input . Run my the user U hTakes as input the integer number than needs to be protected and the number of CP's n and returns secret shares of , , such that . For , where #CP, U picks random numbers and distributes one to each CP . Finally it computes and distributes it to the last CP
(): Non interactive protocol where CP's locally add their share for and and every one publishes . Finally an aggregator add all shares and reveals .
():Beaver
(): Parties hold arithmetic secret shares of which is an -bit number, denoted as [x] in its secret shared form and they wish without revealing x to secret share each bit of with secret shares of the bit vector [a] in such that . We denote with the secret share of the th bit of held by party , ,
Input: Each holds a share of Output: Each holds a share of bit
Each CP secret shares a random bit with all other parties such that no one knows
Parties compute
CP's open
CP's bitwise compute
Analysis
Security
Efficiency
Disadvantages: Threshold assumptions might be a bit wavy: If all validators collude they can reveal all the private information which is secret shared. Can we make assumptions on that as in research papers that all parties cannot collude? Validators might collude under the table. Can we enforce/incentivize correct behavior, otherwise slashed?
Each address comes with a public and secret key computed as follows:
secret address key is chosen at random by user
public key of the adress is
also choses public secret keys for public key encryption scheme , which is key private(looking ciphertexts cannot tell the the public key under which have been encrypted):
Now somebody knowing can assign a coin of value to that address or can use as target for payments.
Create_Coin(v,)->c,cm:
To mint a token of value , U proceeds as follows:
Choose at random
Compute
Commit to () in two phases to hide public key: i. , for a hiding/binding commitment with randomness . ii.
Coin is defined as e. transaction for that minting is . Anyone can verify that contains a coin of value as long as deposited coins of value . \mathsf{cm} is added to the merklee tree with root rt.
The nested commitment preserves anonymity of the the user since its public key is not explicitely part of the transaction but still anyone can verify that this was part of a valid pk unwrapping membership proofs. Transaction is also untrackable since serial number is hidden insiden - as such when sends that coin it cannot track it.
Spend/Pour_Coin(c,):
Owner of who has minted coin wishes to spend/send it to a new address:
proceeds with rerunning Create_Coin(v,) twice for and such that creating two new coins:
and the corresponing commitments:
proves in ZK with proof the followings: 1. was part of the rt 2. 3. was created correctly in 4. was created correctly in 5. commitments for c: k, cm were correct by opening them 6. and are correct
Finally pour transaction is created as follows:
Send():
Owner of coin who has pured it running the Spend/Pour_Coin wishes to send his coin to the address defined by in a private manner without exposing the values of the coin that identify its value or old owner.
Compute ciphertext
Put it on the ledger as part of the transaction
The above works for one token type and is different from Zcash (need to digest the differences)