Search…
Blockchain API
This chapter contains the resource for the devlopement - token / block APIs and useful tutorials

Get Started

Finenex provides collections of APIs that work together on the FINX platform to solve a variety of problems. Developers can build solutions using the FINX platform to meet the business needs.

Endpoint

The endpoints for Finenex services are:
Service
Endpoint
Description
Token API
API for transaction of FINX network
  • JsonRPC
Block API
API for checking block information of FINX network
  • JsonRPC
Wallet service for private key management
  • JsonRPC
Get an auth token to use the payment API
  • REST
API for Point and Payment
  • REST

JsonRPC

JSON-RPC 2.0 Specification

Protocol Error

  • 32700 : parse error. not well formed
  • 32701 : parse error. unsupported encoding
  • 32702 : parse error. invalid character for encoding
  • 32600 : server error. invalid xml-rpc. not conforming to spec.
  • 32601 : server error. requested method not found
  • 32602 : server error. invalid method parameters
  • 32603 : server error. internal xml-rpc error
  • 32500 : application error
  • 32400 : system error
  • 32300 : transport error

Service Error

1
{
2
"jsonrpc":"2.0",
3
"id":7723,
4
"result":{
5
"resultCode": "500",
6
"resultMessage": "Error Message",
7
"resultData": ""
8
}
9
}
Copied!

Address and secretKey

You can create a new privateKey in the ServerWallet by using createAddress. The createAddress returns the created address, mnemonic, and secretKey values. You can restore the private key from the archived mnemonic using importAddress.
The secretKey is used as a secret when using serverWallet. If authentication is required when using the serverWallet, the hashKey generated through hash (tempKey + "|" + secretKey) is sent to the serverWallet to authenticate using the secretKey stored inside the wallet and the delivered tempKey.
1
hashKey = CryptoUtil.getSah256(tempKey +"|" + secretKey)
Copied!

How to create a signature

When using APIs that generate transactions, such as createToken and transfer, you must create and pass a signature as a parameter. A signature can be created by calling signData. The transfer as an example. You hashed the string consisting of "fromAddress | toAddress | amount | hashKey" with sha256 and made the result into a hex string. You can get the signature value by passing this string as a parameter to signData.
1
String data = fromAddress + "|" + toAddress + "|" + amount + "|" + tempKey + "|" + hashKey;log.debug("data=" + data);
2
String hashData = CryptoUtil.getSha256(data);
3
resultMessage = tokenApiService.signData(fromAddress, hashData, tempKey, hashKey);
4
5
...
6
7
public static String getSha256(String msg) throws NoSuchAlgorithmException {
8
MessageDigest md = MessageDigest.getInstance("SHA-256");
9
md.update(msg.getBytes());
10
byte[] mdBytes = md.digest();
11
String mdStr = bytesToHex(mdBytes);
12
return mdStr;
13
}
Copied!

Sample Project

You can get sample code from github. (https://github.com/Finenex/connect-api-examples)
Last modified 1mo ago