Sending out xDAI using parity

const txId= await web3.eth.sendTransaction({
from: web3.eth.defaultAccount,
to: "address’,
value: xDAIToBn
});
using parity, on xDAI chain
nothing happens, just nothing
no eror
tried setting gas price 1 Gwei
tried everything :wink:
but transaction are coming in
if someone send xDAI then it comes to the wallet

1 Like

You didn’t indicate the version of web3 you are using. In the case of web3 1.0, the response from web3.eth.sendTransaction is in Promise or in the special emitted events
https://web3js.readthedocs.io/en/1.0/web3-eth.html#id71.

2 Likes

I am using 1.0.

Yes, I used promised Async await. I also tired the one from example (promise.then) and same result.

Did you check, that web3.eth.defaultAccount is not empty? If yes, please, attach your Parity config and the comprehensive js code, that causes the problem.

yea, default account has address on it, and I also tried using (“xDAi address”) too

Would love to figure this issue out. This is preventing us from being able to have a working xDAI bot in both our Discord and also in Telegram.

If anyone has any additional information on how we can fix this please let us know. Thank you. :pray:

Likely the problem is with the code of the bot. It should be shared here to help the author with debugging.

1 Like
1 Like
        xDAIToWithdraw=parseFloat(xDAIToWithdraw+0.01); //Fee is added (a penny)
        //Get user's balance from the HexdB and converet it into number
        const userBalance=parseFloat(await rClient.hgetAsync(msg.author.id, "balance"));
        if (userBalance>=xDAIToWithdraw){//check if users have enough to withdraw
            //Transaction has to be in wei format
            const xDaiToGwi=web3.utils.toWei(xDAIToWithdraw-0.01);//convert the withdraw ammount to Wei before send
            const txId= await web3.eth.sendTransaction({
                from: conf.mainAccount,//save your main account in config.js
                to: argument[0],//address to withdraw
                value: xDaiToGwi
                });
            if(txId){//If transaction is successful then tx will be returned
                msg.author.reply("**Successful Withdraw:** Your Withdrawal tx is " +txId);
            }```
1 Like

I also tried different variations of web3.eth.sendtransation and none worked.

1 Like

try to fix these bugs:

  1. gasPrice param is not set.
  2. gas param is not set. Set explicitly 21000.
  3. from param is not validated: there is no check in the code, that conf.mainAccount is a valid Ethereum address.
  4. to param is not validated: there is no check in the code, that argument[0] is a valid Ethereum address.
  5. value param is not validated. There is no check, that xDaiToGwi is a positive number.

hope it helps

1 Like