Solana.Key (Solana v0.2.0) View Source
Functions for creating and validating Solana keys and keypairs.
Link to this section Summary
Functions
Checks to see if a Solana.Key.t/0
is valid.
decodes a base58-encoded key and returns it in a tuple.
decodes a base58-encoded key and returns it.
Derives a program address from seeds and a program ID.
Finds a valid program address.
Generates a public/private key pair in the format {private_key, public_key}
Reads a public/private key pair from a file system
wallet in the format
{private_key, public_key}
. Returns {:ok, pair}
if successful, or {:error, reason}
if not.
Derive a public key from another key, a seed, and a program ID.
Link to this section Types
Specs
a public/private keypair
Specs
t() :: Ed25519.key()
Solana public or private key
Link to this section Functions
Specs
Checks to see if a Solana.Key.t/0
is valid.
Specs
decodes a base58-encoded key and returns it in a tuple.
If it fails, return an error tuple.
Specs
decodes a base58-encoded key and returns it.
Throws an ArgumentError
if it fails.
Specs
Derives a program address from seeds and a program ID.
Specs
find_address(seeds :: [binary()], program_id :: t()) :: {:ok, t(), nonce :: byte()} | {:error, :no_nonce}
Finds a valid program address.
Valid addresses must fall off the ed25519 curve; generate a series of nonces, then combine each one with the given seeds and program ID until a valid address is found. If a valid address is found, return the address and the nonce in a tuple. Otherwise, return an error tuple.
Specs
pair() :: pair()
Generates a public/private key pair in the format {private_key, public_key}
Specs
Reads a public/private key pair from a file system
wallet in the format
{private_key, public_key}
. Returns {:ok, pair}
if successful, or {:error, reason}
if not.
Specs
Derive a public key from another key, a seed, and a program ID.
The program ID will also serve as the owner of the public key, giving it permission to write data to the account.