32

You can load this script to your geth console Mine only when there are transactions! var mining_threads = 1 function checkWork() { if (eth.getBlock("pending").transactions.length > 0) { if (eth.mining) return; console.log("== Pending transactions! Mining..."); miner.start(mining_threads); } else { ...


22

eth.pendingTransactions are the transactions that your local Geth node has, that haven't been mined to a block. eth.getBlock('pending') is the current block your node is mining (or would be mining on). It is not a block that has been added to the blockchain. eth.getBlock('pending').transactions are the transactions that are included in this hypothetical ...


11

Just use eth.pendingTransactions to find the transaction you want to resend. Then var tx = eth.pendingTransactions[index], replacing index with the index of the transaction you want to resend. Then eth.resend(tx, <optional gas price>, <optional gas limit>). This allows you to change the gas price and gas limit of the resent transaction. ...


9

Latest means the latest block that is already inside your own chain. All transactions contained within can be considered successfully executed. Security wise of course there can be reorgs, but in general they are executed transactions. Pending on the other hand is the collection of transactions that can be executed by the network (that your own node knows ...


9

To get the pending transactions you need a node that you're running on your own because this type of action requires a lot of resources. You can run your own Geth node and wait until it is synchronized. When I want to run a Geth node on the main net and query for the transaction pool, I usually start it like this. Download the Geth binary and rename it as ...


9

Looking at your transaction, you have set a gas price of 4 gwei. Though not very high for current traffic, this should eventually get picked up. You can check gas prices and traffic on ETH Gas watch. That could help you decide if you want to pay a lower fee and wait longer for your transaction to be mined, or pay a higher fee to include it faster. If it's ...


8

My understanding is that your understanding is correct, except you're missing one particular property of the Ethereum node software. Namely, as part of #3, the transaction is stored in the node's transaction pool (cf. Bitcoin's mempool). Normally, the transactions live there until mined, but because computers have finite memory and processing power, the ...


8

The closest I was able to find is parity_pendingTransactions and parity_pendingTransactionsStats. parity_pendingTransactions is very similar to geth's txpool_content, and gets the job done. Update: Since I was specifically looking for transactions sent from a specific account, this new method works even better: parity_localTransactions It only returns the ...


7

It's about canceling a transaction. More precisely, it's a replacement transaction for something else that was in the pending transaction pool. Consider a case where a transaction is sent with gasPrice set too low for a miner to include it a block. Given that Ethereum ensures that transactions from the same wallet will be mined in nonce order, everything ...


6

I still don't know why eth.resend was failing (and continues to fail as of geth 1.6.5), but this compatible patch works for me: eth.resend = function (tx, gasPrice, gas) { if (gasPrice) { tx.gasPrice = gasPrice; } if (gas) { tx.gas = gas; } tx.data = tx.input; return eth.sendTransaction(tx); }; I prefer to also add this convenience ...


6

The network's under strain cause of the Status ICO. Unfortunately there's not much you can do for cancelling it since the transaction has already been propagated to other nodes. If you click on the Gas Price you can set a higher price and resubmit the transaction to the network.


6

You can create a stream of pending transactions using web3.eth.subscribe('pendingTransactions' [, callback]);, which currently returns a transaction hash. You can turn into the actual transaction object using web3.eth.getTransaction(transactionHash [, callback]), which will return a transaction object. You can then filter the returned object by to and input ...


5

Example here using filters: How do I know when I've run out of gas programmatically? and also here by busy polling: https://github.com/barkthins/ether-pudding/blob/master/index.js#L375 I use busy polling, because I've found the filters to be unreliable (fails about 1:1000 times) EDIT: Also, how MANY blocks to wait for confirmation is debatable, ...


5

We can subscribe to events from the send method. For example we need to wait for 5 confirmations before considering a transaction mined we can do the following: return new Promise((resolve, reject) => { contract.methods.doWork(1, 2, 3).send({from: account}) .on('confirmation', (confirmationNumber) => { if (confirmationNumber === 5) { ...


5

60k - 80k pending transactions sounds like a normal situation and does not seem extensive. Currently, Ethereum does ~750k transactions daily. Assuming all transactions are processed at the same rate, the content of the pool is swapped in every 2.5 hours. However, my guess is that automated services send very low fee transactions that are not critical. ...


4

These transactions are from a mining pool. You can see the frequently mined blocks in 0xea674fdde714fd979de3edf0f56aa9716b898ec8. What you saw in txpool.content.pending are just two pending transactions representing the transactions that the miner is paying to the miners in the pool. Here is the transaction list for the same account. This mining pool is ...


4

Xavier has a good solution with clear usage examples here: https://gist.github.com/xavierlepretre/88682e871f4ad07be4534ae560692ee6. You get a thenable transaction receipt. This is a non-blocking solution, so the javascript thread is not stuck while waiting for the promise to be returned. It's well-solved using promises and implemented as an extension of ...


4

In Parity the hash is the an item for the ordering criteria, as you can see here: https://github.com/paritytech/parity/blob/1aaafa2d11b42af6be97754f4bc06e2856904464/ethcore/src/miner/transaction_queue.rs#L179 So in theory, the hash can decide the order, if the previous ordering compared to "equal". However miners can, and probably do, run custom algorithms ...


4

I have an educated guess based on the following scenario that Ethereum does permit: A sends 10 eth to B. (Tx01) While Tx01 is pending, A also sends 10 eth to C. (Tx02) Whether Tx01 or Tx02 end up in the chain (if any) is implementation-dependent and based on the node that actually mines the block. As a result, one cannot rely on anything in the transaction ...


4

Péter Szilágyi's answer on (https://github.com/ethereum/go-ethereum/issues/16284) help me to solve the problem. Every account and transaction in Ethereum has a nonce. At any given time, only the transaction with the correct nonce can be executed. If you submit a transaction with a low gas price, that will block all subsequent transactions since they ...


4

To send a transaction to the network, all you need is a connection to it. When using geth or parity, your the nodes may not broadcast your transactions until they are reasonably close to being fully synced with the network on some modes. You can always run them in a light mode setting, which allows them to connect to already synced nodes and make requests,...


4

You can totally simulated the transaction througth eth_call. Her are the code snippets of eth_call and apply transaction (source from go-ethereum): eth_call (could not change state) // Setup the gas pool (also for unmetered requests) // and apply the message. gp := new(core.GasPool).AddGas(math.MaxUint64) res, gas, failed, err := core.ApplyMessage(evm, ...


4

Sure, you can implement your own algorithm to order the txpool. Currently, they order by gas price that make sense for mining incentive https://github.com/ethereum/go-ethereum/blob/6bd896a97f0c86fdb6d0538f5f839d7ea104e888/core/tx_list.go#L374


4

Instead of using getTransactionReceipt, I used getTransaction So, to solve the above, we can use: var accountOneGasPrice = (await web3.eth.getTransaction(accountOneReceipt.tx)).gasPrice Where accountOneReceipt is the return value we receive from the above function call. And accountOneReceipt.tx to get the transaction hash. Note: await is necessary for ...


4

I assume you deployed it on the Main Net using MetaMask. Probably the gas limit of the transaction was too low. Otherwise the gas price was to low. Please send a screenshot of your MetaMask transactions, in case above didn't fix it.


4

It's just a slow node... When a node receives a transaction, it sends it to other connected nodes, who then send it to other connected nodes (repeat), until all the nodes have the transaction in their mempool. This process takes some time (but not much). It is possible that a transaction that is sent just before a block is mined could be picked up by the ...


4

That is not going to make a difference, bots are looking for pending transactions that execute the addLiquidity method. In order for that to work, the addLiquidity method on the router contract needs to be executed. Whether it is executed directly or via a proxy contract, it does not matter because the method on the router contract is always executed and ...


3

Your coins seem to be in your account on the public blockchain explorer, so I don't think you have to worry. The next step is to work out what has happened in your local wallet. Presumably you are using the Ethereum Wallet. Check the block number (like 2,105,732 currently) on the top of your Ethereum Wallet screen. This should match the latest block in ...


3

Yes, that's normal Geth behavior. eth.pendingTransactions are the transactions that your local Geth node has, that haven't been mined to a block. Geth does not persist these anywhere, so they are gone when Geth is restarted. You can also see that eth.pendingTransactions is an addition to Geth and not part of web3.eth. (There's also eth....


3

Here is a ECMAScript 2016 version of waiting a contract to be mined (or any transaction hash): // await sleep trick // http://stackoverflow.com/questions/951021/what-is-the-javascript-version-of-sleep function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } // We need to wait until any miner has included the transaction // in a ...


Only top voted, non community-wiki answers of a minimum length are eligible