Information
Track(s) :- Theta Metachain
Access to Project:- https://github.com/devgoks/Theta-Rpc-API-Java-SDK/
Inspiration
The inspiration behind Theta_RPC_API_Java_SDK is to provide a Java-based SDK for developers to access the Theta blockchain network easily and efficiently. I discovered Theta BlockChain had Javascript SDK, So It inspired me to create an SDK for Java. A large percentage of developers use Java. This project will save them hours of work trying to integrate Theta APIs from scratch with Java. They can now integrate Theta APIs in seconds with less than 20 lines of code. Sample usage of this Java SDK to access one of Theta RPC Endpoints
Add the dependency to your Pom file:
<dependency>
<groupId>io.github.devgoks</groupId>
<artifactId>theta-rpc-api-java-sdk</artifactId>
<version>1.0.0</version>
</dependency>
Sample usage in your codebase:
Theta RPC GetVersion
ThetaRequest<Object> request = new ThetaRequest<>();
request.setJsonRpc("2.0");
request.setMethod("theta.GetVersion");
request.setId(1);
request.setParams(Collections.emptyList());
ThetaResponse<GetVersionResult> response = ThetaRPCService.request("http://localhost:16888/rpc", request,
new ParameterizedTypeReference<ThetaResponse<GetVersionResult>>(){});
System.out.println(response.toString());
ThetaCli RPC Send (Tx APIs)
ThetaRequest<SendParam> request = new ThetaRequest<>();
request.setJsonRpc("2.0");
request.setMethod("thetacli.Send");
request.setId(1);
SendParam param = new SendParam();
param.setChainId("privatenet");
param.setFrom("0x2E833968E5bB786Ae419c4d13189fB081Cc43bab");
param.setTo("0xA47B89c94a50C32CEACE9cF64340C4Dce6E5EcC6");
param.setThetaWei("99000000000000000000");
param.setTFuelWei("88000000000000000000");
param.setFee("1000000000000");
param.setSequence("6");
param.setAsync(true);
request.setParams(Collections.singletonList(param));
ThetaResponse<SendResult> response = ThetaRPCService.request("http://localhost:16889/rpc", request,
new ParameterizedTypeReference<ThetaResponse<SendResult>>(){});
System.out.println(response.toString());
See Code Samples for all Theta RPC APIs and ThetaCli RPC APIs in our GitHub repo readme using the URL below
https://github.com/devgoks/Theta-Rpc-API-Java-SDK/#readme
What it does
The Theta_RPC_API_Java_SDK is a Java-based software development kit (SDK) that allows developers to interact with the Theta blockchain RPC APIs. With the SDK, developers can perform various operations such as getting the current version of the Theta node, retrieving information on blocks and transactions, getting pending transactions, broadcasting raw transactions, etc. This Java SDK contains all Theta RPC APIs in this documentation https://docs.thetatoken.org/docs/rpc-api-reference
How we built it
The Theta_RPC_API_Java_SDK was built using Java and the Spring Boot framework. The SDK is available as a Maven dependency, which can be added to a Java project's POM file. The SDK also uses the Jackson JSON library for parsing JSON data. This SDK contains Request and Response classes needed for the APIs. This Java SDK has been deployed to maven central to make it accessible to all Java developers globally.
Challenges we ran into
One of the main challenges faced during the development of the Theta_RPC_API_Java_SDK was ensuring that the SDK was compatible with the Theta RPC APIs and that it could handle errors and exceptions correctly. Another challenge was to ensure that the SDK was efficient and easy to use for developers.
Accomplishments that we're proud of
The Theta_RPC_API_Java_SDK is an efficient and easy-to-use SDK that allows developers to interact with the Theta blockchain network seamlessly. The SDK has gone through rigorous testing to ensure that it works correctly and is reliable. The SDK is also available as an open-source project, which allows developers to contribute to its development and make it even better.
What we learned
During the development of the Theta_RPC_API_Java_SDK, we learned how to interact with the Theta RPC APIs using Java and how to create an SDK that is easy to use for developers. We also learned about the challenges of developing a blockchain SDK and how to ensure that the SDK is reliable and efficient.
What's next for Theta RPC APIs Java SDK
The next steps for the Theta_RPC_API_Java_SDK include adding more features to the SDK. Finally, the SDK will continue to be maintained and improved to ensure that it remains an efficient and reliable tool for developers to interact with the Theta blockchain network.
Built With
- api
- blockchain
- http
- java
- springboot
- theta





Log in or sign up for Devpost to join the conversation.