Cointime

Download App
iOS & Android

How zk-SNARKs Improve Binance’s Proof of Reserves System

Validated Venture

Main Takeaways

  • In November 2022, Binance released its Proof of Reserves system utilizing Merkle tree cryptography to allow users to verify their holdings.
  • Binance has now improved its solution by implementing zk-SNARKs, a form of zero-knowledge proof.
  • Users can now check that each account’s total net balance is non-negative and that all user assets are part of Binance’s claimed total net balance of user assets – in a private and secure manner.

Take a look under the hood of Binance’s new proof-of-reserves solution. Combining zk-SNARKs and Merkle tree information, it gives users a new and improved way of verifying the state of Binance’s reserves.

Over the last few months, Binance’s dev team has been hard at work building advanced proof-of-solvency solutions. Such tools have become critical for centralized crypto exchanges amid the crisis of trust that engulfed the industry in the wake of the FTX collapse. User funds stored on Binance are backed at a 1:1 ratio, plus reserves, and finding a way to prove this to the public seamlessly has become a major part of Binance’s plan to restore industry trust. 

In November 2022, we released our proof-of-reserves system utilizing a Merkle tree cryptographic technique to allow users to verify their holdings on Binance. Although an advancement in Binance’s user fund transparency push, the initial design of this solution had two shortcomings:

  • To protect user privacy, leaf nodes in Merkle proof represented the hash of users’ holdings – thus, the Merkle root couldn’t reflect the sum of its leaf nodes’ balance information.
  • The entity whose reserves were being verified could potentially add a negative balance under a fake account somewhere in the tree to make the total required reserves appear smaller. The following diagram from Vitalik Buterin’s blog shows an example of such a malicious Merkle tree (although, in this case, the root reflects the sum of all leaf nodes’ balances, which can introduce privacy issues).

We now have a solution that can remedy these shortcomings and thus strengthen Binance’s proof-of-reserves system. Relying on zero-knowledge proof protocols, zk-SNARKs, we can prove that:

  1. All leaf nodes of the Merkle tree have contributed to Binance’s claimed total user balance of each asset.
  2. There is no user with a negative total net balance (an overall USD value of all assets the user holds) included in the Merkle tree.

A Word on Negative Balances and Performance

Since Binance offers margin, crypto loans, and futures trading products, each user’s balance of each crypto asset may be comprised of assets and liabilities. A user’s balance of a particular crypto asset can be negative, but their total net balance across all crypto assets should not be negative (as all loans are fully collateralized).

In this hypothetical scenario, let’s say that Alice had deposited 10,000 BUSD to Binance, then used 4,000 BUSD as collateral to borrow 2 BNB (at a rate of 1 BNB = 1,000 BUSD, assuming that Binance is always over-collateralizing). The following table shows Alice’s balance sheet.

If Alice then trades 1 BNB for 1,000 BUSD with Bob (who had also deposited 10,000 BUSD), their balance sheet would look like this after the trade is matched:

In this case, Alice’s BNB balance will amount to -1, which is not a valid node in a Merkle tree and that only covers one asset: BNB. However, if we are looking at total net balances, Alice is still at 10,000.

Another challenge comes from the sheer scale of Binance’s user base. A viable solution has to generate user proof and zk-SNARK proof for tens of millions of users, some of whom may hold more than 300 crypto assets on our platform. 

All in all, we want to provide proof of the following facts within a reasonable time window:

  1. Each Binance user’s assets are part of our claimed total user balance shown in the snapshot. Users can verify our claimed total user balance against the assets held at Binance-controlled addresses using a blockchain explorer (like Etherscan for Ethereum wallets or BscScan for BNB Chain wallets).
  2. Each user’s total net balance is non-negative, which means Binance didn’t create dummy accounts with a negative balance to reduce the size of our verified reserves artificially.

What Are zk-SNARKs?

Before we dive into the details of our solution, a brief overview of the zero-knowledge proof mechanism is in order. Zero-knowledge protocols like zk-SNARK allow one party, the prover, to demonstrate to another party, the verifier, that the prover had executed certain computations accurately with certain inputs under certain constraints, all without disclosing the inputs. The computation might be time-consuming, but the underlying mathematical mechanism can help the verifier assess the proof quickly and securely.

The prover (Binance) starts with defining a set of constraints of the computation it wants to prove. The constraints are defined in circuits that can be expressed in a higher-level programming language (in our case, a forked version of gnark.)

The prover then executes the heavy computation, hashing all users’ ids and balance sheets, and generates proof of the computation meeting the constraints set out previously. To do so, it uses the computation trace (witness) and public or private inputs. 

The verifier (user) gets the proof and verifies it with the public input of the circuit to satisfy itself that the computation has been executed accurately with all constraints met. The verification computation takes an extremely short time compared to the proving time. If the prover does not generate the proof on the pre-defined circuits, it cannot produce valid proof to pass the verification.

Our Solution

The fundamental building block of the upgraded proof-of-reserves solution is still a Merkle tree. For the example above, it would look like this:

In addition to the Merkle tree, we also maintain a global state that represents a list of the total net balances of each asset that each Binance customer holds.

To prove our reserves, we will generate zk-SNARK proof for the construction of the Merkle tree. For each user’s balance set – a leaf node of the Merkle tree – our circuit would make sure that:

  1. Every asset’s balance of this user is included in the global state list mentioned above.
  2. The user’s total net balance is not negative. 
  3. The change of the Merkle tree root is valid after updating this user’s information to the leaf node hash.

Please refer to this technical specification and our source code for the circuit (constraints) for implementation detail.

In each instance of proving our reserves, we will publish:

1. The Merkle proof: the hashes for each user (for Alice, represented by blue nodes in the above picture).

2. zk-SNARK proofs and public input (a hash of the list of total net balances of each asset and the Merkle root) of the circuit for all users.

By verifying the Merkle proof, users can make sure their balance sheet is included in the Merkle tree root. By verifying the zk-SNARK proof, users can make sure the construction of the Merkle tree meets the constraints defined in the circuit.

The security of this solution relies heavily on the setup of the proving key and verification key. We are working on a decentralized setup of the keys. When it comes to existing decentralized trusted setup ceremonies, the Ethereum ceremony offers a good example. We are very close to having an MPC solution to make the setup trustless.

Performance

Given the number of Binance users whose balances should be included, there’s no way to get a single proof of the Merkle tree construction that would cover all users at once. A solution to this is splitting users into batches of 864 each so as to have a smaller-scale circuit and parallel proving procedures.

For a batch that contains 864 users where each user owns 350 different assets, suppose each asset balance is in the range [0, 2^64-1]. With a 32-core 128GB server, zk proof generation time is about 110 seconds, and proof verification time is less than 1 millisecond.

Binance will start 1000 provers at the same time so as to generate proof for all accounts in 2 hours. The cost of this prover server for one hour is about 0.56 USD, so the total cost of generating all zk proofs covering all users would be about 1000 USD.

Conclusion

We will provide the first iteration of proof for users generated by this new solution in a subsequent proof-of-reserves announcement. Also, we have open-sourced our user data processor, prover, circuit, and verifier, so that every centralized exchange relying on the same model as we do can generate proof for their users and assets easily.

We hope this will be instrumental in pushing the transparency of the digital asset industry to a new level. We are also working on implementing the solution mentioned in Vitalik’s blog to achieve better performance, which will allow us to provide the proof more frequently at a lower cost.

As this is the first version of our zk-SNARK, we are looking forward to receiving community feedback so we can continue to improve the system.

Read more: https://www.binance.com/en/blog/ecosystem/how-zksnarks-improve-binances-proof-of-reserves-system-6654580406550811626

Comments

All Comments

Recommended for you

  • Uniswap’s market share in DEX has dropped to 36%

    The DEX landscape is undergoing changes, with the market share of the veteran decentralized exchange Uniswap dropping from over 50% in October 2023 to the current 36%.

  • Exowatt completes $20 million financing, a16z participates in the investment

    Startup company Exowatt announced that it is addressing the energy needs of data centers through its ceramic battery technology. The company claims that its technology can store solar energy for months, helping to cope with the rapid growth of power consumption in data centers. The company has received $20 million in seed funding, with investors including a16z and Altman. According to reports, Exowatt has accumulated 1.2 gigawatts of orders, mainly focused on data centers and cryptocurrency mining projects in the United States.

  • Singapore police investigate Worldcoin account transactions, arrest five people

    On September 10th, Singapore's Deputy Prime Minister Heng Swee Keat announced that Singaporean police are investigating seven individuals suspected of providing Worldcoin account and token trading services. This investigation involves possible violations of the Payment Services Act of 2019, and the police have arrested five people.

  • Putin: Russia "supports" Harris, calls her smile "contagious"

    According to foreign media such as TASS and Russia's Sputnik News, Jinse Finance reported that on the afternoon of September 5th local time, Russian President Putin said at the plenary session of the Eastern Economic Forum 2024 that Russia will "support" the US Democratic Party presidential candidate and vice president Harris as recommended by the US President Biden in the upcoming US presidential election. When asked how he viewed the 2024 US election, Putin said it was the choice of the American people. The new US president will be elected by the American people, and Russia will respect the choice of the American people. Putin also said that just as Biden suggested his supporters to support Harris, "we will do the same, we will support her." The report said that Putin also joked that Harris' laughter is "expressive and infectious," which shows that "she is doing everything well." He added that this may mean that she will avoid further sanctions against Russia.

  • An ETH whale repurchased 5,153 ETH with 12.23 million USDT 20 minutes ago

    A certain high-frequency trading ETH whale monitored by on-chain analyst Yu Jin bought 5,153 ETH with 12.23 million USDT 20 minutes ago.

  • CFTC: Uniswap Labs has actively cooperated with the investigation and only needs to pay a fine of US$175,000

    The CFTC has filed a lawsuit against Uniswap Labs and reached a settlement. It was found that Uniswap Labs illegally provided leveraged or margined retail commodity transactions of digital assets through a decentralized digital asset trading protocol. Uniswap Labs was required to pay a civil penalty of $175,000 and cease violations of the Commodity Exchange Act (CEA). The CFTC acknowledged that Uniswap Labs actively cooperated with law enforcement agencies in the investigation and reduced the civil penalty.

  • Federal Reserve Beige Book: Respondents generally expect economic activity to remain stable or improve

    The Federal Reserve's Beige Book pointed out that economic activity in three regions has slightly increased, while the number of regions reporting flat or declining economic activity has increased from five in the previous quarter to nine in this quarter. Overall employment levels remain stable, although some reports indicate that companies are only filling necessary positions, reducing working hours and shifts, or reducing overall employment levels through natural attrition. However, reports of layoffs are still rare. Generally speaking, wage growth is moderate, and the growth rate of labor input costs and sales prices ranges from slight to moderate. Consumer spending has declined in most regions, while in the previous reporting period, consumer spending remained stable overall.

  • Puffpaw Completes $6 Million Seed Round with Lemniscap Ventures as Participant

    Puffpaw has announced the completion of a $6 million seed round of financing, with participation from Lemniscap Ventures. The Puffpaw project plans to launch a blockchain-enabled electronic cigarette aimed at helping users reduce nicotine intake through token incentives. The project encourages users to quit smoking by recording their smoking habits and rewarding them with tokens. Puffpaw's token economics aims to cover 30% of the cost of users' first month of using their product and provide social rewards. The project also considers possible system abuse, but the issue of users potentially reporting smoking habits dishonestly is not yet clear.

  • Cointime July 7th News Express

    1, Ethereum L2 TVL rebounds slightly to above $39 billion

  • Binance: Bitcoin miners record longest streak of net selling since 2017

    Binance released its market insights for July, including: