Here is an article on how to get a private калана Сана рут.

Solan Private Key Public Key **

In Solan, where you create an event or sign a message, you need to submit both your beautiful key and priority. The public key is used to send events, the private key is one for signing that can be online.

Although Sorana provides a lot of information about the application subscription, including accounts, transmitting events and sending a more private key to public key. How can we achieve it with rust.

Why do we need a public key

Before we dive in to get a public book with a private key, let’s be fast. In Solan, you need both public and private keys:

  • Shipment Event: The public key is to be available to send online events.

  • Sign messages: The private key is used to sign messages that may be flights.

Solana Specific Functions Problem

*

Unfortunately, one is not a direct function in the’s sdkchrote to get a public private key. The application subscription provided by the Sorana-SDK focuses on classes and manage account signing and signing accounts.

How to get a public key from a private key

As we cannot use Solana's sub -operations, we must implement this functionality. The Como approach is to create a random key pair and a private key in the corresponding Thea Ite "Sec25555556" library.

Here is an example of how you do it in your rust code:

'rust

Use :: FS;

consisting of secp256k1 :: {EC, key};

Use solan_sdk :: Kay :: ED25519KEY;

Use solan_sdk :: Prelude ::*;

Fn Get_Public_key_from_private_Key (Private_Key: & [U8]) -> Result {Result

Let private_key = ec :: decode (& private_key) ?;

Let public_key = private_key.public_key (). to_bytes ();

OK (public_key)

}

FN Main () -> Result <(), ED25519KEYERROR> {

// Create a new SecP256k1 KY

Let Private_Key = Key :: New (Ed2519:: From_raw_Key_data (b “your_private_here”)))));

// Get a public key to a private key

Let public_key = e_public_key_from_private_key (private_key.as_ref ()) ?;

Println! ("Public Key: {:?, Public_key);

OK (())

}

This code creates a new SecP256k1 KY to provide private private private private and compliance with them to apply for the corresponding halls. Note that you own " Your_private_keyhere " won your act of yours.

conclusion

*

When you are. This example indicates a head that you can rust to get a public key from a private 32-to-syllable result.

Remember that Elways keeps private KYS safe and never anyone.