文章/教程 Yellowstone geyser 插件配置

InkyWang · 2024年10月08日 · 35 次阅读

更新于 2024/10/08 https://x.com/InkyWang

Geyser 插件数据流服务支持数据订阅和过滤,相比与普通的 rpc 请求可以更快速的获取链上数据。本文教你如何在自建 rpc 上安装 geyser 插件,结合之前如何运行一个 Solana RPC 节点教程,只需要下载和配置 geyser 文件和在启动参数中添加 geyser 配置文件路径。

下载 geyser

根据自己 solana-cli 的版本在官方仓库找到对应版本,此处的 solana-cli 版本为 1.8.15

wget https://github.com/rpcpool/yellowstone-grpc/releases/download/v1.15.3%2Bsolana.1.18.15/yellowstone-grpc-geyser-release-x86_64-unknown-linux-gnu.tar.bz2

apt-get install bzip2

tar -xvjf yellowstone-grpc-geyser-release-x86_64-unknown-linux-gnu.tar.bz2 

配置 geyser

vim yellowstone-config.json

{
    "libpath": "/root/yellowstone-grpc-geyser-release/lib/libyellowstone_grpc_geyser.so",
    "log": {
        "level": "info"
    },
    "grpc": {
        "address": "0.0.0.0:10001",
        "snapshot_plugin_channel_capacity": null,
        "snapshot_client_channel_capacity": "500_000_000",
        "channel_capacity": "5_000_000",
        "unary_concurrency_limit": 5000,
        "unary_disabled": false,
        "max_decoding_message_size": "16_777_216"
    },
    "prometheus": {
        "address": "0.0.0.0:8999"
    },
    "block_fail_action": "log"
}

启用 geyser

参照先前的 solana rpc 节点启动脚本,需要在脚本中添加 geyser 配置文件的位置

--geyser-plugin-config /root/yellowstone-config.json

完整的启动脚本如下

#!/bin/bash

exec solana-validator \
    --geyser-plugin-config /root/yellowstone-config.json \
    --ledger /root/sol/ledger \
    --accounts /root/sol/accounts \
    --identity /root/validator-keypair.json \
    --known-validator 7Np41oeYqPefeNQEHSv1UDhYrehxin3NStELsSKCT4K2 \
    --known-validator GdnSyH3YtwcxFvQrVVJMm1JhTS4QVX7MFsX56uJLUfiZ \
    --known-validator DE1bawNcRJB9rVm3buyMVfr8mBEoyyu73NBovf2oXJsJ \
    --known-validator CakcnaRDHka2gXyfbEd2d3xsvkJkqsLw2akB3zsN1D2S \
    --entrypoint entrypoint.mainnet-beta.solana.com:8001 \
    --entrypoint entrypoint2.mainnet-beta.solana.com:8001 \
    --entrypoint entrypoint3.mainnet-beta.solana.com:8001 \
    --entrypoint entrypoint4.mainnet-beta.solana.com:8001 \
    --entrypoint entrypoint5.mainnet-beta.solana.com:8001 \
    --expected-genesis-hash 5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d \
    --full-rpc-api \
    --no-voting \
    --private-rpc \
    --rpc-port 8899 \
    --gossip-port 8001 \
    --dynamic-port-range 8000-8020 \
    --wal-recovery-mode skip_any_corrupted_record \
    --limit-ledger-size \
    --account-index program-id \
    --account-index spl-token-mint \
    --account-index spl-token-owner \
    --enable-rpc-transaction-history \
    --enable-cpi-and-log-storage \
    --init-complete-file /root/init-completed \
    --log /root/solana-rpc.log

使用教程

https://docs.triton.one/project-yellowstone/dragons-mouth-grpc-subscriptions https://github.com/rpcpool/yellowstone-grpc/tree/master/examples

暂无回复。
需要 登录 后方可回复, 如果你还没有账号请 注册新账号