Lantern
Archiving Blocks and Transactions with Lantern
Enabling this feature allows you to do the following:
- Answer RPC calls pertaining to slots, blocks, and transactions
- Serve Yellowstone gRPC streams for slots, blocks and transactions
- Serve WebSocket methods pertaining to slots, blocks and transactions
Important Note
Configuration
Using this feature requires some extra configuration. We'll cover what the options do here, however using The Configurator (configurator.fluxrpc.com) is sufficient to quickly get started.
Enabling Block Archival
To enable block archival, you need to set a Yellowstone URL in the configuration file. Unlike account updates, Lantern receives new blocks over Yellowstone. Only FluxRPC Yellowstone is supported, although you may choose the server closest to you.
Next, you need to enable block archival by setting block_stream to true. This will cause Lantern to start streaming in and storing blocks. You can choose whether you want to store full blocks (i.e. blocks that include all the transactions) or not. This is configured with block_transaction_details.
You can also choose whether you wish to store rewards. This is set via block_rewards.
If you request a block from Lantern with a level of detail that you're not storing, it will forward the request to FluxRPC. For example, if you set Lantern not to store rewards, and request a block with rewards, Lantern will forward the request to FluxRPC.
Finally, you need to decide how many blocks Lantern will archive. This defaults to 150. Blocks take up a fair amount of storage, so make sure you allocate enough for Lantern!
Enabling Transaction Archival
To enable transaction archival, you must set both block_stream and block_transaction_details to true.
You must also set block_retention and block_tx_retention to positive integers. You may set block_tx_retention to a lower number than block_retention, for example if you wish to store transactions only for more recent blocks and wish to limit storage use. However, you may not set block_tx_retention to a higher number than block_retention.
Example Configuration
The following is an example of how to set the fields we've described above. This will set Lantern to store the last 1000 blocks, and transactions as well, but not rewards.
"yellowstone_url": "https://yellowstone.eu.fluxrpc.com",
"block_stream": true,
"block_transaction_details": true,
"block_rewards": false,
"block_retention": 1000,
"block_tx_retention": 1000,