https://github.com/bnb-chain/opbnb-bridge-bot

https://github.com/bnb-chain/opbnb-bridge-bot

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (6.1%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: bnb-chain
  • License: mit
  • Language: Go
  • Default Branch: main
  • Size: 606 KB
Statistics
  • Stars: 4
  • Watchers: 2
  • Forks: 3
  • Open Issues: 0
  • Releases: 0
Created over 2 years ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.md

opbnb-bridge-bot

Description

The opbnb-bridge-bot project primarily maintains a Layer2 contract named L2StandardBridgeBot. This contract, when called, initiates withdrawal transactions and collects a fixed fee for every withdrawals. The project promises that after the withdrawal transaction has can be proven and finalized after the required time window, a third-party account would complete the corresponding L1 proven withdrawal transactions and L1 finalized withdrawal transactions, thus completing the entire withdrawal process.

Motivation

image

A withdrawal request must be completed in three steps:

  1. Send a L2 initiating transaction
  2. Send the L1 proven transaction after the proposer submits the next L2 output root
  3. Send L1 finalized transaction after the challenge window has passed

Completing these three steps might not be a good user experience. Firstly, users need to send 3 transactions; secondly, they need to wait 2 periods before sending the next transaction.

See also

  • opBNB testnet bridge: https://opbnb-testnet-bridge.bnbchain.org

  • withdrawal example: https://testnet.opbnbscan.com/tx/0xadb6b8d8bffb4dc7177ef1e27e202035f0861a71521c3cdff66a4aeb4464e501

Design Principle and Working Mechanism

This project consists of an on-chain contract contracts/src/L2StandardBridgeBot.sol and an off-chain bot.

The L2StandardBridgeBot contract provides a withdrawTo function, which charges a fixed fee for every execution and then forwards the call to the L2StandardBridge.withdraw.

The off-chain bot watches the L2StandardBridgeBot.WithdrawTo events and based on these events, re-constructs the corresponding withdrawals. We name these withdrawals as bot-delegated withdrawals. As time go out of the bot-delegated withdrawal's proven and finalized time window, our bot will send proven and finalized transactions to complete the entire withdrawal process.

references - contracts - L2StandardBridge.sol which concludes the withdrawTo function. - opBNB Mainnet address. - opBNB Testnet address - OptimismPortal.sol which concludes the proveWithdrawalTransaction and finalizeWithdrawalTransaction functions. - BSC Mainnet address. - BSC Testnet address - opbnb bridge - tutorial of interacting with bridge with js-sdk.

User Guide

Getting Started at opBNB testnet

  1. Prepare a MySQL database

docker-compose up -d

  1. Compile the off-chain bot and output the artifact to ./bot

make build-go

  1. Run the off-chain bot

OPBNB_BRIDGE_BOT_PRIVKEY=<bot privkey> ./bot --config ./bot.toml

Deploy and Use Contracts

  1. Compile the contract using forge

make build-solidity

  1. Deploy contract

``` cd contracts

export DELEGATEFEE=1000000000000000 forge create \ --rpc-url $OPBNBTESTNET \ --private-key $OPDEPLOYERPRIVKEY \ src/L2StandardBridgeBot.sol:L2StandardBridgeBot --constructor-args $OPDEPLOYERADDRESS $DELEGATE_FEE ```

  1. Withdraw via the deployed contract

``` export DELEGATEFEE=1000000000000000 export amount=2000000000000001 export contractaddr=

cast send --rpc-url $OPBNBTESTNET \ --private-key $OPDEPLOYERPRIVKEY \ --value $(($DELEGATEFEE + $amount)) \ $contractaddr \ $(cast calldata 'withdrawTo( address _l2Token, address _to, uint256 _amount, uint32 _minGasLimit, bytes calldata _extraData)' 0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000 $OPDEPLOYER_ADDRESS $amount 150469 "") ```

License

MIT

Owner

  • Name: bnb-chain
  • Login: bnb-chain
  • Kind: organization

For BNB Chain: BNB Smart Chain, BNB Beacon Chain

GitHub Events

Total
  • Watch event: 2
Last Year
  • Watch event: 2

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 57
  • Total Committers: 3
  • Avg Commits per committer: 19.0
  • Development Distribution Score (DDS): 0.158
Past Year
  • Commits: 2
  • Committers: 1
  • Avg Commits per committer: 2.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
bendanzhentan 4****6@q****m 48
Owen Hu 1****g 8
redhdx 1****x 1
Committer Domains (Top 20 + Academic)
qq.com: 1

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 5
  • Total pull requests: 37
  • Average time to close issues: 20 days
  • Average time to close pull requests: 7 days
  • Total issue authors: 1
  • Total pull request authors: 3
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.16
  • Merged pull requests: 35
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 5
  • Pull requests: 37
  • Average time to close issues: 20 days
  • Average time to close pull requests: 7 days
  • Issue authors: 1
  • Pull request authors: 3
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.16
  • Merged pull requests: 35
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • bendanzhentan (6)
Pull Request Authors
  • bendanzhentan (40)
  • owen-reorg (5)
  • redhdx (2)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 10
proxy.golang.org: github.com/bnb-chain/opbnb-bridge-bot
  • Versions: 10
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 6.1%
Average: 6.3%
Dependent repos count: 6.5%
Last synced: 10 months ago

Dependencies

Dockerfile docker
  • alpine 3.18 build
  • golang 1.21.1-alpine3.18 build
docker-compose.yml docker
  • postgres latest
go.mod go
  • github.com/BurntSushi/toml v1.3.2
  • github.com/DataDog/zstd v1.5.2
  • github.com/Microsoft/go-winio v0.6.1
  • github.com/VictoriaMetrics/fastcache v1.12.1
  • github.com/beorn7/perks v1.0.1
  • github.com/bits-and-blooms/bitset v1.7.0
  • github.com/btcsuite/btcd/btcec/v2 v2.2.0
  • github.com/cespare/xxhash/v2 v2.2.0
  • github.com/cockroachdb/errors v1.9.1
  • github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b
  • github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593
  • github.com/cockroachdb/redact v1.1.3
  • github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06
  • github.com/consensys/bavard v0.1.13
  • github.com/consensys/gnark-crypto v0.12.1
  • github.com/cpuguy83/go-md2man/v2 v2.0.2
  • github.com/crate-crypto/go-kzg-4844 v0.3.0
  • github.com/deckarep/golang-set/v2 v2.1.0
  • github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0
  • github.com/ethereum-optimism/optimism v1.2.0
  • github.com/ethereum/c-kzg-4844 v0.3.1
  • github.com/ethereum/go-ethereum v1.13.4
  • github.com/fsnotify/fsnotify v1.6.0
  • github.com/getsentry/sentry-go v0.18.0
  • github.com/go-ole/go-ole v1.2.6
  • github.com/go-stack/stack v1.8.1
  • github.com/gofrs/flock v0.8.1
  • github.com/gogo/protobuf v1.3.2
  • github.com/golang/protobuf v1.5.3
  • github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb
  • github.com/google/uuid v1.3.1
  • github.com/gorilla/websocket v1.5.0
  • github.com/holiman/uint256 v1.2.3
  • github.com/jackc/pgpassfile v1.0.0
  • github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a
  • github.com/jackc/pgx/v5 v5.4.3
  • github.com/jinzhu/inflection v1.0.0
  • github.com/jinzhu/now v1.1.5
  • github.com/klauspost/compress v1.16.7
  • github.com/kr/pretty v0.3.1
  • github.com/kr/text v0.2.0
  • github.com/mattn/go-runewidth v0.0.14
  • github.com/matttproud/golang_protobuf_extensions v1.0.4
  • github.com/mmcloughlin/addchain v0.4.0
  • github.com/olekukonko/tablewriter v0.0.5
  • github.com/pkg/errors v0.9.1
  • github.com/prometheus/client_golang v1.17.0
  • github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16
  • github.com/prometheus/common v0.44.0
  • github.com/prometheus/procfs v0.11.1
  • github.com/rivo/uniseg v0.4.3
  • github.com/rogpeppe/go-internal v1.10.0
  • github.com/russross/blackfriday/v2 v2.1.0
  • github.com/shirou/gopsutil v3.21.11+incompatible
  • github.com/supranational/blst v0.3.11
  • github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a
  • github.com/tklauser/go-sysconf v0.3.12
  • github.com/tklauser/numcpus v0.6.1
  • github.com/urfave/cli/v2 v2.25.7
  • github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673
  • github.com/yusufpapurcu/wmi v1.2.2
  • golang.org/x/crypto v0.14.0
  • golang.org/x/exp v0.0.0-20230905200255-921286631fa9
  • golang.org/x/mod v0.12.0
  • golang.org/x/sync v0.3.0
  • golang.org/x/sys v0.13.0
  • golang.org/x/term v0.13.0
  • golang.org/x/text v0.13.0
  • golang.org/x/tools v0.13.0
  • google.golang.org/protobuf v1.31.0
  • gorm.io/driver/postgres v1.5.4
  • gorm.io/gorm v1.25.5
  • rsc.io/tmplfunc v0.0.3
go.sum go
  • 464 dependencies