trezor / blockbook

:blue_book: Trezor address/account balance backend
https://trezor.io
GNU Affero General Public License v3.0
666 stars 652 forks source link

Does blockbook support BSC PBSS? #1065

Closed shupkat closed 5 months ago

shupkat commented 7 months ago

The version of bsc backend in standard configs is old and does not contain many new features including PBSS. Are there plans to update the bsc config and enable support for new features in the blockbook? Because now if I independently change the versions and settings for bsc backend then my blockbook will not work.

I get this error in the blockbook error log file E0414 13:37:33.695788 37765 sync.go:377] GetBlockHash error Block not found

I'm using a snapshot from 48 club - https://github.com/48Club/bsc-snapshots?tab=readme-ov-file#geth-full-node-with-pbss

bsc.json config
{
    "coin": {
        "name": "BNB Smart Chain",
        "shortcut": "BNB",
        "label": "BNB Smart Chain",
        "alias": "bsc"
    },
    "ports": {
        "backend_rpc": 8064,
        "backend_p2p": 38364,
        "backend_http": 8164,
        "blockbook_internal": 9064,
        "blockbook_public": 9164
    },
    "ipc": {
        "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}",
        "rpc_timeout": 25
    },
    "backend": {
        "package_name": "backend-bsc",
        "package_revision": "satoshilabs-1",
        "system_user": "bsc",
        "version": "1.3.13",
        "binary_url": "https://github.com/bnb-chain/bsc/releases/download/v1.3.13/geth_linux",
        "verification_type": "sha256",
        "verification_source": "e48b613a8da2607fd4ab3f41ec320c8cf56aab975ea4362fc329208d0b90b368",
        "extract_command": "mv ${ARCHIVE} backend/geth_linux && chmod +x backend/geth_linux && echo",
        "exclude_files": [],
        "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bsc_exec.sh 2>> {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'",
        "exec_script": "bsc.sh",
        "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log",
        "postinst_script_template": "wget https://github.com/bnb-chain/bsc/releases/download/v1.3.13/mainnet.zip -O {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/mainnet.zip && unzip -o -d {{.Env.BackendInstallPath}}/{{.Coin.Alias}} {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/mainnet.zip && rm -f {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/mainnet.zip && sed -i -e '/\\[Node.LogConfig\\]/,+5d' {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/config.toml",
        "service_type": "simple",
        "service_additional_params_template": "",
        "protect_memory": true,
        "mainnet": true,
        "server_config_file": "",
        "client_config_file": "",
        "platforms": {
            "arm64": {
                "binary_url": "https://github.com/bnb-chain/bsc/releases/download/v1.3.13/geth-linux-arm64",
                "verification_source": "37e990242a2be465bfa007bf1e73d7ce95239933bc3761d7af52304df7d7364d"
            }
        }
    },
    "blockbook": {
        "package_name": "blockbook-bsc",
        "system_user": "blockbook-bsc",
        "internal_binding_template": ":{{.Ports.BlockbookInternal}}",
        "public_binding_template": ":{{.Ports.BlockbookPublic}}",
        "explorer_url": "",
        "additional_params": "-dbcache=1500000000 -workers=16",
        "block_chain": {
            "parse": true,
            "mempool_workers": 8,
            "mempool_sub_workers": 2,
            "block_addresses_to_keep": 300,
            "additional_params": {
                "mempoolTxTimeoutHours": 48,
                "queryBackendOnMempoolResync": false,
                "fiat_rates": "coingecko",
                "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH",
                "fiat_rates_params": "{\"coin\": \"binancecoin\",\"platformIdentifier\": \"binance-smart-chain\",\"platformVsCurrency\": \"bnb\",\"periodSeconds\": 900}"
            }
        }
    },
    "meta": {
        "package_maintainer": "IT",
        "package_maintainer_email": "it@satoshilabs.com"
    }
}
bsc_exec.sh
 set -e

INSTALL_DIR=/opt/coins/nodes/bsc
DATA_DIR=/opt/coins/data/bsc/backend

GETH_BIN=$INSTALL_DIR/geth_linux
CHAINDATA_DIR=$DATA_DIR/geth/chaindata

if [ ! -d "$CHAINDATA_DIR" ]; then
  $GETH_BIN init --state.scheme=path --datadir $DATA_DIR $INSTALL_DIR/genesis.json
fi

$GETH_BIN \\
  --config $INSTALL_DIR/config.toml \\
  --datadir $DATA_DIR \\
  --port 38364 \\
  --http \\
  --http.addr 127.0.0.1 \\
  --http.port 8164 \\
  --http.api eth,net,web3,debug,txpool \\
  --http.vhosts '*' \\
  --http.corsdomain '*' \\
  --ws \\
  --ws.addr 127.0.0.1 \\
  --ws.port 8064 \\
  --ws.api eth,net,web3,debug,txpool \\
  --ws.origins '*' \\
  --syncmode full \\
  --maxpeers 200 \\
  --rpc.allow-unprotected-txs \\
  --txlookuplimit 0 \\
  --cache 8000 \\
  --ipcdisable \\
  --nat none \\
  --history.transactions=0 \\
  --db.engine=pebble \\
  --state.scheme=path
 
cpuchainorg commented 5 months ago

@shupkat It is not possible, since Geth doesn't support PBSS for archive nodes yet ( They do have a plan on their roadmap, so I think it should be available soon ).

Meanwhile you may want to run erigon-bsc which offers lower disk footprint

martinboehm commented 5 months ago

As we do not operate BSC backends we do not update the configs on a periodic base. If you are interested, please update the configs to the newest version and make a PR.