Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Substream to accumulate SOL balance for every account #111

Open
this-username-is-taken opened this issue Dec 6, 2022 · 3 comments
Open
Assignees

Comments

@this-username-is-taken
Copy link
Contributor

you can use https://github.com/messari/substreams/tree/master/eth-balance as a reference

@melotik
Copy link
Contributor

melotik commented Dec 9, 2022

@this-username-is-taken do we also want to be able to retrieve the balance of any address at any block?

It doesn't seem like the eth-balance supports that, but maybe I am misunderstanding or reading this wrong

@this-username-is-taken
Copy link
Contributor Author

yes, though we don't need to put data at every block in the store to retrieve that. SF provides a very nice way called "initial snapshots" that you can leverage. You can check it out here: https://github.com/this-username-is-taken/lido-balances, specifically https://github.com/this-username-is-taken/lido-balances/blob/37d00ff702e24588c0ae9e784fe93d5aa887ee57/main.py#L54.

You can also use this mode in substreams run by adding and -i option:

$ substreams run --help
Stream modules from a given package on a remote endpoint

Usage:
  substreams run <manifest> <module_name> [flags]

Flags:
  -h, --help                                 help for run
  -i, --initial-snapshots                    Load an initial snapshot at start block, before continuing processing.
  -k, --insecure                             Skip certificate validation on GRPC connection
  -o, --output string                        Output mode. Defaults to 'ui' when in a TTY is present, and 'json' otherwise
  -p, --plaintext                            Establish GRPC connection in plaintext
  -s, --start-block int                      Start block to stream from. Defaults to -1, which means the initialBlock of the first module you are streaming (default -1)
  -t, --stop-block string                    Stop block to end stream at, inclusively. (default "0")
      --substreams-api-token-envvar string   name of variable containing Substreams Authentication token (default "SUBSTREAMS_API_TOKEN")
  -e, --substreams-endpoint string           Substreams gRPC endpoint (default "api.streamingfast.io:443")

@melotik
Copy link
Contributor

melotik commented Dec 15, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants