zig-bitcoin / btczee

Bitcoin protocol implementation in Zig.
https://zig-bitcoin.github.io/btczee/
MIT License
48 stars 30 forks source link

misc: Implement Vanity Address Generator for btczee #24

Closed AbdelStark closed 2 months ago

AbdelStark commented 2 months ago

Implement Vanity Address Generator for btczee

Description

It would be cool to implement a vanity address generator for btczee, our Bitcoin protocol implementation in Zig. A vanity address is a Bitcoin address where part of it is chosen by the user, making it look less random. This feature will allow users to create personalised Bitcoin addresses.

Feature Requirements

  1. Implement a new command vanity under the misc subcommand:

    btczee misc vanity <prefix>
  2. The generator should create a Bitcoin address that starts with the given prefix.

  3. Output should include:

    • The generated vanity address
    • The corresponding private key
    • The extended public key
  4. Example output format:

    Address: 1ABDELZ4cAQgskfVfMdNFjhXv95JTHqiZ6
    Private key: Kwn...8P
    Extended Public key: 028...2a77
  5. The implementation must be multithreaded for optimal performance.

  6. Include benchmarks to measure and optimize the generation speed.

Technical Considerations

  1. Use Zig's concurrency features for multithreading.
  2. Implement efficient Bitcoin address generation and validation.
  3. Ensure proper error handling for invalid inputs or generation failures.
  4. Use cryptographically secure random number generation for creating private keys.
  5. Implement a progress indicator or estimated time remaining for longer searches.

Performance Goals

  1. The generator should be able to check at least 100,000 addresses per second on a modern CPU.
  2. Implement adaptive difficulty estimation based on the prefix length.

Acceptance Criteria

  1. The vanity command is properly integrated into the btczee CLI.
  2. Vanity addresses are generated correctly and start with the user-provided prefix.
  3. Private keys and extended public keys are accurately derived and displayed.
  4. The generator utilizes multiple CPU cores effectively.
  5. Benchmark results show significant performance improvements over a single-threaded implementation.
  6. Code is well-documented and follows the project's coding standards.
  7. Unit tests are implemented to ensure the correctness of the vanity address generation.

Additional Notes

Related Documentation and resources

Estimated Complexity

Medium

Priority

Low

StringNick commented 2 months ago

Can i take it?

onlydustapp[bot] commented 2 months ago

Hey @StringNick! Thanks for showing interest. We've created an application for you to contribute to btczee. Go check it out on OnlyDust!