yellowstone-grpc/README.md

112 lines
3.4 KiB
Markdown
Raw Normal View History

2023-03-20 08:40:48 -07:00
# Yellowstone gRPC - a Geyser based gRPC interface for Solana
2023-02-22 04:14:56 -08:00
2023-03-20 08:40:48 -07:00
This repo contains a fully functional gRPC interface for Solana. It is built around Solana's Geyser interface. In this repo we have the plugin as well as sample clients for multiple languages.
2023-02-22 04:14:56 -08:00
2023-03-20 08:40:48 -07:00
It provides the ability to get slots, blocks, transactions, and account update notifications over a standardised path.
2023-02-22 04:14:56 -08:00
2023-03-20 08:40:48 -07:00
For additional documentation, please see: https://docs.triton.one/rpc-pool/grpc-subscriptions
2022-10-19 07:34:41 -07:00
### Validator
```bash
$ solana-validator --geyser-plugin-config yellowstone-grpc-proto/config.json
2022-10-19 07:34:41 -07:00
```
2023-01-05 17:40:20 -08:00
### Plugin config check
```
cargo-fmt && cargo run --bin config-check -- --config yellowstone-grpc-proto/config.json
2023-01-05 17:40:20 -08:00
```
2022-10-19 15:19:59 -07:00
### Filters
See [yellowstone-grpc-proto/proto/geyser.proto](yellowstone-grpc-proto/proto/geyser.proto).
2022-10-19 15:19:59 -07:00
#### Slots
Currently all slots are broadcasted.
2022-10-19 15:19:59 -07:00
#### Account
Accounts can be filtered by:
- `account` — acount Pubkey, match to any Pubkey from the array
- `owner` — account owner Pubkey, match to any Pubkey from the array
- `filters` — same as `getProgramAccounts` filters, array of `dataSize` or `Memcmp` (bytes, base58, base64 are supported)
2022-10-19 15:19:59 -07:00
If all fields are empty then all accounts are broadcasted. Otherwise fields works as logical `AND` and values in arrays as logical `OR` (except values in `filters` which works as logical `AND`).
2022-10-20 16:43:19 -07:00
#### Transactions
- `vote` — enable/disable broadcast `vote` transactions
- `failed` — enable/disable broadcast `failed` transactions
2022-10-25 10:52:29 -07:00
- `account_include` — filter transactions which use any account
- `account_exclude` — filter transactions which do not use any account
If all fields are empty then all transactions are broadcasted. Otherwise fields works as logical `AND` and values in arrays as logical `OR`.
2022-10-20 18:06:23 -07:00
#### Blocks
Currently all blocks are broadcasted.
2022-10-25 10:52:29 -07:00
#### Blocks meta
Same as `Blocks` but without `transactions`.
2022-10-25 10:52:29 -07:00
### Limit filters
It's possible to add limits for filters in config. If `filters` field is omitted then filters doesn't have any limits.
```json
"grpc": {
"filters": {
"accounts": {
"max": 1,
"any": false,
"account_max": 10,
"account_reject": ["TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"],
"owner_max": 10,
"owner_reject": ["11111111111111111111111111111111"]
},
"slots": {
"max": 1
},
"transactions": {
"max": 1,
"any": false,
"account_include_max": 10,
"account_include_reject": ["TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"],
"account_exclude_max": 10
},
"blocks": {
"max": 1
}
}
}
```
### Examples
- [Go](examples/golang)
- [Node.js](examples/nodejs)
- [Rust](examples/rust)
- [TypeScript](examples/typescript)
### License
This project and all source code in this repository is licensed as follows:
Copyright 2023 Triton One Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.