neo-json-rpc-client-java

JSON-RPC Client for NEO

License

License

MIT
Categories

Categories

CLI User Interface
GroupId

GroupId

com.github.swisscom-blockchain
ArtifactId

ArtifactId

neo-rpcclient
Last Version

Last Version

1.2
Release Date

Release Date

Type

Type

jar
Description

Description

neo-json-rpc-client-java
JSON-RPC Client for NEO
Project URL

Project URL

https://github.com/swisscom-blockchain/neo-json-rpc-client-java
Source Code Management

Source Code Management

https://github.com/swisscom-blockchain/neo-json-rpc-client-java

Download neo-rpcclient

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.swisscom-blockchain/neo-rpcclient/ -->
<dependency>
    <groupId>com.github.swisscom-blockchain</groupId>
    <artifactId>neo-rpcclient</artifactId>
    <version>1.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.swisscom-blockchain/neo-rpcclient/
implementation 'com.github.swisscom-blockchain:neo-rpcclient:1.2'
// https://jarcasting.com/artifacts/com.github.swisscom-blockchain/neo-rpcclient/
implementation ("com.github.swisscom-blockchain:neo-rpcclient:1.2")
'com.github.swisscom-blockchain:neo-rpcclient:jar:1.2'
<dependency org="com.github.swisscom-blockchain" name="neo-rpcclient" rev="1.2">
  <artifact name="neo-rpcclient" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.swisscom-blockchain', module='neo-rpcclient', version='1.2')
)
libraryDependencies += "com.github.swisscom-blockchain" % "neo-rpcclient" % "1.2"
[com.github.swisscom-blockchain/neo-rpcclient "1.2"]

Dependencies

compile (1)

Group / Artifact Type Version
com.github.briandilley.jsonrpc4j : jsonrpc4j jar 1.5.3

test (3)

Group / Artifact Type Version
org.hamcrest : hamcrest-all jar 1.3
org.hamcrest : hamcrest-core jar 1.3
junit : junit jar 4.11

Project Modules

There are no modules declared in this project.

Neo Json RPC Client

Java Interface to communicate with a Neo Node over JSON-RPC interface

NEO API Reference: https://github.com/neo-project/neo/wiki/API-Reference

Features

Network:

  • Basic Authentication
  • SSL and trust all certification manager

Supported JSON-RPC methods. See the changelog

Build

Building without tests

mvn clean package -DskipTests

How to use

Gradle import

compile 'com.github.swisscom-blockchain:neo-rpcclient:1.2'

Maven import

<dependency>
    <groupId>com.github.swisscom-blockchain</groupId>
    <artifactId>neo-rpcclient</artifactId>
    <version>1.2</version>
    <scope>compile</scope>
</dependency>

Plain HTTP connection or HTTPS with trusted certificate

JsonRpcHttpClient client = NeoClientUtil.create("http://your-node:22332");

NeoBlock block = neoClient.getBestBlock();

With HTTPS disabled certifcate check and Basic Authentication

JsonRpcHttpClient client = NeoClientUtil.create("https://your-node:22332");
NeoClientUtil.addBasicAuth(client, "user", "password");
NeoClientUtil.enableTrustAllCerts(client);

NeoBlock block = neoClient.getBestBlock();

Testing

For testing you need access to a Neo Node respective the JSON-RPC interface. The current setup is a Node with SSL and Basic Authentication. If you have an other setup you may adjust the test classes.

  • The tests need these system environment variables:
endpoint=<https://hostname:10332>
basicUser=<basic auth username>
basicAuth=<basic auth password>
  • In IntelliJ you can set these environment variables under
    • Run -> Edit Configuration
    • Defaults -> JUnit -> Environment Variables

Similar Projects

https://github.com/neo-ngd/neoj More functions implemented.

com.github.swisscom-blockchain

Swisscom Blockchain AG

Swisscom Blockchain provides solutions to implement blockchain technology quickly and successfully for your company.

Versions

Version
1.2
1.1
1.0