Skip to content

This Rust code demonstrates how to decode Base58-encoded keys (such as those used in blockchain applications), process them to ensure they are in the correct byte length, and then serialize them into a JSON file

Notifications You must be signed in to change notification settings

Skillz23/rust-wallet-key-manager-for-Eclipse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Rust Wallet Key Manager for Eclipse

This Rust project provides a simple tool for managing private and public keys in Base58 format, commonly used for wallets like Backpack wallet. It decodes the keys, validates their size, and serializes them into a JSON file for storage.

Features

  • Base58 Decoding: Converts Base58-encoded private and public keys into byte arrays.
  • Key Validation: Ensures that both private and public keys are 32 bytes long, trimming the private key if necessary.
  • Keypair Serialization: Concatenates the private and public keys into a single keypair and serializes it into a JSON file (wallet.json).

Prerequisites

To run this code, you need to have the following installed:

  • Rust (Programming Language)
  • bs58 (Base58 encoding/decoding library for Rust)
  • serde_json (Serialization library for JSON in Rust)

Project Structure

The project is organized as follows: rust-wallet-key-manager/ │ └── wallet_key_json/ ├── Cargo.toml # Rust manifest file └── src/ └── main.rs # Main Rust code

Installation

  1. Install dependencies by adding the necessary crates to your Cargo.toml file:

    [dependencies]
    bs58 = "0.4"
    serde_json = "1.0"
  2. Compile the project:

    cargo build

Usage

  1. Open the src/main.rs file and replace the placeholder values your_base58_private_key_here and your_base58_public_key_here with your actual Base58-encoded private and public keys.

  2. Run the project:

    cargo run
  3. Once the program runs successfully, it will generate a file called wallet.json in the project directory containing the serialized keypair.

Feedback & Issues

If you encounter any bugs, have suggestions, or want to discuss this project, feel free to comment here #1

Example

For example, if your private and public keys are as follows:

  • Private Key: 8p3fsFU7GnRTU5L26WQiqM7RAEs8nXyZ2L9Qqc8vCRT8XctwUqe
  • Public Key: B2QmI8eA5WNSnH5F7MZRVNYvExg5AQkrtk

The resulting wallet.json file will look something like this:

[67, 98, 65, 213, 135, 20, ... ]

About

This Rust code demonstrates how to decode Base58-encoded keys (such as those used in blockchain applications), process them to ensure they are in the correct byte length, and then serialize them into a JSON file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages