5

This is a newbie question. Such as address like - zGmof8SeyvHKnSEWv4i2mVv7MYe85D3zZqsTBjsKXSV

Is it base64?

3 Answers 3

6

Addresses are base58 encoded

From the doc:

const { Keypair } = require("@solana/web3.js")

let kp = Keypair.generate();

console.log(kp.publicKey.toBase58());
console.log(kp.secretKey);

// 2DVaHtcdTf7cm18Zm9VV8rKK4oSnjmTkKE6MiXe18Qsb
// Uint8Array(64) [152, 43, 116, ... 118]

A solana address is the public key part of a keypair that is generated with ed25519 algorithm. These are just bytes, but often you will also see it as encoded in base58.

1
  • 1
    Also worth noting base58 is designed to eliminate confusion over 1 vs I, 0 vs O, etc by removing those characters. Aug 17, 2022 at 10:06
1

I think public keys are base58

0

Any 256-bit value is a valid Solana address. By convention, these are stringified with base58.

While any 256-bit value is valid, they cannot be arbitrarily reserved for use. There are three ways to reserve an address,

  1. Generate an Ed25519 keypair and sign a transaction that specifies the corresponding SystemInstruction::CreateAccount instruction which reserves the public key bit value. These addresses occupy the 256-bit values corresponding the Ed25519 curve points.
  2. Find a PDA under a specific program which will CPI to the system program to reserve the address on your behalf. These addresses occupy all 256-bit values not on the Ed25519 curve.
  3. Use the system program *WithSeed instructions to reserve addresses derived from a valid Ed25519 public key and a user-specified 32-byte utf-8 string. These can occupy both on- and off-curve bit value addresses. 1 and 2 should be preferred to this method

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.