Jules wip 16641048634749923304#12
Open
a7600999 wants to merge 3 commits intoMrSpike63:mainfrom
Open
Conversation
… done so far and provide feedback for Jules to continue.
This commit introduces the capability to generate TRON-compatible addresses.
Key changes include:
1. **Command-Line Option:** Added `--tron` / `-t` flags to `main.cu` to enable TRON address output format.
2. **SHA256 Hashing:** Implemented CPU-based SHA256 hashing (`cpu_sha256.cpp`, `cpu_sha256.h`) as required for TRON's Base58Check checksum.
3. **Base58 Encoding:** Implemented CPU-based Base58 encoding (`cpu_base58.cpp`, `cpu_base58.h`).
4. **TRON Base58Check:** Implemented CPU-based TRON Base58Check logic (`cpu_tron_utils.cpp`, `cpu_tron_utils.h`), which:
* Prepends the TRON address prefix (0x41).
* Calculates the 4-byte checksum using double SHA256.
* Appends the checksum.
* Encodes the result using Base58.
5. **Integration in `main.cu`:** Modified the address printing logic in `main.cu` to use the TRON Base58Check format when the `--tron` flag is active. Otherwise, the original hex format is used.
6. **Build System Update:** Updated `.github/workflows/main.yml` to include the new C++ source files (`cpu_sha256.cpp`, `cpu_base58.cpp`, `cpu_tron_utils.cpp`) in the `nvcc` build commands for both Windows and Linux.
The project should now compile and be able to generate TRON addresses.
**Further Considerations based on Your Feedback:**
You have requested that GPU acceleration should be prioritized for all possible computations. The current implementations of SHA256, Base58 encoding, and the Base58Check process are CPU-based. For optimal performance as per your request, these utility functions could be ported to CUDA kernels in the future. This would apply to the final stage of converting the found raw address hash into the displayable TRON format.
I was planning to investigate CPU-specific paths for TRON formatting (if any outside `main.cu`'s direct output), add tests, and update documentation.
This commit optimizes the TRON address generation feature by porting the CPU-based TRON address formatting utilities (SHA256, Base58 encoding, and Base58Check process) to CUDA for GPU acceleration. This addresses your request to prioritize GPU utilization for all possible computations.
Key Changes:
1. **GPU Device Functions:**
* `gpu_sha256.cu`/`.h`: Implemented `compute_sha256_on_gpu` as a CUDA `__device__` function for performing SHA256 hashing on the GPU.
* `gpu_base58.cu`/`.h`: Implemented `gpu_base58_encode_to_char_array` as a CUDA `__device__` function for Base58 encoding on the GPU.
2. **GPU TRON Base58Check Kernel:**
* `gpu_tron_utils.cu`/`.h`:
* Created `batch_tron_base58check_kernel`, a CUDA `__global__` kernel that processes a batch of 20-byte address hashes. Each thread converts one hash into a full TRON Base58Check address string by calling the `compute_sha256_on_gpu` and `gpu_base58_encode_to_char_array` device functions.
* Implemented `batch_addresses_to_tron_gpu`, a C++ host function that manages memory transfers to/from the GPU and launches the `batch_tron_base58check_kernel`.
3. **Integration into Main Application:**
* `main.cu`: Modified the result processing loop. When `tron_mode` is active, `main.cu` now calls `batch_addresses_to_tron_gpu` to convert all found addresses in a batch using the GPU, instead of processing them sequentially on the CPU.
4. **Build System Update:**
* `.github/workflows/main.yml`: Added the new CUDA source files (`gpu_sha256.cu`, `gpu_base58.cu`, `gpu_tron_utils.cu`) to the `nvcc` compilation commands for both Windows and Linux builds.
This optimization is expected to provide a significant performance improvement for TRON address formatting when processing a large number of addresses simultaneously, aligning with the project's high-performance nature.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.