Skip to content
forked from bnb-chain/bsc

A BNB Smart Chain client for fullsync node interaction

License

Notifications You must be signed in to change notification settings

bnb-chain/bsc-client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BSC Client

Background

The Greenfield Community has introduced the Block Archiver(https://github.com/bnb-chain/greenfield-bsc-archiver), BSC historical block data is now accessible on Greenfield. To fullfill the need of BSC node operators requiring full sync from the genesis block, and provide a more efficient synchronization, the Greenfield Peer is introduced.

How Greenfield Peer Works

The diagram below illustrates the functionality of the Greenfield Peer. While the Greenfield peer does not participate in other operations within the BSC network, it solely provides block data to BSC nodes. It does not persist any data on its own; instead, when it receives requests (GetBodies and GetHeaders) from other BSC nodes, it fetches a bundle of blocks (# of blocks determined by the Block Archiver Service) from Greenfield and caches them in memory. This ensures the Greenfield peer delivers block data to BSC nodes efficiently.

gnfd peer

How to Run Greenfield Peer

Build

make geth

Config the connection to Block archiver

The Greenfield Peer will integrate with Block Archiver as backend, so need to config the Block Archiver service in the config file. take the following config for testnet Block-Archiver as an example:

[Eth.BlockArchiverConfig]
RPCAddress = "https://gnfd-bsc-archiver-testnet.bnbchain.org"
SPAddress = "https://gnfd-testnet-sp2.bnbchain.org"
BucketName = "testnet-bsc-block"
BlockCacheSize = 1000000
  • RPCAddress: the RPC address of the Block Archiver service
  • SPAddress: the SP address of the bucket on Greenfield which serves the block data
  • BucketName: the bucket name on Greenfield which serves the block data
  • BlockCacheSize: the cache size of the block data, note that Greenfield Peer will cache the block data in memory

Run

./geth --config ./config.toml --datadir ./node

How to interact with Greenfield Peer as a BSC node

Configure your BSC node to connect to the Greenfield Peer by adjusting the settings in your configuration file.

Navigate to the P2P section of your BSC node configuration file and specify the enode info of the Greenfield Peer.

# other configurations are omitted
...
[Node.P2P]
MaxPeers = 1
NoDiscovery = true
TrustedNodes = []
StaticNodes = ["${enode_info}"]
...

the enode_info for BSC Testnet and Mainnet can be found in the network-info page.

About

A BNB Smart Chain client for fullsync node interaction

Resources

License

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Go 89.1%
  • C 5.2%
  • JavaScript 3.5%
  • Assembly 0.7%
  • Shell 0.3%
  • Java 0.2%
  • Other 1.0%