Skip to content

Sample contract is not deployed. Not enough gas #14

@StanislavMakarov

Description

@StanislavMakarov

Transfer transaction works OK, but deploy fails. What's wrong?
Source code:
ContractGasProvider contractGasProvider = new DefaultGasProvider();
try {

        contract = Greeter.deploy(
                web3j, credentials,
                contractGasProvider,
                "Hello!"
        ).send();
        contractAddress  = contract.getContractAddress();
        System.out.printf("Contract Address : " + contract.getContractAddress());
    } catch(Exception e){
        e.printStackTrace();
    }

08:34:34.908 [main] INFO org.web3j.sample.Application - Deploying smart contract
org.web3j.protocol.exceptions.TransactionException: Transaction has failed with status: 0x0. Gas used: 4300000. (not-enough gas?)
at org.web3j.tx.Contract.executeTransaction(Contract.java:290)
at org.web3j.tx.Contract.create(Contract.java:326)
at org.web3j.tx.Contract.deploy(Contract.java:355)
at org.web3j.tx.Contract.lambda$deployRemoteCall$7(Contract.java:449)
at org.web3j.protocol.core.RemoteCall.send(RemoteCall.java:30)
at org.web3j.sample.Application.run(Application.java:124)
at org.web3j.sample.Application.main(Application.java:67)
Exception in thread "main" java.lang.NullPointerException
at org.web3j.sample.Application.run(Application.java:144)
at org.web3j.sample.Application.main(Application.java:67)
Disconnected from the target VM, address: '127.0.0.1:62773', transport: 'socket'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions