配置Yellowstone gRPC插件

更新于2024/12/15

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

下载Yellowstone gRPC插件

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

wget https://github.com/rpcpool/yellowstone-grpc/releases/download/v3.0.0%2Bsolana.2.0.18/yellowstone-grpc-geyser-release22-x86_64-unknown-linux-gnu.tar.bz2

apt-get install bzip2

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

配置

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",
        "max_decoding_message_size": "8_388_608",
        "snapshot_plugin_channel_capacity": null,
        "snapshot_client_channel_capacity": "50_000_000",
        "channel_capacity": "200_000",
        "unary_concurrency_limit": 1000,
        "unary_disabled": false,
        "filters": {
            "accounts": {
                "max": 100,
                "any": false,
                "account_max": 100,
                "account_reject": [
                    "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
                ],
                "owner_max": 10,
                "owner_reject": [
                    "11111111111111111111111111111111"
                ]
            },
            "slots": {
                "max": 1
            },
            "transactions": {
                "max": 100,
                "any": false,
                "account_include_max": 100,
                "account_include_reject": [
                    "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
                ],
                "account_exclude_max": 100,
                "account_required_max": 100
            },
            "transactions_status": {
                "max": 100,
                "any": false,
                "account_include_max": 100,
                "account_include_reject": [
                    "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
                ],
                "account_exclude_max": 100,
                "account_required_max": 100
            },
            "blocks": {
                "max": 1,
                "account_include_max": 100,
                "account_include_any": false,
                "account_include_reject": [
                    "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
                ],
                "include_transactions": true,
                "include_accounts": false,
                "include_entries": false
            },
            "blocks_meta": {
                "max": 1
            },
            "entries": {
                "max": 1
            }
        }
    }
}

检查配置

wget https://github.com/rpcpool/yellowstone-grpc/releases/download/v3.0.0%2Bsolana.2.0.18/config-check-ubuntu-22.04

chmod +x config-check-ubuntu-22.04

./config-check-ubuntu-22.04 -c yellowstone-config.json

启用

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

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

完整的启动脚本如下

#!/bin/bash

exec agave-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 \
	--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 \
	--log /root/solana-rpc.log

一些使用教程

最后更新于