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

How with near-indexer-for-explorer sync data from 0 block? #379

Open
mrkriodev opened this issue Sep 8, 2023 · 7 comments
Open

How with near-indexer-for-explorer sync data from 0 block? #379

mrkriodev opened this issue Sep 8, 2023 · 7 comments
Assignees

Comments

@mrkriodev
Copy link

So question is:
How with near-indexer-for-explorer sync data from 0 block?

I need to dowload some config file from AWS ?

@khorolets
Copy link
Member

I need to dowload some config file from AWS ?

Hey! No, you don't. You need to run the Indexer for Explorer (with your AWS credentials set up) with the command ./indexer <chain_id> from-block --height 0

Please note, that the 0th block is not actually the 0th. For mainnet it's 9820210 and for testnet it's 42376888. You don't have to specify them, 0 will do the trick and will start from the earliest available on S3.

@mrkriodev
Copy link
Author

  1. Yes i've noticed this

Please note, that the 0th block is not actually the 0th. For mainnet it's 9820210 and for testnet it's 42376888. You don't have to specify them, 0 will do the trick and will start from the earliest available on S3.

  1. And how can i retrive data about blocks/transactions/receipts previous 9820210 and sync it to my db ?

@khorolets
Copy link
Member

And how can i retrive data about blocks/transactions/receipts previous 9820210 and sync it to my db ?

There is no previous.

During the regenesis, all the current state of the blockchain is dumped into a genesis.json and started from there. After the regenesis (sometimes called hard-fork which is not), the blockchain starts from the "beginning" where previous blockchain state becomes a genesis for this one. To prevent confusion NEAR decided to not start from 0th block after this process. But it seems it doesn't help.

Only for the first run of the Indexer for Explorer you might want to add --store-genesis key to capture the data from the genesis records (initial accounts, access keys, state).

@mrkriodev
Copy link
Author

Only for the first run of the Indexer for Explorer you might want to add --store-genesis key to capture the data from the genesis records (initial accounts, access keys, state).

  1. Can you explain again what would be if i add --store-genesis?
  2. And comand should be like this :
    ./target/release/indexer-explorer --store-genesis mainnet
    or
    ./target/release/indexer-explorer --store-genesis mainnet from-block 0
    ?

@khorolets
Copy link
Member

@mrkriodev I am sorry I have misled you a bit

Your command should look like

./target/release/indexer-explorer mainnet from-genesis

It implicitly will do the thing that --store-genesis used to do.

It will:

  1. Download the genesis.json config for the specified chain id (mainnet in your case)
  2. Will read through the records and store the initial data to the database
  3. Start indexing from the earliest block in the chain (9820210 in your case)

@mrkriodev
Copy link
Author

  1. Start indexing from the earliest block in the chain (9820210 in your case)
    I understand. Thanks

If i install an archival node and sync it from s3://near-protocol-public/backups/testnet/archive/latest
then i could get info about receipts from block previously 9820210 with rpc-api of the node?

@khorolets
Copy link
Member

  1. Start indexing from the earliest block in the chain (9820210 in your case)
    I understand. Thanks

If i install an archival node and sync it from s3://near-protocol-public/backups/testnet/archive/latest then i could get info about receipts from block previously 9820210 with rpc-api of the node?

The version of the Indexer for Explorer in master branch is not compatible with the data from nearcore (since the master is built on top of the NEAR Lake framework using S3)

If you are interested in the nearcore-based version you need to have a look at master-nearcore branch which is supported by the community, we don't have enough capacity to support it.

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