So I have this following code that was working a couple of weeks ago and today I decided to run a few tests and it just doesn't do its job anymore.

function approve(rid, guest_wallet, ctr_key, dti, dtf, href) {

   web3.eth.defaultAccount = web3.eth.coinbase;

   console.log('Sent transaction, waiting for confirmation');
   web3.eth.contract(abi).new(guest_wallet, ctr_key, dti, dtf, {data: code}, function (err, contract) {

     if (err) {
     } else if (contract.address) {
       console.log('Transaction was mined!');
       console.log('address: ' + contract.address);
         headers: {
           'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
         method: "POST",
         url: "/reservation/" + rid + "/contract-address",
         data: {ctr_addr: contract.address}
       }).done( function(msg) {
         if (confirm('Endereço salvo!'))
           window.location = href;

I'm using web3.js and MetaMask to sign the transactions and I'm getting this "transaction underpriced" message most of the times (a few have worked out) I try to deploy a contract or call its functions. I indeed get a transaction to sign that has 0 gas fee and a total of 0 too therefore so a guess that's why I get that message.

I saw some recent changes on the ethereum/web3.js github repository. Could this be the reason why it stoped working? That's why I get a bad transaction to sign from MetaMask? What should I do to solve this?

Thanks in advance, guys!

  • "Sent transaction, waiting for confirmation" - where did that happen? Feb 11, 2019 at 19:32
  • This was from the ethereum/web3.js examples. I just left it there Feb 11, 2019 at 21:08


Your Answer

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