I'm running a private network with one miner and I have the problem that if I send too many transactions from a node, those transactions are not getting mined.
For example: If I send one transaction every 6 seconds, then not a single transaction gets mined. If I send one transaction every 30 seconds then everything works fine.
I send a transaction with nodejs like this:
instance.myFunction(data, {from: account.address, gas: 4000000}, function(error, result) {
// do something
});
The transactions just pile up and not getting mined by the miner.
Here are for example two transactions:
> eth.getTransaction( '0x1e06fec8994ee38a32b2438d51b57c9d4bc95239c45322d58a4a9f0c8a03be4a')
{
blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
blockNumber: null,
from: "0x7ee9e416fdb371a9190dfa8fdf7361e66ada7e12",
gas: 4000000,
gasPrice: 18000000000,
hash: "0x1e06fec8994ee38a32b2438d51b57c9d4bc95239c45322d58a4a9f0c8a03be4a",
input: "0x4ee27fa900000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000006313530313331393039383234343b343000000000000000000000000000000000313530313331393039393234383b323400000000000000000000000000000000313530313331393130303235323b353500000000000000000000000000000000313530313331393130313235363b373700000000000000000000000000000000313530313331393130323236313b393100000000000000000000000000000000313530313331393130333236353b313800000000000000000000000000000000",
nonce: 107,
r: "0xe761ccc9db6d387eadba7bcb93dac6c582f8baf052da76eaff828e5b91c1722d",
s: "0x571f99554f299d551bb05bb6145210a6480c015b42604f9bd885de6eea94dbcb",
to: "0x8e195493424d416300f8b61b01145956345cd914",
transactionIndex: 0,
v: "0x42",
value: 0
}
> eth.getTransaction('0x02e09d88360c27f6da92075a8ab1f8e2bb23bca149004a3d134048492348677d')
{
blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
blockNumber: null,
from: "0x7ee9e416fdb371a9190dfa8fdf7361e66ada7e12",
gas: 4000000,
gasPrice: 18000000000,
hash: "0x02e09d88360c27f6da92075a8ab1f8e2bb23bca149004a3d134048492348677d",
input: "0x4ee27fa900000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000006313530313331393130343331353b343000000000000000000000000000000000313530313331393130353331373b353700000000000000000000000000000000313530313331393130363332313b383500000000000000000000000000000000313530313331393130373332363b313500000000000000000000000000000000313530313331393130383332393b363000000000000000000000000000000000313530313331393130393333323b323000000000000000000000000000000000",
nonce: 108,
r: "0x183a1fc9c149ece66ed8e782758f7980d3b01c88595662e769171e155749dc4a",
s: "0xfd9abed2168cae1e33c2bd4441015178e54aa3fb1c742f4f613d9d3c140ef4",
to: "0x8e195493424d416300f8b61b01145956345cd914",
transactionIndex: 0,
v: "0x41",
value: 0
}
I don't understand, why it's not working. I don't think one transaction every 5 second is a lot, they should get included into one block.
I'm using web3 version 0.20.0.
update: to make things even more weird, it is sometimes actually working but sometimes it's not - seems like completely random to me. I can see in the console that the transactions are sent, I can also see, that new blocks are generated and synced with my node - once it stopped working, I have to restart the node.
update: I tried to override the nonce manually but that didn't helped. All transactions are just queued in the transaction pool:
> txpool
{
content: {
pending: {},
queued: {
0x7ee9e416fdb371a9190dfa8fdf7361e66ada7e12: {
110: {...},
111: {...},
112: {...},
113: {...},
114: {...},
115: {...},
116: {...},
117: {...},
118: {...},
119: {...},
120: {...},
121: {...},
122: {...},
123: {...},
124: {...},
125: {...},
126: {...},
127: {...},
128: {...},
129: {...},
130: {...},
131: {...},
132: {...},
133: {...},
134: {...},
135: {...}
}
}
},
inspect: {
pending: {},
queued: {
0x7ee9e416fdb371a9190dfa8fdf7361e66ada7e12: {
110: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
111: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
112: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
113: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
114: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
115: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
116: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
117: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
118: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
119: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
120: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
121: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
122: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
123: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
124: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
125: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
126: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
127: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
128: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
129: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
130: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
131: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
132: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
133: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
134: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas",
135: "0x8e195493424d416300f8b61b01145956345cd914: 0 wei + 4000000 × 18000000000 gas"
}
}
},
status: {
pending: 0,
queued: 26
},
getContent: function(callback),
getInspect: function(callback),
getStatus: function(callback)
}
that's the function in my contract which gets called:
/**
* save sensor data
* @param data sensor data timestamp;value
* @return bool
*/
function saveSensorData(bytes32[] data) returns (bool success)
{
if(sensors[msg.sender].exists)
{
for(uint i = 0; i < data.length; i++) {
sensors[msg.sender].sensorData.push(data[i]);
}
return true;
}
return false;
}