4
votes
Creating a Custom Vanity Key / Wallet
When a Solana wallet is generated using a mnemonic, is has a set "derivation path". The reason the wallet you generated with the CLI is different in the CLI and in your web wallet is because ...
3
votes
How is a Solana wallet created behind the hood?
You've got it! Unlike EVM where the pubkey still gets hashed and cropped, a Solana keypair is nothing more than a normal ed25519 keypair. Using OpenSSH or any other tool/library that correctly ...
3
votes
Accepted
retrieving my seed phrase from id.json file
Do not share your array in id.json i.e private key with anyone.
The array in id.json file represent the private key of your wallet.
Goto phantom or any Solana wallet.
Select add/connect wallet.
...
3
votes
Why does solana uses only half of the private key to sign using ed25519?
Without getting too into the weeds, Ed25519 signing uses both the public key and the private key.
The 64 bytes you see in the Keypair class of @solana/web3.js is actually the Ed25519 key-pair. The ...
3
votes
Accepted
Deriving a public key from a private key programmatically
You can use tweetnacl to generate pubkey from the secret key.
...
import * as nacl from 'tweetnacl';
import * as bs58 from 'bs58';
...
export function deriveSolAddressFromKey(key: string): string {
...
3
votes
Accepted
How to get public and secret key from keypair Solders
It's in bytes and is correct, but my understanding is the keys are commonly Base58 encoded.
You can do the following:
import base58 # You'll need to install this
def create_keypair():
kp = ...
3
votes
Accepted
How do I create a keypair using a custom derivation path with Javascript?
Using Javascript
This can be done with the ed25519-hd-key and tweetnacl libraries.
Make sure you start the path with m/44'/501', as this is required for Solana addresses.
Setup (run this in your ...
3
votes
Accepted
After deployment of a program can the program_id's private key be made public?
You'd never be able to re-use that keypair on-chain unless you deleted the program account entirely.
The only thing I can think of at the moment is if there was some weird peripheral tool that needs ...
3
votes
Recover address wallet
Code Snippet
Step 1: import lib:
import { bs58 } from "@project-serum/anchor/dist/cjs/utils/bytes";
import { web3 } from "@project-serum/anchor";
Step 2: Call function:
const ...
3
votes
Accepted
How to generate address out of a seed phrase and a derivation path for Solana and some tokens?
Regarding keygen
The solana-keygen CLI tool that comes with the Solana suite includes a recover instruction that does what you need. Typically, you'll do:
$ solana-keygen recover -o key.json prompt://
...
2
votes
Accepted
Import a Base58 private key into Solana cli
If you are using the Solana CLI, it is possible to pass a keypair in from stdin without writing it to a file first.
This can be demonstrated using any keypair file and doing:
$ cat my-keypair.json | ...
2
votes
Who owns the private key of delegated Staked Accounts?
By "most accounts", I'm assuming that you mean associated token accounts, which are program-derived addresses from the associated-token-account program.
Stake accounts, on the other hand, ...
2
votes
Can I recover one of my wallets without having my private key or seed phrase?
If you've lost both the seed phrase and/or private key(s) then I'm afraid its gone for good.
2
votes
Accepted
How to import a wallet keypair generated from CLI into a wallet provider like phantom?
Phantom only support Base58 private key format. Conversion from Uint8Array to Base58 is necessary.
Here's a step-by-step guide with NodeJS:
Install bs58 lib
npm install bs58
Write the Conversion ...
2
votes
How to get the public key of a private key with Rust?
To calculate the corresponding public key from a 32-byte private key in Rust, you won’t directly find this functionality in the solana-sdk crate. However, Solana uses Ed25519 for cryptographic signing,...
2
votes
Accepted
how to decode privatekey into bs58 acceptable by wallets?
Most wallets expect the secret key to actually be the private key concatenated with the public key. Try this:
fn main() {
let keypair = Keypair::new();
let public_key = keypair.pubkey();
...
2
votes
Import a Base58 private key into Solana cli
Are you comfortable with command line, node, and npm? If so, the snippet below will output the file that you can use for Solana CLI.
May sound like a lot, but I just went through this with a non-dev ...
1
vote
Accepted
How to get the public key of a private key with Rust?
If you look at the keypair module in solana-sdk, you'll find keypair_from_seed to do exactly what you want: https://docs.rs/solana-sdk/latest/solana_sdk/signer/keypair/fn.keypair_from_seed.html. With ...
1
vote
Solana Testnet Wallet Private Keys Length
All Private Keys are 64 bytes, and the first 32 are the Public-Key.
You can use the KeyPair class as well.
https://solana-labs.github.io/solana-web3.js/classes/Keypair.html
Here is some more info ...
1
vote
Need Help with Recovering SOL Sent to an Off-Curve Address
To answer your questions:
Off-curve addresses are used for program-derived addresses, so they are actually usable and valid in Solana. For example, all associated-token-accounts are off-curve ...
1
vote
A special private key that can be used to make a TX to a certain wallet ONLY
Your objectives are valid and you've correctly identified storing private keys on a server as a security risk.
A more appropriate solution might be to write a simple solana program (smart contract) ...
1
vote
How to: add my Anchor wallet to Phantom
Update June 2024: it looks like Phantom doesn't support the array-of-numbers format any more so you'll have to convert your array-of-numbers private key file to base58.
npm i bs58 "@solana-...
1
vote
Accepted
How to: add my Anchor wallet to Phantom
Phantom accetps the array as a Private key.
Just copy the contents of the id.json and paste it in the import private key in Phantom.
1
vote
How to: add my Anchor wallet to Phantom
Found on the deep coffins of reddit:
That id.json file on the Keypair Path indeed holds your private key.
To export it, the following terminal commands suffices:
cat <Keypair file path>
# copy ...
1
vote
Import a Base58 private key into Solana cli
I wrote a small Python script that converts private key into byte array. It is fairly simple and it has come in handy many times.
python3 -m pip install base58
If you are using python3, first ...
1
vote
I have different Solana balance and address with the same backup phrase imported to Phantom and TrustWallet
Trustwallet should use m/44'/501'/0' and phantom default I think is m/44'/501'/0'/0'
So you might have to export your private key from phantom and add that to trustwallet or move your tokens
1
vote
I have different Solana balance and address with the same backup phrase imported to Phantom and TrustWallet
If you're seeing different pubkeys for the same seed phrase, it means that Phantom and TrustWallet are using different derivation paths to get from the seed phrases to the private key. You can try ...
1
vote
What is the most secure way to store mass private keys?
If - for what reason ever - you need to store the users' private keys on your server, then you must include a secure transport from the user to your server in your considerations. The best option is ...
1
vote
What is the most secure way to store mass private keys?
Storing private keys of other users is NOT ideal.
I don't see the need for you to store the keys in a DB (on the server) if you are trying to build a product like a wallet.
for example, Phantom stores ...
1
vote
Accepted
Verify public and private key combination
Using solana-keygen cli tool you can verify by running this,
solana-keygen verify <walletPublickey> path_to_wallet/keypair.json
Yes, we sign a message with a private key and verify the ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
private-key × 28wallet × 10
publickey × 8
keypair × 7
address × 4
seed × 3
solana-keygen × 3
python × 2
account × 2
phantom × 2
solana-cli × 2
solana-sdk × 2
web3.js × 2
encryption × 2
mobile × 1
nfts × 1
anchor × 1
transactions × 1
validator × 1
testnet × 1
rust × 1
solana-program × 1
deploy × 1
swap × 1
cli × 1