This console application is designed to index the blocks and transaction information of the Ethereum blockchain. It starts from Block #12100001 and goes up to Block #12100500. The indexing sequence is as follows:
- Get the desired block with the method eth_getBlockByNumber. The block number needs to be converted to hexadecimal format (Ex. 0xB8A1A1).
- If the block is found, call eth_getBlockTransactionCountByNumber to get the count of transactions in the block. Insert the block record into the database.
- If the transaction count is not zero, call eth_getTransactionByBlockNumberAndIndex to retrieve the transaction information line by line. Insert the record into the database.
- The entire process should be logged accordingly to a text file, and a timestamp and processing time should be logged in both the console and the logfile.
- Install the .NET Framework if it is not already installed.
- Install the MySQL Connector/NET if it is not already installed.
- Clone the repository or download the source code.
- Open the solution in Visual Studio.
- Build the solution.
- Open the appsettings.json file and set the connection string for the MySQL database and API key.