Key Connect Chainbase

Blockchain Indexing Service for Key Connect

License

License

Categories

Categories

KeY Data Data Formats Formal Verification
GroupId

GroupId

app.keyconnect
ArtifactId

ArtifactId

keyconnect-chainbase
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

Key Connect Chainbase
Blockchain Indexing Service for Key Connect

Download keyconnect-chainbase

How to add to project

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

Dependencies

compile (8)

Group / Artifact Type Version
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-data-jpa jar 2.3.3.RELEASE
org.postgresql : postgresql jar 42.2.18
org.xerial : sqlite-jdbc jar 3.25.2
com.zsoltfabok : sqlite-dialect jar 1.0
org.springframework.boot : spring-boot-starter-logging jar 2.3.3.RELEASE

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.18.12

test (2)

Group / Artifact Type Version
com.h2database : h2 jar 1.4.200
org.springframework.boot : spring-boot-starter-test jar 2.3.3.RELEASE

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

Key Connect

Access all blockchains from a single place

Versions

Version
1.0.0