MCPcopy Index your code
hub / github.com/0xPolygon/bor

github.com/0xPolygon/bor @v2.9.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.9.0 ↗ · + Follow
25,678 symbols 144,164 edges 1,750 files 12,597 documented · 49%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Bor Overview

Bor is the official Golang implementation of the Polygon PoS blockchain. It is a fork of geth and is EVM compatible (upto London fork).

API Reference Go Report Card MIT License Discord Twitter Follow

Installing bor using packaging

The easiest way to get started with bor is to install the packages using the command below. Please take a look at the releases section to find the latest stable version of bor.

curl -L https://raw.githubusercontent.com/0xPolygon/install/main/bor.sh | bash -s -- v2.0.0 <network> <node_type>

The network accepts mainnet, or amoy and the node type accepts validator or sentry or archive. The installation script does the following things: - Create a new user named bor. - Install the bor binary at /usr/bin/bor. - Dump the suitable config file (based on the network and node type provided) at /var/lib/bor and use it as the home dir. - Create a systemd service named bor at /lib/systemd/system/bor.service which starts bor using the config file as bor user.

The releases supports both the networks i.e. Polygon Mainnet, and Amoy (Testnet) unless explicitly specified. Before the stable release for mainnet, pre-releases will be available marked with beta tag for deploying on Amoy (testnet). On sufficient testing, stable release for mainnet will be announced with a forum post.

Building from source

  • Install Go (version 1.19 or later) and a C compiler.
  • Clone the repository and build the binary using the following commands: shell make bor
  • Start bor using the ideal config files for the validator and sentry provided in the packaging folder. shell ./build/bin/bor server --config ./packaging/templates/mainnet-v1/sentry/sentry/bor/config.toml
  • To build full set of utilities, run: shell make all
  • Run unit and integration tests shell make test && make test-integration

Using the new cli

Post v0.3.0 release, bor uses a new command line interface (cli). The new-cli (located at internal/cli) has been built while keeping the flag usage similar to old-cli (located at cmd/geth) with a few notable changes. Please refer to docs section for the flag usage guide and example.

Latest Config Reference

For the latest canonical TOML config options, refer to:

Documentation

  • The official documentation for the Polygon PoS chain can be found here. It contains all the conceptual and architectural details of the chain along with an operational guide for users running the nodes.
  • New release announcements and discussions can be found on our forum page.
  • Polygon improvement proposals can be found here

Contribution guidelines

Thank you for considering helping 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 bor, please fork, fix, commit, and send a pull request for the maintainers to review and merge into the main code base.

From the outset, we defined some guidelines to ensure new contributions only ever enhance the project:

  • Quality: Code in the Polygon project should meet the style guidelines, with sufficient test-cases, descriptive commit messages, evidence that the contribution does not break any compatibility commitments or cause adverse feature interactions, and evidence of high-quality peer-review. Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Testing: Please ensure that the updated code passes all the tests locally before submitting a pull request. In order to run unit tests, run make test and to run integration tests, run make test-integration.
  • Size: The Polygon project’s culture is one of small pull-requests, regularly submitted. The larger a pull-request, the more likely it is that you will be asked to resubmit as a series of self-contained and individually reviewable smaller PRs.
  • Maintainability: If the feature will require ongoing maintenance (e.g. support for a particular brand of database), we may ask you to accept responsibility for maintaining this feature
  • Pull requests need to be based on and opened against the develop branch.
  • PR title should be prefixed with package(s) they modify.
  • E.g. "eth, rpc: make trace configs optional"

Hardware Requirements

Minimum:

  • CPU with 4+ cores
  • 8GB RAM
  • 1TB free storage space to sync the Mainnet
  • 8 MBit/sec download Internet service

Recommended:

  • Fast CPU with 8+ cores
  • 16GB+ RAM
  • High-performance SSD with at least 1TB of free space
  • 25+ MBit/sec download Internet service

License

The Bor library (i.e. all code outside of the cmd directory) is licensed under the GNU Lesser General Public License v3.0, also included in our repository in the COPYING.LESSER file.

The Bor binaries (i.e. all code inside of the cmd directory) are licensed under the GNU General Public License v3.0, also included in our repository in the COPYING file.

Join our Discord server

Join Polygon community – share your ideas or just say hi over on Polygon Community Discord or on Polygon R&D Discord.

Extension points exported contracts — how you extend this code

Subscription (Interface)
Subscription represents an event subscription where events are delivered on a data channel. [7 implementers]
interfaces.go
Encoder (Interface)
Encoder is implemented by types that require custom encoding rules or want to encode private fields. [19 implementers]
rlp/encode.go
EllipticCurve (Interface)
EllipticCurve contains curve operations. [11 implementers]
crypto/crypto.go
Stoppable (Interface)
Stoppable defines the metrics which has to be stopped. [42 implementers]
metrics/registry.go
Processor (Interface)
Processor is an interface for processing blocks using a given initial state. [11 implementers]
core/types.go
ChainContext (Interface)
ChainContext supports retrieving headers and consensus parameters from the current blockchain to be used during transact [16 …
core/evm.go
TxData (Interface)
TxData is the underlying data of a transaction. This is implemented by DynamicFeeTx, LegacyTx and AccessListTx. [6 implementers]
core/types/transaction.go
StateReader (Interface)
StateReader defines the interface for accessing accounts and storage slots associated with a specific state. StateReade [11 …
core/state/reader.go

Core symbols most depended-on inside this repo

Errorf
called by 4073
internal/utesting/utesting.go
Fatalf
called by 3813
miner/fake_miner.go
Equal
called by 2158
core/types/transaction_signing.go
New
called by 1929
log/logger.go
Hash
called by 1890
core/state/database.go
Fatal
called by 1646
internal/utesting/utesting.go
Run
called by 1250
core/vm/contracts.go
HexToHash
called by 1229
common/types.go

Shape

Method 11,530
Function 11,001
Struct 2,398
Interface 261
TypeAlias 250
Class 136
FuncType 97
Enum 5

Languages

Go89%
TypeScript7%
C++3%
C1%
Python1%

Modules by API surface

graphql/internal/graphiql/graphiql.min.js1,151 symbols
graphql/internal/graphiql/react-dom.production.min.js332 symbols
accounts/usbwallet/trezor/messages-management.pb.go228 symbols
consensus/bor/bor_test.go227 symbols
internal/cli/server/proto/server.pb.go221 symbols
eth/filters/IBackend.go186 symbols
core/blockchain_test.go169 symbols
internal/jsre/deps/web3.js159 symbols
crypto/secp256k1/libsecp256k1/src/tests.c159 symbols
internal/ethapi/api_test.go157 symbols
eth/downloader/bor_downloader_test.go148 symbols
graphql/graphql.go145 symbols

For agents

$ claude mcp add bor \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact