The difference is in the input. You pay a fee for every byte in the input data. Zero bytes are cheaper.
First tx has a zero byte
From Yellow paper Appendix G "Fee Schedule"
Gtxdatazero, 4, Paid for every ...
I believe the issue is this line:
The inner call to web3.utils.toWei returns "10000000000". The outer call defaults to ether as a unit, so it multiplies that by 10**18 again, and you get "10000000000000000000000000000", which is 10,000,000,000 ether, certainly more than you have.
Drop the outer ...
you can try web3-hdwallet-provider to sign transactions for addresses derived from a 12-word mnemonic.
const Web3 = require('web3');
const Web3HDWalletProvider = require('web3-hdwallet-provider');
const httpProvider = new Web3.providers.HttpProvider('InfuraUrl');
const mnemonic = 'YOUR PRIVATE KEY';
const web3 = new Web3HDWalletProvider(mnemonic, ...
Most ethereum nodes will put tx's from a particular address into a queue, with increasing unique nonces. tx's with larger nonces will not be sent as long as tx's with smaller nonces are pending.
In the past, when I was able to run my own geth node and submit tx's to that, occasionally pending tx's would get stuck forever like you describe on mainnet or ...
To get access to the private key for using web3.js or pyethereum, uou need to export it from Metamask, by clicking the "..." next to the account name, choose "Account Settings" and scrolling down until you see a box labeled "Private Key". Use that as the key variable in the pyethereum example above, and be careful not to remove it afterwards and not to share ...
Infura is a public hosted node. It has no way to unlock your local accounts. Even if there was a way, it would be a security risk because anyone can connect to the same node and transfer your funds.
In order to send a transaction over Infura you will need to sign the transaction locally using web3.eth.sendRawTransaction(). The following example is from the ...