├── .gitignore ├── wallet_key_json ├── Cargo.toml └── src │ └── main.rs └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | *.rs.bk 3 | *.swp 4 | -------------------------------------------------------------------------------- /wallet_key_json/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "wallet_key_json" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | bs58 = "0.4" 8 | serde_json = "1.0" 9 | 10 | -------------------------------------------------------------------------------- /wallet_key_json/src/main.rs: -------------------------------------------------------------------------------- 1 | use std::fs::File; 2 | use std::io::Write; 3 | use bs58; 4 | 5 | fn main() { 6 | let private_key_str = "your_base58_private_key_here"; 7 | let public_key_str = "your_base58_public_key_here"; 8 | 9 | let mut private_key_bytes = bs58::decode(private_key_str).into_vec().expect("Invalid private key format"); 10 | let public_key_bytes = bs58::decode(public_key_str).into_vec().expect("Invalid public key format"); 11 | 12 | if private_key_bytes.len() == 64 { 13 | private_key_bytes = private_key_bytes[0..32].to_vec(); 14 | } 15 | 16 | assert_eq!(private_key_bytes.len(), 32, "Private key must be 32 bytes"); 17 | assert_eq!(public_key_bytes.len(), 32, "Public key must be 32 bytes"); 18 | 19 | let mut keypair = Vec::new(); 20 | keypair.extend_from_slice(&private_key_bytes); 21 | keypair.extend_from_slice(&public_key_bytes); 22 | 23 | let json_content = serde_json::to_string(&keypair).unwrap(); 24 | 25 | let mut file = File::create("wallet.json").unwrap(); 26 | file.write_all(json_content.as_bytes()).unwrap(); 27 | 28 | println!("wallet.json file created with the keys in the correct format."); 29 | } 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rust Wallet Key Manager for Eclipse 2 | 3 | This project decodes Base58-encoded private and public keys used in Backpack wallets for example, ensures they are in the correct format, and serializes them into a JSON file (`wallet.json`). 4 | 5 | ## Features 6 | 7 | - Base58 decoding 8 | - Keypair serialization as JSON 9 | 10 | ## Prerequisites 11 | 12 | - Rust installed (https://www.rust-lang.org/tools/install) 13 | - Dependencies: bs58 and serde_json (automatically handled via Cargo) 14 | 15 | ## Directory Structure: 16 | Make sure your repository has a clean and organized folder structure: 17 | 18 | ```rust-wallet-key-manager-for-Eclipse-v2/ 19 | ├── .gitignore 20 | ├── README.md 21 | └── wallet_key_json/ 22 | ├── Cargo.toml 23 | └── src/ 24 | └── main.rs 25 | ``` 26 | 27 | ## Running the Code 28 | 29 | Clone the repository: 30 | 31 | ```bash 32 | git clone https://github.com/Skillz23/rust-wallet-key-manager-for-Eclipse-v2.git 33 | cd rust-wallet-key-manager-for-Eclipse-v2/wallet_key_json 34 | ``` 35 | 36 | ## Install dependencies and run the project: 37 | 38 | To run the project, use Cargo: 39 | ` 40 | cargo run 41 | ` 42 | ## Replace the placeholder keys with actual Base58-encoded keys: 43 | 44 | In the file `src/main.rs`, replace the following placeholders with your actual Base58-encoded keys: 45 | ```rust 46 | let private_key_str = "your_base58_private_key_here"; 47 | let public_key_str = "your_base58_public_key_here"; 48 | ``` 49 | ## Running the project: 50 | 51 | After running the project with `cargo run`, the program will create a file called `wallet.json`, which will contain the serialized keypair. 52 | 53 | ## Example: 54 | 55 | You can replace the placeholders with actual keys, for example: 56 | 57 | Private Key: `5p3fsFU7GvNJU5L47UBiqK2TUTs8nXoN2L9Qqc8vVNP3sctwUqe` 58 | 59 | Public Key: `B2NpV8eA5RTSnH5F8KMNRNYvExg5PAkrtk` 60 | 61 | When you run the project, the resulting `wallet.json` file will look like this: 62 | ```json 63 | [67, 98, 65, 213, 135, 20, ... ] 64 | ``` 65 | ## Contributing 66 | 67 | Feel free to open issues or submit pull requests if you would like to contribute to the project. 68 | 69 | ## License 70 | 71 | This project is licensed under the MIT License 72 | --------------------------------------------------------------------------------