0

I am using Web3j to deploy and interact with a contract on Azure consortium blockchain.

Connecting to Azure consortium blockchain RPC endpoint

Web3j web3 = Web3j.build(new HttpService("http://***.cloudapp.azure.com:8545"));

Unlocking my account from my wallet file

Credentials credentials = WalletUtils.loadCredentials("mypassword", "path/to/mywallet");

Deploying contract from web3j smart contract wrapper

 Future<MySmartContract> contract = MySmartContract.deploy(
   web3,
   credentials,
   BigInteger.valueOf(700000),
   BigInteger.valueOf(700000),
   BigInteger.valueOf(0),
   new Uint256(10000L));

Printing the contract address

System.out.println(contract.get().getContractAddress());

Under the hood, Web3j would call

 "{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0xa8b688bc982252bf514adf9ff0cf6eef73d6b5212fb69a7b2f80b281faefecc8"],"id":1}"

but the result would always be "{"jsonrpc":"2.0","id":1,"result":null}[\n]"

Essentially, I am guessing the transaction is submitted to the blockchain, but the blockchain does not mine this transaction. I have tried this on Ethereum testnet and it works. I am wondering whether there are debugging tools or ways to monitor the azure consortium blockchain, and possible solutions to this issue.

1

Turns out it was gas price too low (bigger than the largest integer). Then it starts mining an empty contract, that turned out to be gas limit too low.

| improve this answer | |
  • Could you please accept this answer, otherwise community will bump it over and over again? – Mikhail Vladimirov Apr 22 '19 at 14:09
0

Good that you managed to find a solution!

Geth offers proof-of-authority now, which allows to spin up private chains without proof-of-work. Not something of much value but worth mentioning I think. We chose it over Azure for our proof-of-concept on ethereum.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.