Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ethereum transaction doesn't apear in blockchain. #1235

Closed
BelsonaInvestmentGroup opened this issue Dec 15, 2017 · 8 comments
Closed

Ethereum transaction doesn't apear in blockchain. #1235

BelsonaInvestmentGroup opened this issue Dec 15, 2017 · 8 comments

Comments

@BelsonaInvestmentGroup
Copy link

Hello, guys!
Trying to send transaction to EOS smart contract.
Using web3 1.0.0 with node js.
` var nonce = await self.web3.eth.getTransactionCount(self.config.account);
nonce++;

    var hash = {
                from: self.config.account, 
                to: eos_address, 
                value: self.web3.utils.toHex(self.web3.utils.toWei(optimalETH.toString())), 
                gas: self.web3.utils.toHex(self.config.glEos),
                gasPrice: self.web3.utils.toHex(gasPrice),
                nonce: nonce,  
            };

    var tx = await self.web3.eth.accounts.signTransaction(hash, self.config.pk,
            function (error) {
                if (error) log("Ошибка при подписании транзакции: " + error);
                else {
                    log("Транзакция подписана");
                    // await self.claimPeriod(today, periodEnd);
                    // go();          
                }
            } 
    );
 
self.web3.eth.sendSignedTransaction(tx.rawTransaction)
        .on('transactionHash', function(hash) {
            log("Транзакция отправлена: " + hash);
        })
        .on('error', function(error) {
            log("Ошибка при отправке транзакции" + error);
        })
        .on('confirmation', function(confirmationNumber, receipt) {
            log(`Транзакция подтверждена ${confirmationNumber}, ${receipt}`);
        });  

`

Once transaction was added with hash 0xf9feaa5d2dfe7542a4cadbd67732bde98f61547d96bc3393512bafde66fd6411.

But this transaction can't be found in etherscan.io. Address 'from' doesn't contain this transaction.

I run geth locally with full blockchain download with this settings:
geth console --rpc --rpccorsdomain="*" --datadir "E:\Ethereum" 2>>log_geth.txt
We i am making request to my geth to find the transaction
async function test () { var tx = await w.web3.eth.getTransaction('0xf9feaa5d2dfe7542a4cadbd67732bde98f61547d96bc3393512bafde66fd6411'); console.log('Рикавер транзакшн', tx); } test();
i am getting transaction data:
{ blockHash: '0x0000000000000000000000000000000000000000000000000000000000000000', blockNumber: null, from: '0x09FB8601cD17755200BE8aeC133824f7056E9C8d', gas: 250000, gasPrice: '58100070000', hash: '0xf9feaa5d2dfe7542a4cadbd67732bde98f61547d96bc3393512bafde66fd6411', input: '0x', nonce: 13, to: '0xd0a6E6C54DbC68Db5db3A091B171A77407Ff7ccf', transactionIndex: 0, value: '20000000000000000', v: '0x25', r: '0x7ba2d2e1508c53e85d8059542dc0c2cda9911fa0f6c401daf1570636902d8c8f', s: '0xdd8d6ab010023316e8089be5be744148daa12fb7c8c28f0fc8c82d727c23926' }

So, can anybode help, please, and explain me why transaction is visible in my node, but can't be found on etherscan.io, and why transaction is still not mined having a high value gasPrice?

@nisdas
Copy link
Contributor

nisdas commented Dec 17, 2017

You are not connected to the live blockchain most likely, Using node just type in web3.eth.getBlock('latest').then(console.log) . If after doing that you do not get a block above 4 million , then you are not connected to the mainnet

@BelsonaInvestmentGroup
Copy link
Author

You are not connected to the live blockchain most likely, Using node just type in web3.eth.getBlock('latest').then(console.log) . If after doing that you do not get a block above 4 million , then you are not connected to the mainnet

web3.eth.getBlock('latest') is showing number 4753446 which is equal to latest block number on etherscan.io

@BelsonaInvestmentGroup
Copy link
Author

BelsonaInvestmentGroup commented Dec 18, 2017

Tried different approach using
`var wallet = await self.web3.eth.accounts.wallet.add(self.config.pk);
var hash = {
from: wallet,
to: eos_address,
value: self.web3.utils.toHex(self.web3.utils.toWei(optimalETH.toString())),
gas: self.web3.utils.toHex(self.config.glEos),
gasPrice: self.web3.utils.toHex(gasPrice),
nonce: nonce,
};
console.log(hash);

    self.web3.eth.sendTransaction(hash).on('transactionHash', function(hash) {
               log("Транзакция отправлена: " + hash);
         })`

It returned 'known transaction'.

Then i've tried to use https://mainnet.infura.io/ node. It returned new transaction hash. Which again can't be found on etherscan.io either on my node. A few moments ago i've received rejection 'transaction was not mined within 50 block'. This is really strange, because it is too fast for 50 block to be mined.

I think there is some mistakes in transaction, but can get what is wrong.

@BelsonaInvestmentGroup
Copy link
Author

Now i am totally sure, that something is wrong with transaction data, because i've tried to make same transaction using myetherwallet.com. I've copied raw transaction and send it using self.web3.eth.sendSignedTransaction. Guess what? It was mined ASAP.

@BelsonaInvestmentGroup
Copy link
Author

My mind is blowing: after transaction maded with myetherwallet.com was mined 2 blocks later appeared transaction which was made locally by node js. What is going on? Someone, please, explain.

@BelsonaInvestmentGroup
Copy link
Author

It is over guys.
Seems like "optinal" params in signTransaction is not optinal.
After defining all params Transaction was successfully mined.

@phuongla
Copy link

@BelsonaInvestmentGroup can you share your params? thanks.

@avictoria27
Copy link

Hi, I happen to encounter the same problem as you, when I try to send a transaction from IOS, and I am getting a transaction data similar to yours, could yo please tell me the optional params that you use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants