I can use github.com/gagliardetto/solan-go to create an Account (Wallet) through private key (base58)
// Wallet is a wrapper around a PrivateKey
type Wallet struct {
PrivateKey PrivateKey
}
func NewWallet() *Wallet {
privateKey, err := NewRandomPrivateKey()
if err != nil {
panic(fmt.Sprintf("failed to generate private key: %s", err))
}
return &Wallet{
PrivateKey: privateKey,
}
}
func WalletFromPrivateKeyBase58(privateKey string) (*Wallet, error) {
k, err := PrivateKeyFromBase58(privateKey)
if err != nil {
return nil, fmt.Errorf("account from private key: private key from b58: %w", err)
}
return &Wallet{
PrivateKey: k,
}, nil
}
func (a *Wallet) PublicKey() PublicKey {
return a.PrivateKey.PublicKey()
}
...
But SolNet needs PrivateKey and PublicKey to create an account
/// <summary>
/// Initialize an account with the passed private and public keys.
/// </summary>
/// <param name="privateKey">The private key.</param>
/// <param name="publicKey">The public key.</param>
public Account(string privateKey, string publicKey)
{
PrivateKey = new PrivateKey(privateKey);
PublicKey = new PublicKey(publicKey);
}
How can I create an account using only PrivateKey?
I can use github.com/gagliardetto/solan-go to create an Account (Wallet) through private key (base58)
But SolNet needs PrivateKey and PublicKey to create an account
How can I create an account using only PrivateKey?