This is a purposefully simple example intended to get your started.
The example application retrieves blocks at a monthly interval using the TrueBlocks SDK. The application then prints the block numbers and their corresponding dates and quits. Simple.
Ensure you have the following installed and running:
- Go Version 1.25.1 or higher
- The latest version of TrueBlocks Core
Clone the repository:
git clone https://github.com/TrueBlocks/trueblocks-core.gitBuild TrueBlocks Core by following the (installation instructions), and then navigate to the example directory:
cd ../examples/simpleRun the example using the following command:
go run .There are no command line options.
The above will render data similar to the following. Note that each record represents the last block in the given month which would be useful, for example, in an accounting app.
...
17382265 2023-05-31 23:59:59 UTC
17595509 2023-06-30 23:59:59 UTC
17816433 2023-07-31 23:59:59 UTC
18037987 2023-08-31 23:59:59 UTC
18251964 2023-09-30 23:59:59 UTC
18473542 2023-10-31 23:59:59 UTC
18687850 2023-11-30 23:59:59 UTC
...If you encounter issues, check the following:
- Ensure at least Go Version 1.25.1.
- Make sure you have a valid Ethereum mainnet RPC configured.
- Ensure TrueBlocks Core is properly installed and configured.
- Verify the command-line arguments are correct and within valid ranges.
For further assistance, refer to the TrueBlocks Documentation.
See the LICENSE file at the root of this repo for details.