Hi all, I did not find this in documentation so sharing this. instead of running a node and using that node to post the transaction, create purestake login and get API key. Use it within java sdk.
private static AlgodApi getAlgodApi()
{
final String ALGOD_API_ADDR = "https://mainnet-algorand.api.purestake.io/ps1";
final String PS_API_TOKEN = "XXXXXXXXXXXXXXXXX";
//Create an instance of the algod API client
AlgodClient client = (AlgodClient) new AlgodClient().setBasePath(ALGOD_API_ADDR);
return new AlgodApi(client.addDefaultHeader("x-api-key", PS_API_TOKEN));
}
Thanks Tim. Not sure what ALGOD_API_TOKEN to use here? It worked for me without ALGOD_API_TOKEN by simply passing Purestake API TOKEN in the defaultheader.
final String ALGOD_API_TOKEN = “”;
api_key.setApiKey(ALGOD_API_TOKEN);
For benefit of other users: Anyone following the developer Doc SDK examples can easily by-pass the step on creating a dedicated node and rather use Purestake API to submit transaction and display transaction. Dedicated node instance is only required if you are going to play with KMD (key management daemon).