Giter VIP home page Giter VIP logo

erc20-rest-service's Introduction

ERC-20 RESTful service

This application provides a RESTful service for creating and managing ERC-20 tokens. It has been built using Spring Boot, and web3j.

It works with both Geth, Parity, and Quorum.

For Quorum, the RESTful semantics are identical, with the exception that if you wish to create a private transaction, you populate a HTTP header name privateFor with a comma-separated list of public keys

Build

To build a runnable jar file:

./gradlew clean build

Run

Using Java 1.8+:

java -jar build/libs/azure-demo-0.1.jar 

By default the application will log to a file named erc20-web3j.log.

Configuration

The following default properties are used in the application:

# Port for service to bind to
port=8080
# Log file path and name
logging.file=logs/erc20-rest-service.log

# Endpoint of an Ethereum or Quorum node we wish to use. 
# To use IPC simply provide a file path to the socket, such as /path/to/geth.ipc
nodeEndpoint=http://localhost:22000
# The Ethereum or Quorum address we wish to use when transacting.
# Note - this address must be already unlocked in the client
fromAddress=0xed9d02e382b34818e88b88a309c7fe71e65f419d

You can override any of these properties by creating a file name application.properties in the root directory of your application, or in config/application.properties relative to your root. If you'd rather use yaml, simply change the filename to application.yml.

Usage

All available application endpoints are documented using Swagger.

You can view the Swagger UI at http://localhost:8080/swagger-ui.html. From here you can perform all POST and GET requests easily to facilitate deployment of, transacting with, and querying state of ERC-20 tokens.

alt text

Docker

We can use Docker to easily spin up a arbritrary instance of our service connecting to an already running Ethereum or Quorum network.

All you need to do is build the Dockerfile:

docker build -f docker/Dockerfile -t blk-io/erc20-service .

Then either run it with default configuration:

docker run -p 8080:8080 -v "$PWD/logs":/logs blk-io/erc20-service

Or with a custom configuration:

export PORT=8081
docker run -p ${PORT}:${PORT} -v "$PWD/logs":/logs \
    -e ENDPOINT="http://localhost:22001" \
    -e FROMADDR="0xca843569e3427144cead5e4d5999a3d0ccf92b8e" \
    -e PORT="$PORT" \
    blk-io/erc20-service

erc20-rest-service's People

Contributors

conor10 avatar johnchanguk avatar sebaraba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

erc20-rest-service's Issues

Have to run Spring Boot RESTful server on the same machine with full node?

If I add a new api /newAddress to the Controller.java, and this API makes use of WalletUtils.generateFullNewWalletFile(), then I realize that my RESTful server have to access the keystore directory, which means my RESTful server has to run on the full node, am I correct?

    @RequestMapping(value = "/newAddress")
    String newAccount() throws Exception {
        // wallet file is named like `UTC--2018-03-16T05-09-05.79000000Z--3ae52004fd3e16c3b70b92ca0a9b382c786bf27e.json`
        String walletFileName = WalletUtils.generateFullNewWalletFile(getEncryptPassphrase(),
                new File(getKeystoreDir()));
        // in which `3ae52004fd3e16c3b70b92ca0a9b382c786bf27e` is address
        String[] fetchAddress = walletFileName.split("--");
        String address = "0x" + fetchAddress[fetchAddress.length-1].split("\\.")[0];
        return address;
    }

TransferErc20 problem

image

image

flow the picture , the 0x1148394b5b8db872de076d52dccc6ec225f50efe is my ETH address,and the 0xf55041bc0ebe25af71df305a1a5131770cf6de1f is SmartContract ,when I debug the Scan process, I fund the same trade hash,but form to parm was different ,why ? please tell me ,thx!!

1

1

The deploy API Problem

Hello, when I prepare use deploy function API ,I have a problem, the arg"privateFor" I understand ContractSpecification this bean args , can you explan more detail about the arg "privateFor" ?? I appreciate it.

Services not Working

I have installed erc20-rest services and also started the Swagger UI . But the services are not woking. Getting the below error.

<title>404 Not Found</title>

404 Not Found


nginx/1.10.3 (Ubuntu)

While firing the curl statement directly also it is giving the error as below:

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Fri Nov 03 13:08:48 UTC 2017
There was an unexpected error (type=Not Acceptable, status=406).
Could not find acceptable representation
root@

What is the issue .Please help.

Services Not Working

While executing the 'deploy' api the below response is coming. How do I test the service?

Response Body
{
  "timestamp": 1523096102176,
  "status": 500,
  "error": "Internal Server Error",
  "exception": "java.lang.RuntimeException",
  "message": "java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:22000",
  "path": "/deploy"
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.