var tto_count = document.getElementById("to_count");
   //var transaction = web3.eth.getTransactionFromBlock(1865, 0).input;
   //var transaction = web3.eth.getTransactionFromBlock(1865, 0).then(console.log);
   var transaction = web3.eth.getTransactionFromBlock(1865, 0);
   //tto_count.value = web3.eth.toString(transaction);
   tto_count.value = JSON.stringify(transaction); 

This is the source code I've failed so far.

1 Answer 1


If you are using web3 v1.2.xx the call is async and either you use promises or await.

It will return a transaction object, the input field contains what you were looking for.

web3.eth.getTransactionFromBlock(1865, 0)
.then(function (tx) {
  • Oh my god... Thank you... Thank you so much!!
    – Eum T
    Jun 17, 2020 at 11:04

Your Answer

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

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