Playing around with Web3j, I set up a private, single-node blockchain with Geth using a genesis gas limit of 21 million.
I started a node with the following command:
geth --datadir ./geth/data --rpc --networkid 611234220438 --nodiscover --mine --minerthreads 1 --etherbase 0xda42738b67c0dca7a44e3601312b7e44a007e4d2 --targetgaslimit 21000000 --verbosity 3
When I deploy a contract (gas limit 1 million), everything works as expected. A little bit of ETH is taken out of my wallet and I can interact with the deployed contract. However, constant functions work. All non-constant transactions fail and consume all gas.
I am executing this contract function (Solidity 0.4.13):
function skip() {}
Here is the contract creation and transaction as confirmed by Geth logging:
Submitted contract creation
fullhash=0xb407cf8dcb79cca01bd7bf11fb2ed025f5316d978aef92f2373be290a389df50 contract=0x075abea5aae9997bbf83a4a7f03d57c5bad65303
Submitted transaction
fullhash=0xae6697b0ebf6754f2570433a57dea159c662d79f59ef9d820cda5ffeb83028a5 recipient=0xc7c1335a273a6ee519f5563357b93b3e365a74da
Here is the transaction receipt:
{
"transactionHash":"0x43c42aee0e44df748b0b482240e79f1536df15196843a4f752083bda02a14b01",
"transactionIndex":0,
"blockHash":"0x86b599ac97879417c5ed3f96e8985e85e861774c010b340e50081fcb6b2248bf",
"blockNumber":461,
"cumulativeGasUsed":1000000,
"gasUsed":1000000,
"contractAddress":null,
"root":"0x70b774d4d679210d1e88f0d8fc0d6f2e0aec457fe333d65515e6bf61de7e0ec6",
"from":"0xd2b4519298938983586e09028a2ea302c667cf76",
"to":"0x075abea5aae9997bbf83a4a7f03d57c5bad65303",
"logs":[],
"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"gasUsedRaw":"0xf4240",
"transactionIndexRaw":"0x0",
"blockNumberRaw":"0x1cd",
"cumulativeGasUsedRaw":"0xf4240"
}
What might be going wrong? To me, it looks like the transaction might be failing, though I don't know why or how to tell.
from
account have enough ETH for the gas at the current gas price on your blockchain? At least, it did not throw, which would have consumed all gas sent.