Key Connect Server

Standalone Key Connect API Server

License

License

Categories

Categories

KeY Data Data Formats Formal Verification
GroupId

GroupId

app.keyconnect
ArtifactId

ArtifactId

keyconnect-server
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

Key Connect Server
Standalone Key Connect API Server

Download keyconnect-server

How to add to project

<!-- https://jarcasting.com/artifacts/app.keyconnect/keyconnect-server/ -->
<dependency>
    <groupId>app.keyconnect</groupId>
    <artifactId>keyconnect-server</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/app.keyconnect/keyconnect-server/
implementation 'app.keyconnect:keyconnect-server:1.0.0'
// https://jarcasting.com/artifacts/app.keyconnect/keyconnect-server/
implementation ("app.keyconnect:keyconnect-server:1.0.0")
'app.keyconnect:keyconnect-server:jar:1.0.0'
<dependency org="app.keyconnect" name="keyconnect-server" rev="1.0.0">
  <artifact name="keyconnect-server" type="jar" />
</dependency>
@Grapes(
@Grab(group='app.keyconnect', module='keyconnect-server', version='1.0.0')
)
libraryDependencies += "app.keyconnect" % "keyconnect-server" % "1.0.0"
[app.keyconnect/keyconnect-server "1.0.0"]

Dependencies

compile (11)

Group / Artifact Type Version
app.keyconnect.api : keyconnect-api jar 1.0.0
org.web3j : core jar 5.0.0
com.squareup.okhttp3 : okhttp jar 4.9.0
app.keyconnect : keyconnect-rippled-api jar 1.0.0
org.springframework.boot : spring-boot-starter-web jar 2.3.3.RELEASE
org.springframework.boot : spring-boot-starter-jetty jar 2.3.3.RELEASE
org.springframework.boot : spring-boot-starter-data-jpa jar 2.3.3.RELEASE
org.apache.commons : commons-lang3 jar 3.11
org.projectlombok : lombok jar 1.18.12
com.google.guava : guava jar 30.1-jre
org.springframework.boot : spring-boot-configuration-processor Optional jar 2.3.3.RELEASE

provided (1)

Group / Artifact Type Version
app.keyconnect.api : keyconnect-api Optional zip 1.0.0

runtime (1)

Group / Artifact Type Version
com.h2database : h2 jar 1.4.200

test (2)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-test jar 2.3.3.RELEASE
org.hamcrest : hamcrest-all jar 1.3

Project Modules

There are no modules declared in this project.

Key Connect API + Services

Key Connect API provides a single gateway to access multiple blockchains.

Services included:

  • XRP Gateway
  • ETH Gateway

Quick links

Developing with Key Connect

Key Connect SDK is available across multiple programming languages. Here are a few examples:

Java example

Import Key Connect API using standard dependency management.

<dependency>
  <groupId>app.keyconnect.api</groupId>
  <artifactId>keyconnect-api</artifactId>
  <version>1.0.0</version>
</dependency> 

Up-to-date packages available here.

Start developing!

import app.keyconnect.api.ApiClient;
import app.keyconnect.api.ApiException;
import app.keyconnect.api.client.DefaultApi;
import app.keyconnect.api.client.model.ServerStatusResponse;

class Scratch {

  public static void main(String[] args) {
    DefaultApi apiInstance = new DefaultApi(
        new ApiClient().setBasePath("https://api.keyconnect.app")
    );
    
    try {
      ServerStatusResponse result = apiInstance.getServerStatus();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling DefaultApi#getServerStatus");
      e.printStackTrace();
    }
  }
}

Running the above code should output something like:

class ServerStatusResponse {
    status: healthy
    errors: null
}

For more information about the API usage, visit the API documentation.

Developing Key Connect

Pre-requisites

Tool Version
JDK OpenJDK-11
Maven 3.6.3

*These are guide only, the application may still compile and run with higher versions.

Build

The fastest way to get a build, without running tests is to run the following command:

mvn clean install -DskipTests

If you want to run the built-in tests, which include unit and integration tests, you need to specify a few environment variables.

We recommend building using the included run-configurations for Intellij. To use the provided run-configurations, copy the included .idea-run-configurations folder to .run and import the configurations into your Intellij IDE. Make sure to set appropriate values for the following variables:

Variable Value
ETHERSCAN_TOKEN Token generated from Etherscan API
ETH_MAINNET_ADDR Http(s) Address to ethereum node. You can use infura.io if you don't have your own.
ETH_ROPSTEN_ADDR Http(s) address to ethereum node. You can use infura.io if you don't have your own.

For full customisability you can edit keyconnect-server/src/main/resources/application.yml file for any application runtime configurations, and keyconnect-server/src/test/resources/application.yml for any test configurations.

You don't need to use Intellij to compile the project. The run configurations provided above are simply for convenience. You can compile the project manually as long as you have the above variables defined in the environment.

Running the server

Development

Compile and package the source code by following the build instructions. To run the server in development mode, execute the following:

cd keyconnect-server
mvn spring-boot:run

The server will listen on port 8080 by default. Hit ctrl+c to exit and stop the server at any time.

You will need to set the environment with the aforementioned environment variables in order to use Ethereum gateway. The XRP Gateway will work without any additional configuration.

Production

Similar to development, compile and package the source code by following the build instructions.

java -DETH_MAINNET_ADDR=https://mainnet.infura.io/v3/INFURA_KEY -DETH_ROPSTEN_ADDR=https://ropsten.infura.io/v3/INFURA_KEY -DETHERSCAN_TOKEN=ETHERSCAN_TOKEN -jar keyconnect-server/target/keyconnect-server-1.0-SNAPSHOT.jar 

You can skip the -D jvm args if you don't need the ethereum gateway.

Notes

Ethereum integration

The aim of this project is to work directly with the blockchain nodes, without any third party APIs. In order to provide the functionality quicker and to test multi-blockchain integration, ethereum was integrated in two parts.

  1. All ethereum blockchain functionality available via Web3J APIs, except getTransactions (by account) and getPayments (by account)
  2. Implement getTransactions (by account) and getPayments (by account) using etherscan.io APIs

The Etherscan APIs have a 5 calls/second limit. This rate-limiting is built into the EtherscanUtil.java - the implementation for the Etherscan APIs.

In order to be in line with the goals of this project, the Etherscan integration will have to be removed. To do this, the following needs to be true:

  1. Indexed transactions data in a database
  2. Add persistence to Key Connect server

#1 is the in-progress keyconnect-chainbase module.

Versions

Version
1.0.0