@solana/web3.js
    Preparing search index...

    Class PublicKey

    A Solana address

    Implements

    • HasAddress
    Index
    default: PublicKey = ...

    Default public key value. The base58-encoded string representation is all ones (as seen below) The underlying number is 32 bytes that are all zeros

    • get address(): Address

      The base-58 representation of the public key as a Kit Address branded string. Satisfies Kit's HasAddress interface so a PublicKey can be passed anywhere Kit accepts an address-bearing object.

      Returns Address

    • Return the base-58 representation of the public key as a Kit Address branded string, suitable for passing to @solana/kit APIs or generated program clients that expect an Address.

      Returns Address

    • Verify a signature for the provided message with this public key.

      Parameters

      • signature: ReadonlyUint8Array
      • message: ReadonlyUint8Array

      Returns Promise<boolean>

      2.0.0

    • Derive a program address from seeds and a program ID.

      Parameters

      • seeds: (Uint8Array<ArrayBufferLike> | ReadonlyUint8Array<ArrayBufferLike>)[]
      • programId: PublicKey

      Returns Promise<PublicKey>

      SolanaError with SOLANA_ERROR__SUBTLE_CRYPTO__DIGEST_UNIMPLEMENTED from @solana/errors if crypto.subtle.digest() is unavailable.

      SolanaError with SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED from @solana/errors if the supplied seeds exceed the PDA count limit.

      SolanaError with SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED from @solana/errors if any supplied seed exceeds the PDA seed-length limit.

      SolanaError with SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE from @solana/errors if the derived address falls on the Ed25519 curve.

    • 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.

      Parameters

      Returns Promise<PublicKey>

      SolanaError with SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED from @solana/errors if the seed exceeds 32 bytes.

      SolanaError with SOLANA_ERROR__ADDRESSES__PDA_ENDS_WITH_PDA_MARKER from @solana/errors if the program address ends with the PDA marker bytes.

    • Find a valid program address

      Valid program addresses must fall off the ed25519 curve. This function iterates a nonce until it finds one that when combined with the seeds results in a valid program address.

      Parameters

      • seeds: (Uint8Array<ArrayBufferLike> | ReadonlyUint8Array<ArrayBufferLike>)[]
      • programId: PublicKey

      Returns Promise<[PublicKey, number]>

      SolanaError with SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED from @solana/errors if the supplied seeds exceed the PDA count limit.

      SolanaError with SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED from @solana/errors if any supplied seed exceeds the PDA seed-length limit.

      SolanaError with SOLANA_ERROR__ADDRESSES__FAILED_TO_FIND_VIABLE_PDA_BUMP_SEED from @solana/errors if no viable bump seed exists.