0

I've been trying since near 2 weeks to make my users able to deposit and send ethereum on site. I use geth mostly, and more recently web3.js.

I face a very weird issue. All seems well, transaction send, it return a tx, balance update etc. But it send to a random address! Both happen with json rpc sentransaction as well web3js.

I've read that some other people had this issue (https://www.reddit.com/r/ethereum/comments/4a8c2h/geth_sent_the_transaction_to_the_wrong_address/), but I'm pretty sure I don't make the mistakes they talk about as "" typos etc, because last eth I sent was sending to good address BUT 2 tx returned (last to another unknown address) and no found received.

Here my code:

var web3 = connect();
    var contract = buildcontract();
    //don't mind of theses functions, I can post if needed

     function sendEth() {


        var fromAddr = "<?php echo $_SESSION['wallet'];?>";
          var pass = "<?php echo $_SESSION['walletpass'];?>";
          web3.personal.unlockAccount(fromAddr, pass, 2);

        var toAddr = $('#destination').val();
         console.log('fromAddr: ' + fromAddr);
         console.log('destination: ' + toAddr);
        var valueEth = $('#sendeth').val();
         console.log('value: ' + valueEth);
        var value = parseFloat(valueEth)*1.0e18;
       // var gasPrice = 1000000000000
      //  var gas = 50000
        web3.eth.sendTransaction({from: fromAddr, to: toAddr, value: value}, function (err, txhash) {
          console.log('error: ' + err);
          console.log('txhash: ' + txhash);
        });
      }

      $('#sendethbut').click(function(){
    sendEth();
});

Anyone can help or had this issue and fixed? I'm sure I make a dumb mistake, I really checked everywhere before post here (I never post here for fun, I respect knowledge and sharing, it's giving me headache and make me miss bitcoind a lot.)

0
0

If the code is console.logging the correct address, it's almost certainly malware. Also check where in the transaction it gets hacked. If the transactionID is the same for everything but the send address, then they can hack that part someway. But if they just have your private key, you might see the money briefly hitting your account and then quickly getting drained.

Also check out the testrpc or the testnet until you have it hashed out. If it is malware, they won't be on those networks.

3
  • hum I even see correct destination on geth console itself, but right after it have another (or even multiple) transaction to other address generating. Could it be about nonce? Because I have multiple wallet (each user havve on on site). – btc4cash Oct 16 '17 at 21:03
  • Do you have any exemple of malware? I mean, I doubt, server should be secure, no intrusion detected, geth use correct settings. And using the sendtransaction web3.js happpen on user side. It's really pissing me off, I really don't understand. Nobody have a clue about and I'm sure it's code related and not server related. – btc4cash Oct 16 '17 at 21:04
  • Sorry man, I gave it my best shot. I'd really give it a try on the testnet to see if it still happens. but best of luck safeguarding the eth – thefett Oct 17 '17 at 2:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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