web3j-openapi-server

web3j-openapi server module

License

License

GroupId

GroupId

org.web3j.openapi
ArtifactId

ArtifactId

web3j-openapi-server
Last Version

Last Version

4.8.4
Release Date

Release Date

Type

Type

jar
Description

Description

web3j-openapi-server
web3j-openapi server module
Project URL

Project URL

https://web3j.io
Source Code Management

Source Code Management

https://github.com/web3j/web3j-openapi

Download web3j-openapi-server

How to add to project

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

Dependencies

compile (2)

Group / Artifact Type Version
org.web3j.openapi : web3j-openapi-core jar 4.8.4
org.eclipse.jetty : jetty-server jar 9.4.32.v20200930

runtime (19)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-reflect jar 1.3.72
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.3.72
io.github.microutils : kotlin-logging jar 1.7.10
ch.qos.logback : logback-classic jar 1.2.3
org.slf4j : slf4j-api jar 1.7.30
org.slf4j : jul-to-slf4j jar 1.7.30
org.web3j : core jar 4.8.4
io.epirus : epirus-web3j jar 0.0.6
org.glassfish.jersey.containers : jersey-container-servlet jar 2.32
org.glassfish.jersey.media : jersey-media-json-jackson jar 2.32
org.glassfish.jersey.media : jersey-media-sse jar 2.32
org.glassfish.jersey.inject : jersey-hk2 jar 2.32
com.fasterxml.jackson.module : jackson-module-kotlin jar 2.11.3
com.fasterxml.jackson.dataformat : jackson-dataformat-yaml jar 2.11.3
com.fasterxml.jackson.dataformat : jackson-dataformat-properties jar 2.11.3
info.picocli : picocli jar 4.3.2
org.eclipse.jetty : jetty-servlet jar 9.4.32.v20200930
io.swagger.core.v3 : swagger-annotations jar 2.1.3
io.swagger.core.v3 : swagger-jaxrs2 jar 2.1.3

Project Modules

There are no modules declared in this project.

Web3j Open API

Build Status

Web3j-OpenAPI is a OpenAPI client and server generator from Solidity smart contracts. it provides a way to interact with the Ethereum blockchain via simple and intuitive HTTP requests, abstracting the coding layer. These interactions can be done using :

  • Plain HTTP requests
  • Via the Swagger-UI, which is generated with every project
  • A client application using the webj3-openapi-client implementation

The workflow can be summed in the following steps:

  • Writing a Solidity smart contract
  • Generating the corresponding OpenAPI project using Web3j-OpenAPI
  • Running the generated project as a standalone server
  • Sending HTTP requests using Swagger-UI, client application or Curl request.

Getting started with Web3j-OpenAPI

To generate an OpenAPI project using the Web3j-OpenAPI generator, you need to have the Epirus-CLI installed on your machine (Note - the Epirus CLI has replaced the Web3j CLI). It’s easy to do (for Windows instructions head here):

$ curl -L get.epirus.io | sh

Create a Hello World project

To create a base OpenAPI project using a Hello World contract, run the following :

$ epirus openapi new

You can also generate a Web3j-OpenAPI project using the Web3j-OpenAPI-gradle-plugin.

Configure the project

After having the generated project, you can use the Epirus-CLI to run it using the following command (Note: You will need to create an Epirus Account).

$ epirus login
$ epirus run rinkeby|ropsten

Alternatively, you can configure your application with the following environment variables:

$ export WEB3J_ENDPOINT=<link_to_your_Ethereum_node>
$ export WEB3J_PRIVATE_KEY=<your_private_key>
$ export WEB3J_OPENAPI_HOST=localhost
$ export WEB3J_OPENAPI_PORT=9090

Run the project

If you aren't using the Epirus-CLI, you may run the project using the following Gradle target:

$ cd <project_folder>
$ ./gradlew run

Then, you should be seeing the server logs.

Interact with the project

SwaggerUI

The easiest way to interact with the generated project is via the generated Swagger-UI which can be found on http://<host>:<port>/swagger-ui.

image

Web3j-OpenAPI client

Also, you can use our client implementation via adding the following dependency to your project:

dependencies {
    implementation "org.web3j.openapi:web3j-openapi-client:4.7.1"
}

Then, within the application:

val service = ClientService("http://localhost:9090")
val app = ClientFactory.create(<AppNameApi>::class.java, service)

// Then you have access to all the API resources
val receipt = app.contracts.contractName.deploy()

println("Deployment receipt: ${receipt.contractAddress}")

// ...

For more information, please refer to the documentation.

org.web3j.openapi

web3j

JVM language projects for working with Blockchains

Versions

Version
4.8.4
4.8.3
4.8.2
4.8.1
4.8.0
4.7.0
4.6.4
0.1.1
0.1.0
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1