I deployed a HelloWorld contract using web3j and it worked awesome with Ganache. I was able to call my only function from the contract and it returns the desired result all the time.
When I deploy the contract to a private node created with geth, the transaction appears in pendingTransactions list and it returns the address of the deployed contract shortly after starting mining, but I cannot call the funciton. It always returns 0x (tested with both geth console and web3j). As you can see it is there.
After starting the miner you can observe that it is successfully deployed:
This is the code that deploys the contract (it works with Ganache):
The problem is that every time when I want to call a function it returns 0x just like the contract is not there. I checked and geth manages to find the specific contract:
EDIT:
I used 3 methods to call the contract: Java code using web3j, Geth console and Remix ide.
1) As you can see the contract is deployed(it appeared at pending transactions and was added to the blockchain after I started the miner. The idea is that the result of the method is still empty string not "helloWorld")
2) From Geth console it fails to cast the value to BigNumber. I read somewhere that this might be because the node is not synchronized and it doesn't know what value to return, so it returns empty value.
It throws an exceptions because the value returned is 0x and it fails to cast it:
Genesis.json
{
"config": {
"chainId": 3792,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"difficulty": "2000",
"gasLimit": "3141592000000",
"alloc": {
"ca56bdff4ab30b96b4f618e718b88c7a1721ecc3": {
"balance": "300000000000000000000"
}
}
}