0

I am using following of Java code while creating account:

  • Using Java library
  • eos-java-rpc-wrapper
  • adyliu/jeos
  • Using

Jungle2 testnet

  • Chain Id of jungle2 testnet:

038f4b0fc8ff18a4f0842a8f0564611f6e96e8535901dd45e43ac8691a1c4dca

The Following java code

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import client.EosApiClientFactory;
import client.EosApiRestClient;
import client.domain.common.transaction.PackedTransaction;
import client.domain.common.transaction.SignedPackedTransaction;
import client.domain.common.transaction.TransactionAction;
import client.domain.common.transaction.TransactionAuthorization;
import client.domain.response.chain.AbiJsonToBin;
import client.domain.response.chain.Block;
import client.domain.response.chain.transaction.PushedTransaction;


public class CreateAccount {
    public static void main(String[] args) {


        EosApiRestClient eosApiRestClient = EosApiClientFactory.newInstance("http://jungle2.cryptolions.io:8888").newRestClient();

        /* Create the json array of arguments */
        Map<String, String> args1 = new HashMap<>(4);
        args1.put("from", "abontester12"); // SENDER (MY PRE-GENERATED EOS ACCOUNT)
        args1.put("to", "eosio"); // RECEIVER
        args1.put("quantity", "0.1000 EOS"); // AMOUNT
        args1.put("memo", "My First Transaction"); // JUST MEMO
        AbiJsonToBin data = eosApiRestClient.abiJsonToBin("eosio.token", "transfer", args1);

        System.out.println("data::"+ data.getBinargs());

        Block block = eosApiRestClient.getBlock(eosApiRestClient.getChainInfo().getHeadBlockId());

        System.out.println("block::"+ block.getId());

        /* Create Transaction Action Authorization */
        TransactionAuthorization transactionAuthorization = new TransactionAuthorization();
        transactionAuthorization.setActor("abontester12");
        transactionAuthorization.setPermission("active");

        /* Create Transaction Action */
        TransactionAction transactionAction = new TransactionAction();
        transactionAction.setAccount("abontester12");
        transactionAction.setName("transfer");
        transactionAction.setData(data.getBinargs());
        transactionAction.setAuthorization(Collections.singletonList(transactionAuthorization));

        /* Create a transaction */
        PackedTransaction packedTransaction = new PackedTransaction();
        packedTransaction.setRefBlockPrefix(block.getRefBlockPrefix().toString());
        packedTransaction.setRefBlockNum(block.getBlockNum().toString());
        packedTransaction.setExpiration("2019-04-30T14:53:59.000");
        packedTransaction.setRegion("0");
        packedTransaction.setMax_net_usage_words("0");
        packedTransaction.setContextFreeData(Collections.emptyList());
        packedTransaction.setContextFreeActions(Collections.emptyList());
        packedTransaction.setActions(Collections.singletonList(transactionAction));

        SignedPackedTransaction signedPackedTransaction = eosApiRestClient.signTransaction(packedTransaction, Collections.singletonList("EOS6t8Piaew17krZSMM3aZJt6XMawH9HuvDZPABw7kooJRTiUeijD"),"038f4b0fc8ff18a4f0842a8f0564611f6e96e8535901dd45e43ac8691a1c4dca");

        /* Push the transaction */
       // PushedTransaction = eosApiRestClient.pushTransaction("none", signedPackedTransaction);

        PushedTransaction pushedTransaction = eosApiRestClient.pushTransaction("none", signedPackedTransaction);
        System.out.println("pushedTransaction=" + pushedTransaction.getTransactionId());


    }
}

It gives the following Exception:

INFO: {"code":404,"message":"Not Found","error":{"code":0,"name":"exception","what":"unspecified","details":[{"message":"Unknown Endpoint","file":"http_plugin.cpp","line_number":328,"method":"handle_http_request"}]}}
Apr 24, 2019 3:53:08 PM okhttp3.internal.platform.Platform log
INFO: <-- END HTTP (210-byte body)
Exception in thread "main" client.exception.EosApiException: Not Found: unspecified
    at client.impl.EosApiServiceGenerator.executeSync(EosApiServiceGenerator.java:55)
    at client.impl.EosApiRestClientImpl.signTransaction(EosApiRestClientImpl.java:197)
    at com.apiservice.controller.CreateAccount.main(CreateAccount.java:61)

pom.xml is:

<dependency>
    <groupId>io.jafka</groupId>
    <artifactId>jeos</artifactId>
    <version>0.9.15</version>
</dependency>

<dependency>
    <groupId>com.github.EOSEssentials</groupId>
    <artifactId>eos-java-rpc-wrapper</artifactId>
    <version>master-SNAPSHOT</version>
</dependency>

even tried with chain id for testnet at suggested

chain id : e70aaab8997e1dfce58fbfac80cbbb8fecec7b99cf982a9444273cbc64c41473
1
  • Jungle2 is discontinued. Use Jungle3. Jan 13, 2021 at 15:31

2 Answers 2

0

Chain-ID of jungle2 is

e70aaab8997e1dfce58fbfac80cbbb8fecec7b99cf982a9444273cbc64c41473

1
  • also tried with the same having same error even have accountname "abontester12" on testnet it returns message INFO: {"code":404,"message":"Not Found","error":{"code":0,"name":"exception","what":"unspecified","details":[{"message":"Unknown Endpoint","file":"http_plugin.cpp","line_number":328,"method":"handle_http_request"}]}}
    – crypto
    Apr 24, 2019 at 10:50
0

Your Testnet-URL seems to be wrong.

Try one of these Endpoints or get an updated list here.

http://jungle2.cryptolions.io:80
https://jungle2.cryptolions.io:443
https://jungle.eosio.cr:443
https://api.jungle.alohaeos.com:443
http://145.239.133.201:8888
http://jungle2.eosdac.io:8882
https://jungle.eosn.io:443
https://eos-jungle.eosblocksmith.io:443
http://jungle2-eos.blckchnd.com:8888
http://88.99.193.44:8888
https://jungleapi.eossweden.se:443
https://jungle.eosphere.io:443
http://jungle2.cryptolions.io:8888
http://88.99.193.44:8888
http://jungle.eosamsterdam.net:80
http://95.179.186.107:8888
http://85.214.108.53:8888
http://42.159.153.121:8888
http://121.168.149.101:8888
https://testnet-api.eosarabia.one:443
http://88.12.21.79:8888

This line should be updated. I also used the https endpoint.

EosApiRestClient eosApiRestClient = EosApiClientFactory.newInstance("https://jungle2.cryptolions.io:443").newRestClient();
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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