Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invokeContract keeps reporting UNKNOWN: NOT_ENOUGH_UTXO_ERROR #18

Open
springrain opened this issue Mar 8, 2021 · 1 comment
Open

Comments

@springrain
Copy link
Contributor

 public static void main(String[] args) {
        //初始化客户端
        XuperClient client = new XuperClient("192.168.0.10:37101");
        //导入账户证书
        Account account = Account.create("D:/keys");

        //account.setContractAccount("XC1111111111111111@xuper");

        Map<String, byte[]> map = new HashMap<>();
        map.put("key", "stones".getBytes());

        Transaction tx = client.invokeContract(account, "native", "javacounter", "get", map);

       // Transaction tx = client.queryContract(account, "native", "javacounter", "get", map);
        System.out.println("response: " + tx.getContractResponse().getBodyStr());
    }

client.queryContract is normal, client.invokeContract keeps reporting

Exception in thread "main" java.lang.RuntimeException: io.grpc.StatusRuntimeException: UNKNOWN: NOT_ENOUGH_UTXO_ERROR
at com.baidu.xuper.api.Proposal.build(Proposal.java:193)
at com.baidu.xuper.api.XuperClient.invokeContract(XuperClient.java:100)
at JavaSDKDemo.main(JavaSDKDemo.java:24)
Caused by: io.grpc.StatusRuntimeException: UNKNOWN: NOT_ENOUGH_UTXO_ERROR
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:240)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:221)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:140)
at com.baidu.xuper.pb.XchainGrpc$XchainBlockingStub.preExecWithSelectUTXO(XchainGrpc.java:1763)
at com.baidu.xuper.api.Proposal.build(Proposal.java:187)
... 2 more

pom.xml dependency

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.baidu.xuper</groupId>
      <artifactId>xuper-java-sdk</artifactId>
      <version>0.1.1</version>
    </dependency>
  </dependencies>
@godeamon
Copy link
Collaborator

@springrain The account should have enough tokens(xuper) to invoke the contract.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants