Key Connect API

API Spec and Client for Key Connect Server

License

License

Categories

Categories

KeY Data Data Formats Formal Verification
GroupId

GroupId

app.keyconnect.api
ArtifactId

ArtifactId

keyconnect-api
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

Key Connect API
API Spec and Client for Key Connect Server

Download keyconnect-api

How to add to project

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

Dependencies

compile (6)

Group / Artifact Type Version
com.squareup.okhttp3 : okhttp jar 4.8.1
com.squareup.okhttp3 : logging-interceptor jar 4.8.1
com.google.code.gson : gson jar 2.8.6
io.gsonfire : gson-fire jar 1.8.4
javax.annotation : javax.annotation-api jar 1.3.2
com.google.guava : guava jar 29.0-jre

provided (2)

Group / Artifact Type Version
org.openapitools : openapi-generator jar 5.0.0
org.openapitools : openapi-generator-maven-plugin jar 5.0.0

test (1)

Group / Artifact Type Version
junit : junit jar 4.13.1

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.

app.keyconnect.api

Key Connect

Access all blockchains from a single place

Versions

Version
1.0.0