use solana_sdk::signature::{Keypair, Signer};
use bs58;
fn main() { println!("Hello, world!");
let keypair = Keypair::new();
let public_key = keypair.pubkey();
let secret_key = keypair.secret().to_bytes();
let bs58_encode = bs58::encode(secret_key).into_string();
let bs58_decode = bs58::decode(bs58_encode.clone()).into_vec();
println!("Chave Pública: {}", public_key);
println!("Chave Privada: {:?}", secret_key);
println!("bs58: {:?}", bs58_encode);
println!("bs58 decode: {:?}", bs58_decode);
}
use solana_sdk::signature::{Keypair, Signer};
use bs58;
fn main() {
println!("Hello, world!");
let keypair = Keypair::new();
let public_key = keypair.pubkey();
let secret_key = keypair.secret().to_bytes();
let bs58_encode = bs58::encode(secret_key).into_string();
let bs58_decode = bs58::decode(bs58_encode.clone()).into_vec();
println!("Chave Pública: {}", public_key);
println!("Chave Privada: {:?}", secret_key);
println!("bs58: {:?}", bs58_encode);
println!("bs58 decode: {:?}", bs58_decode);
}
Chave Pública: 5cBhgaZ6Tjq8AhGWjPeGavdqv6nh6mQnab9g23LUgmKV
Chave Privada: [190, 254, 81, 191, 188, 251, 2, 110, 124, 255, 154, 228, 12, 147, 48, 115, 138, 224, 49, 33, 213, 236, 238, 139, 148, 114, 85, 177, 208, 82, 32, 60]
bs58: "DrZPGNoMRaP9snVhjLRZEgLKcQHvzNJ2JBZCiK9UJeS7"
bs58 decode: Ok([190, 254, 81, 191, 188, 251, 2, 110, 124, 255, 154, 228, 12, 147, 48, 115, 138, 224, 49, 33, 213, 236, 238, 139, 148, 114, 85, 177, 208, 82, 32, 60])
Chave Pública: 5cBhgaZ6Tjq8AhGWjPeGavdqv6nh6mQnab9g23LUgmKV
Chave Privada: [190, 254, 81, 191, 188, 251, 2, 110, 124, 255, 154, 228, 12, 147, 48, 115, 138, 224, 49, 33, 213, 236, 238, 139, 148, 114, 85, 177, 208, 82, 32, 60]
bs58: "DrZPGNoMRaP9snVhjLRZEgLKcQHvzNJ2JBZCiK9UJeS7"
bs58 decode: Ok([190, 254, 81, 191, 188, 251, 2, 110, 124, 255, 154, 228, 12, 147, 48, 115, 138, 224, 49, 33, 213, 236, 238, 139, 148, 114, 85, 177, 208, 82, 32, 60])
as you can see I'm able to get the original bytes sequence from the encoded string, so I have no idea of what itswhat's going wrong