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

151
Vistas
async result not resolved in web3

I'm playing Ethernaut Level 3, so I wrote the following code to retrieve the "guess" value:

async do_guess => {
    let no     = await web3.eth.getBlockNumber()
    let block  = await web3.eth.getBlock(no)
    let factor = new web3.utils.BN('57896044618658097711785492504343953926634992332820282019728792003956564819968')
    let result = new web3.utils.BN(block.hash)

    let tmp = result.div(factor)
    return tmp.toString()
}

let value = await do_guess()
console.log(value)

But the value is always "undefined" somehow, does anyone know what's wrong?

enter image description here

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

0

You are getting undefined because that is the return value of the last statement ran in your console, your promise is likely never resolving.

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