Preconditions
I'm running a private network with Geth, having custom smart contracts deployed by Truffle and a simple frontend which using Metamask as a provider to connect the network.
Versions
- Geth: 1.8.12-stable
- Truffle: v4.1.13 (core: 4.1.13)
- Solidity: v0.4.24 (solc-js)
Genesis Block
{
"config": {
"chainId": 331788,
"homesteadBlock": 0,
"eip155Block": 331788,
"eip158Block": 0
},
"nonce": "0x0000000000000000",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x00",
"gasLimit": "10000100000",
"difficulty": "20",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0d33f764b19d03df4daa283859577378a01c5cad",
"alloc": {
"0x0d33f764b19d03df4daa283859577378a01c5cad": { "balance": "1000000" }
}
}
Initing the private network
geth --identity "node" --rpc --rpcport "8545" --rpccorsdomain "*" --datadir=/ethereum/data --ethash.dagdir=/ethereum/ethash --port "30303" --nodiscover --rpcapi "db,eth,net,admin,web3,debug" --networkid 331788 init /ethereum/genesis.json
geth --identity "node" --rpc --rpcaddr="0.0.0.0" --rpcport "8545" --rpccorsdomain "*" --datadir=/ethereum/data --ethash.dagdir=/ethereum/ethash --port "30303" --nodiscover --verbosity=9 --rpcapi "admin,db,eth,net,web3,miner,personal,debug" --networkid 331788
Preparation
Once the private network is up, I connect to it via geth attach
and then run the following:
personal.unlockAccount(web3.eth.coinbase, "123123", 150000);
miner.setGasPrice(1); miner.setEtherbase(personal.listAccounts[0]); miner.start(5);
So I unlock my coinbase account and start 5 miners with gas price value 1. After some time, I'm able to deploy my contracts which I do next. So they take the first three nonce values for my coinbase account. When contract is deploying txpool.inspect
shows me the following:
pending: {
0x0D33f764b19d03DF4DAa283859577378a01C5Cad: {
2: "contract creation: 0 wei + 10010000 gas × 32 wei"
}
},
queued: {}
Contracts are deployed okay.
Sending transactions
On the frontend, I have the following code to send transaction to my custom contract using truffle-contract
abstraction:
sampleNameContract().use(function (instance) {
return instance.addRecord(recordId, address, recordId, address, { gas: "0x10000", from: address })
}).then(function (value) {
console.log(`Tx: ${value}`)
})
Executing this snippet, Metamask asks me to approve transaction and I do it. As a result, I have the following info in txpool.inspect
:
pending: {
0x0D33f764b19d03DF4DAa283859577378a01C5Cad: {
3: "0x440C9c5DBC21cedcAfF1a98ac7A48b5c6930cd0c: 0 wei + 10010000 gas × 32000000000 wei"
}
},
queued: {}
This transaction is never mined and applied and leaves in the tx pool as a pending one forever.
Issue
The transaction I send to my custom contract from the frontend is never mined and applied. Can you please help me figure this out?