Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

238
Vistas
Converting string to Public Key

I am trying to convert a public key saved as a string to an anchor_lang PubKey object in rust. What is the procedure to convert a string to a PubKey object?

about 4 years ago · Santiago Gelvez
3 Respuestas
Responde la pregunta

0

If your public key can be static

pub const YOUR_PUBKEY: Pubkey = solana_program::pubkey!("base58_pubkey")

Otherwise

let your_pubkey = Pubkey::from_str("base58_pubkey").unwrap();
about 4 years ago · Santiago Gelvez Denunciar

0

Here is an exact example (the string will vary with what you have) that converts a base58 string to Solana Pubkey:

let pk_key = Pubkey::from_str("SDMHqNqN82QSjEaEuqybmpXsjtX98YuTsX6YCdT99to").unwrap();
about 4 years ago · Santiago Gelvez Denunciar

0

I've never used solana before, so I am not sure exactly how one would do this. Looking through their docs, it looks like PubKey implements the FromStr trait. This has a from_str function that takes a &str and parses it into a PubKey.

about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda