Search code examples
blockchainsolanasolana-cli

Missing transaction history in solana-test-validator


I have successfully deploy the BPF and run the client on the Solana hello world example: https://github.com/solana-labs/example-helloworld. The greeted counter in the program also works as expected.

Then, I tried to inspect the transactions using Solana Explorer pointing to localhost. I can see the transactions that I made on the program's transaction history, but after few minutes (1.5-3.5 minutes), if I refresh the page, those transactions is missing.

I've tried to create my own hello program but the transaction is disappeared after few minutes in the history. I also did a simple solana transfer, but it still same.

I did search on google about this problem, but I can't find any good information. I know the state is not a problem (because the solana balance and the data contained in hello world program is correct), so I suspect the problem is from Solana Explorer, but then I tried solana transaction-history on my cli. And same as before, the transaction appeared and disappeared.

So now, I suspect that solana-test-validator remove the transaction history from ledger. But, I found that the test-ledger is growing (last time I check is 10gb).

I'm still not sure why the transaction history is missing and how to fix it, so I can inspect the transactions that I and the program make. It will make my on-chain program development easier. Thanks!


Solution

  • This can be confusing. The default ledger size for solana-test-validator is very small, so you'll lose transactions very quickly. You can use the --limit-ledger-size argument to make it bigger. More information from -h:

    $ solana-test-validator -h
    solana-test-validator 1.9.2 (src:f58b87be; feat:4100269022)
    Test Validator
    
    USAGE:
        solana-test-validator [FLAGS] [OPTIONS] --ledger <DIR>
    
    ...
    ...
    
            --limit-ledger-size <SHRED_COUNT>                    Keep this amount of shreds in root slots. [default: 10000]