Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

149
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!