• Stars
    star
    220
  • Rank 180,422 (Top 4 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 2 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A trustless and scaling solution for BNB Smart Chain

BNB ZkRollup

banner

The BNB ZkRollup(ZkBNB) is an infrastructure for developers that helps them to build large scale BSC-based apps with higher throughput and much lower or even zero transaction fees.

ZkBNB is built on ZK Rollup architecture. ZkBNB bundle (or "roll-up") hundreds of transactions off-chain and generates cryptographic proof. These proofs can come in the form of SNARKs (succinct non-interactive argument of knowledge) which can prove the validity of every single transaction in the Rollup Block. It means all funds are held on the BSC, while computation and storage are performed on BAS with less cost and fast speed.

ZkBNB achieves the following goals:

  • L1 security. The ZkBNB share the same security as BSC does. Thanks to zkSNARK proofs, the security is guaranteed by cryptographic. Users do not have to trust any third parties or keep monitoring the Rollup blocks in order to prevent fraud.
  • L1<>L2 Communication. BNB, and BEP20/BEP721/BEP1155 created on BSC or ZkBNB can flow freely between BSC and ZkBNB.
  • Built-in NFT marketplace. Developer can build marketplace for crypto collectibles and non-fungible tokens (NFTs) out of box on ZkBNB.
  • Fast transaction speed and faster finality.
  • Low gas fee. The gas token on the ZkBNB can be either BEP20 or BNB.
  • "Full exit" on BSC. The user can request this operation to withdraw funds if he thinks that his transactions are censored by ZkBNB.

ZkBNB starts its development based on Zecrey, special thanks to Zecrey team and Nodereal team for their contribution.

Table of Content

Framework

Framework

  • committer. Committer executes transactions and produce consecutive blocks.
  • monitor. Monitor tracks events on BSC, and translates them into transactions on ZkBNB.
  • witness. Witness re-executes the transactions within the block and generates witness materials.
  • prover. Prover generates cryptographic proof based on the witness materials.
  • sender. The sender rollups the compressed l2 blocks to L1, and submit proof to verify it.
  • api server. The api server is the access endpoints for most users, it provides rich data, including digital assets, blocks, transactions, gas fees.
  • recovery. A tool to recover the sparse merkle tree in kv-rocks based on the state world in postgresql.

Document

The ./docs directory includes a lot of useful documentation. You can find detail design and tutorial there.

Key Features

Digital Asset Management

The ZkBNB will serve as an alternative marketplace for issuing, using, paying and exchanging digital assets in a decentralized manner. ZkBNB and BSC share the same token universe for BNB, BEP2 and NFT tokens. This defines:

  • The same token can circulate on both networks, and flow between them bi-directionally via L1 <> L2 communication.
  • The total circulation of the same token should be managed across the two networks, i.e. the total effective supply of a token should be the sum of the token's total effective supply on both BSC and BC.
  • The tokens can only be initially created on BSC in BEP20, then pegged to the ZkBNB. It is permissionless to peg token onto ZkBNB.

User can 1.deposit 2.transfer 3.withdraw both non-fungible token and fungible token on ZkBNB.

Users enter the ZK-rollup by depositing tokens in the rollup's contract deployed on the BSC. The ZkBNB monitor will track deposits and submit it as a layer2 transaction, once committer verifies the transaction, users get funds on their account, they can start transacting by sending transactions to the committer for processing.

User can transfer any amount of funds to any existed accounts on ZkBNB by sending a signed transaction to the network.

Withdrawing from ZkBNB to BSC is straightforward. The user initiates the withdrawal transaction, the fund will be burned on ZkBNB. Once the transaction in the next batch been rolluped, a related amount of token will be unlocked from rollup contract to target account.

NFT Management and Marketplace

We target to provide an opensource NFT marketplace for users to browse, buy, sell or create their own NFT. The meta-data of NFT on ZkBNB sticks to the BSC standard. The ERC721 standard NFT can be seamlessly deposited on ZkBNB, or in reverse.

Marketplace framework

Above diagram shows the framework of Nft Marketplace and ZkBNB. All the buy/sell offer, meta-data of NFT/Collection, medium resources, account profiles are store in the backend of NFT marketplace, only the contendHash, ownership, creatorTreasuryRate and few other fields are recorded on ZkBNB. To encourage price discovery, anyone can place buy/sell offer in the marketplace without paying any fees since the offer is cached in the backend instead of being sent to the ZkBNB. Once the offer is matched, an AtomicMatch transaction that consist of buy and sell offer will be sent to ZkBNB to make the trade happen. Users can also cancel an offer manually by sending a cancel offer transaction to disable the backend cached offer.

Native Name Service

No more copying and pasting long addresses on ZkBNB. Every account on ZkBNB gets its short name, user can use that to store funds and receive any cryptocurrency, token, or NFT.

Seamless L1 Wallet Management

ZkBNB natively supports ECDSA signatures and follows EIP712 signing structure, which means most of the Ethereum wallets can seamless support ZkBNB. There is no extra effort for BSC users to leverage ZkBNB.

Key Tech

Sparse Merkle Tree KV Store

Unlike most rollup solution to put the state tree in memory, BAS-SMT is a versioned, snapshottable (immutable) sparse tree for persistent data. BAS-SMT is the key factor for the massive adoption of ZkBNB.

Circuit Model

ZkBNB Crypto is the library that describe the proving circuit. Once the ZK-rollup node has enough transactions, it aggregates them into a batch and compiles inputs for the proving circuit to compile into a succinct zk-proof.

Building from Source

  1. Install necessary tools before building, and this only need to executed by once.
make tools
  1. Build the binary.
make build

Dev Network Setup

We are preparing to set up the whole system using docker composer, it is coming soon..

Testnet(coming soon)

Contribution

Thank you for considering to help out with the source code! We welcome contributions from anyone on the internet, and are grateful for even the smallest of fixes!

If you'd like to contribute to bsc, please fork, fix, commit and send a pull request for the maintainers to review and merge into the main code base. If you wish to submit more complex changes though, Start by browsing new issues and BEPs. If you are looking for something interesting or if you have something in your mind, there is a chance it had been discussed.

Related Projects

Outlook

We believe that zk-Rollup Sooner or later L2 The best of the track — This is a very cheap and safe first-class L2 Expansion solutions. However, ZkBNB is application specific so far, this makes it difficult for developers to build custom dApp on that, we will introduce generic programability in the future...

More Repositories

1

bsc

A BNB Smart Chain client based on the go-ethereum fork
Go
2,712
star
2

whitepaper

BNB Smart Chain
1,805
star
3

tss-lib

Threshold Signature Scheme, for ECDSA and EDDSA
Go
787
star
4

bsc-genesis-contract

The genesis contracts of BNB Smart Chain.
Solidity
667
star
5

BEPs

BNB Evolution Proposals
Solidity
518
star
6

bsc-ecosystem

A guide to available tools, components, and platforms for developing applications on BSC.
457
star
7

opbnb

Go
404
star
8

javascript-sdk

Javascript SDK to communicate with BNB Beacon Chain.
TypeScript
349
star
9

bsc-snapshots

Shell
254
star
10

bnb-chain-tutorial

Detailed blockchain tutorials on BNB Chain.
JavaScript
244
star
11

greenfield-whitepaper

Whitepaper for Greenfield, the decentralized data economy
220
star
12

bnb-chain.github.io

The official documentation for BNB Chain.
HTML
203
star
13

go-sdk

Go
185
star
14

node-binary

Binaries for full nodes, light-weighted clients
Shell
179
star
15

java-sdk

Java
121
star
16

greenfield

Greenfield is a decentralized storage platform.
Go
118
star
17

token-bind-tool

Tools and toturial for issuing BEP2 token on BNB Beacon Chain, deploying BEP20 token on BNB Smart Chain and binding the two tokens.
Go
110
star
18

bsc-relayer

An implementation of relay service to relay cross chain packages from BNB Beacon Chain to BNB Smart Chain
Go
101
star
19

node

Go
80
star
20

eth-bsc-swap-contracts

Solidity
64
star
21

reth

BSC and opBNB client based on the Reth fork
Rust
64
star
22

op-geth

Go
60
star
23

opbnb-docs

JavaScript
58
star
24

community-contributions

55
star
25

greenfield-storage-provider

Greenfield Storage Provider is a storage infrastructure for Greenfield decentralized storage platform.
Go
51
star
26

node-deploy

Shell
51
star
27

bsc-docker

Shell
48
star
28

awesome

A curated list of awesome projects in BNB Chain ecosystem
47
star
29

bsc-explorer

BNB Smart Chain Explorer based on Blockscout fork.
Elixir
43
star
30

bsc-eth-swap

Implementation of BSC and ETH swap
Go
43
star
31

tokens-info

Centralized repo for BEP2 token meta information (logo, website, social network, etc)
42
star
32

zkbnb-contract

Solidity
42
star
33

bnc-cosmos-sdk

Go
41
star
34

canonical-upgradeable-bep20

Implement upgradeable bep20 contract
Solidity
41
star
35

peg-token-stats

38
star
36

opbnb-node-docker

Shell
35
star
37

bsc-erigon

A BNB Smart Chain client based on the erigon fork
Go
32
star
38

greenfield-contracts

Smart contracts for Greenfield and BSC Cross-Chain communication.
Solidity
27
star
39

greenfield-go-sdk

Go sdk for Greenfield
Go
27
star
40

greenfield-cmd

support cmd tool for Greenfield
Go
27
star
41

greenfield-js-sdk

JS SDK for Greenfield
TypeScript
27
star
42

oracle-relayer

Oracle Relayer is responsible for relaying events of bsc to BNB Beacon Chain.
Go
27
star
43

greenfield-cosmos-sdk

A cosmos-sdk fork for greenfield
Go
26
star
44

validator-directory

validator-directory
26
star
45

greenfield-docs

The official repository for the BNB Greenfield documentation website
JavaScript
23
star
46

bsc-relayer-config

bsc-relayer cross chain protocol configuration
21
star
47

ledger-app-binance

application that enables Ledger hardware wallet to support Binance Chain.
C
21
star
48

greenfield-cometbft

Consensus layer, forked from CometBFT, for Greenfield blockchain
Go
21
star
49

zkbnb-crypto

Go
20
star
50

cplusplus-sdk

C
18
star
51

bsc-mev-info

18
star
52

greenfield-data-marketplace-frontend

Greenfield Data marketplace is a data exchange platform where users can freely create, list, trade, and sell data assets, including digital publications, scientific experimental data, and specific domain data, or even NFT can be treated as a kind of data.
TypeScript
18
star
53

cross-chain-transfer-sample

Samples for cross chain transfer between BNB Beacon Chain and BNB Smart Chain
Java
17
star
54

token-canal-project

Project Token Canal is a new initiative, similar to many existing ‘wrapped coins’ in the crypto community, Binance.com, the largest crypto token vault and exchange, will stand to issue and bind more token assets on Binance Chain, Binance Smart Chain and Ethereum, and guarantee the conversion from and to the original tokens with our own credibility and infrastructure.
Solidity
17
star
55

zkbnb-js-sdk

TypeScript
16
star
56

zkbnb-setup

MPC Ceremony Tool for Groth16 setup of zkBNB circuits
Go
16
star
57

bnc-tendermint

Go
15
star
58

bnc-tendermint-iavl

Go
14
star
59

zkbnb-smt

Go
14
star
60

greenfield-contracts-sdk

A library of smart contracts for the Greenfield
Solidity
14
star
61

zkbnb-mpc-ceremony

13
star
62

avengerdao

13
star
63

Kickstart

13
star
64

bcfusion

This is a repo that tracks the BC Fusion progress of BEP2/BEP8 asset binding
Go
13
star
65

bsc-go-client

Go
12
star
66

tss

Threshold Signature Scheme for ECDSA
Go
12
star
67

opbnb-snapshot

TypeScript
12
star
68

bep3-deputy

Go
12
star
69

zkbnb-go-sdk

Go
12
star
70

opbnb-bridge-tokens

TypeScript
11
star
71

chain-tooling

Tools and ecosystem kits
Shell
11
star
72

wallet-assets

Assets for Binance Wallet.
11
star
73

revm

Rust
11
star
74

bsc-smart-contract-tutorials

Solidity
10
star
75

zkBNB-docs

JavaScript
10
star
76

bas-genesis-config

Solidity
10
star
77

bnc-go-amino

Go
10
star
78

bsc-double-sign-sdk

This is a complementary sdk to Binance Chain go-sdk, which can be used to submit BSC double sign proof
Go
9
star
79

zkbnb-js-l1-sdk

TypeScript
8
star
80

greenfield-challenger

Off-chain data availability challenge service for Greenfield
Go
8
star
81

juno

Go
8
star
82

bep3-smartcontracts

Smart Contracts for BEP3 implementation on different blockchains.
JavaScript
8
star
83

greenfield-cometbft-db

A cometbft-db fork for greenfield
Go
8
star
84

developer-tools-list

JavaScript
7
star
85

zkbnb-reactjs-integration-example

TypeScript
7
star
86

token-recover-approver

Go
7
star
87

greenfield-python-sdk

Python
6
star
88

bas-template-bsc

Go
6
star
89

bscSetUp

Go
6
star
90

bc-snapshots

6
star
91

bsc-mev-sentry

Go
6
star
92

greenfield-data-marketplace-contracts

Greenfield-data-marketplace is a marketplace protocol for safely and efficiently buying and selling data uploaded in Greenfield.
Solidity
6
star
93

blob-hub

Go
6
star
94

Grant-projects

BNB Smart Chain development grants program
6
star
95

zkbnb-eth-rpc

Go
5
star
96

greenfield-relayer

Greenfield and BSC bidirectional cross-chain package relaying tool
Go
5
star
97

BSC-Truffle-Starter-Box

Boilerplate code for deploying smart contracts to the BNB Smart Chain network.
JavaScript
5
star
98

greenfield-bundle-sdk

Go SDK for Greenfield bundle
Go
5
star
99

BSC-State-Expiry

4
star
100

edwards25519

edwards25519
Go
4
star