4

I want to periodically sync a set of accounts from a validator to my database and I find Geyser plugins fit my need. But the document doesn't show how to attach the plugin to a running validator or something.

What do I suppose to do with a Geyser plugin against a validator?

2 Answers 2

3

A validator can run with a companion geyser plugin as such:

solana-test-validator --geyser-plugin-config my_plugin_config.json

At minima, the validator needs to know the path to the dynamic library. Indeed at startup the validator will try to find your geyser plugin library and dlopen() it. So here's the minimum valid JSON file:

{
  "libpath": "path_to_lib/libmy_geyser_plugin.so"
}

1 Simple Geyser Plugin Example

Here's a starter project you can use to make your geyser plugin: https://github.com/mwrites/solana-geyser-plugin-scaffold

2 Regarding solana-accountsdb-plugin-postgres

The configuration file requires more than just "libpath", prepare your Postgres DB accordingly and with the correct information most importantly:

  • host
  • user
  • port

For libpath, run cargo build, and assuming you are on MacOS (for dev), the path is most probably ./target/debug/libsolana_geyser_plugin_postgres.dylib. Note the .dylib on MacOS.

3

Look here, specifically

The plugin configuration file is specified by the validator's CLI parameter --geyser-plugin-config and the file must be readable to the validator process.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.