java版merkleTree,完全匹配solidity的proof验证。找了很多版本的javamerkleTree计算结果和proof验证和solidity语言下计算记过不一致,找了下原因是char的取值范围不同导致转换结果不一样,最终导致proof验证错误。最后手写了一版java完全匹配s
java版merkleTree,完全匹配solidity的proof验证。找了很多版本的java merkleTree 计算结果和proof验证和solidity语言下计算记过不一致,找了下原因是char的取值范围不同导致转换结果不一样,最终导致proof验证错误。最后手写了一版java 完全匹配solidity proof验证的merkleTree,并开源了。
开源地址:https://github.com/CodeTrainerMan/Web3Utils.
Web3Utils is a project aimed at collecting commonly used utility classes for Web3 development. It provides a set of tools and helper functions to simplify the process of interacting with Web3 and Ethereum-based blockchain networks.
Web3Utils offers the following features:
- Web3 Provider Management: Includes utility classes to manage different Web3 providers, such as Infura, Alchemy, and local Ethereum nodes.
- Account Management: Provides functions to generate Ethereum accounts, sign and verify transactions, and handle account-related operations.
- Contract Interactions: Simplifies the interaction with Ethereum smart contracts by providing helper functions for contract deployment, method invocation, and event listening.
- Blockchain Data Retrieval: Includes utilities for fetching blockchain data, such as block information, transaction details, and token balances.
- Utilities and Helpers: Offers various utility classes and helper functions for common tasks, including address validation, transaction encoding, and handling Ethereum units and conversions.
To start using Web3Utils in your project, follow these steps:
- Installation: Include the Web3Utils library as a dependency in your project. You can do this by adding the relevant dependency configuration to your project's build file or package manager.
- Initialization: Initialize the Web3Utils library in your application code, providing the necessary configuration options for your preferred Web3 provider and Ethereum network.
- Import and Use: Import the required utility classes or helper functions from Web3Utils into your application code and start using them according to your needs. Refer to the documentation and examples provided with each utility for usage instructions.
- Examples and Documentation: Explore the Web3Utils documentation and example code to understand the available features and how to utilize them effectively in your project