# Authentication API

This document explains how to use Authentication APIs. Authentication APIs use HTTP POST protocol and send and receive messages in JSON format.

## Endpoint

> **Real Server :** [**https://auth.finenex.net/v2**](https://auth.finenex.net/v2)
>
> **Test Server :** [**https://test-auth.finenex.net/v2**](https://test-auth.finenex.net/v2)

## API References

### Authenticate

Log in using your ID and password.

{% openapi src="/files/6b2YsvYVWqaNb0xcSpOv" path="/auth/auth-user" method="post" %}
[pos-auth.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2F7hSOMIww0qRCa8ClSYPH%2Fpos-auth.yaml?alt=media\&token=b1d46fab-41de-454d-9d21-3c8adf130e91)
{% endopenapi %}

* `userType` is ignored. Currently it is not used.
* You can authenticate through `id` and `password`.
* If there is a `token` value, the token validity period can be extended.
* If successful, you get a new JWT `token`. It also receives basic user information, such as user `name`, `userId`, `telNo`, and `email`.

#### Example

{% tabs %}
{% tab title="Request" %}

```bash
curl -X 'POST' \
  '{endpoint}/auth/auth-user' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "id": "test",
  "password": "1111"
}'
```

{% endtab %}

{% tab title="Response" %}

```json
{
  "token": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0Iiwicm9sZSI6IlJPTEVfVVNFUiIsImV4cCI6MTY2ODc3ODEwMCwidXNlciI6IjQ3MDA2MDM2NDRCNzAwMDQiLCJpYXQiOjE2NjYxODYxMDB9.QQ_J1KMG58wG5D4THOCoXHqQVNd2SQ8jXqwpUnqmavY",
  "userId": "test",
  "name": "Test User",
  "telNo": "12345678",
  "email": ""
}
```

{% endtab %}
{% endtabs %}

Log in using your VP (Verifiable Presentation).

{% openapi src="/files/6b2YsvYVWqaNb0xcSpOv" path="/auth/auth-user-with-vp" method="post" %}
[pos-auth.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2F7hSOMIww0qRCa8ClSYPH%2Fpos-auth.yaml?alt=media\&token=b1d46fab-41de-454d-9d21-3c8adf130e91)
{% endopenapi %}

* Put the VP body in `vp`.
* In case of the application's own login, `requestId` is not needed. `requestId` is required for web site login. When the web site shows the QR code through the browser, the user application reads this value, puts it in the `requetId`, and calls this API to log in to the web site.
* If successful, you get a new JWT `token`. It also receives basic user information, such as user `name`, `userId`, `telNo`, and `email`.

#### Example

{% tabs %}
{% tab title="Request" %}

```bash
curl -X 'POST' \
  '{endpoint}/auth/auth-user-with-vp' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "vp": {
    "verifiableCredential" : [ {
      "credentialSubject" : {
        "name" : "asd",
        "phone" : "432-4324",
        "sub" : "01022223333",
        "id" : "did:ethr:0xb80a41cd53c3a42faa5a5f58e61909e50df811e0"
      },
      "issuer" : {
        "id" : "did:ethr:0xd284cdc964af8a01d82d0caa7deeba82785b54f4"
      },
      "type" : [ "VerifiableCredential", "Profile" ],
      "@context" : [ "https://www.w3.org/2018/credentials/v1" ],
      "issuanceDate" : "2022-10-18T09:14:22.000Z",
      "proof" : {
        "type" : "JwtProof2020",
        "jwt" : "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiUHJvZmlsZSJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJuYW1lIjoiYXNkIiwicGhvbmUiOiI0MzItNDMyNCIsInN1YiI6IjAxMDIyMjIzMzMzIn19LCJzdWIiOiJkaWQ6ZXRocjoweGI4MGE0MWNkNTNjM2E0MmZhYTVhNWY1OGU2MTkwOWU1MGRmODExZTAiLCJuYmYiOjE2NjYwODQ0NjIsImlzcyI6ImRpZDpldGhyOjB4ZDI4NGNkYzk2NGFmOGEwMWQ4MmQwY2FhN2RlZWJhODI3ODViNTRmNCJ9.PqUOVrxFI8Bmt2UKjJ2oF6oFNkV_0s9xzJczPwkDf8_fueJdBoK3OuOKnWPfS-wgSDTDMpyNlf_m27DoxvA1pA"
      }
    } ],
    "holder" : "did:ethr:0xb80a41cd53c3a42faa5a5f58e61909e50df811e0",
    "verifier" : [ "did:ethr:0xd284cdc964af8a01d82d0caa7deeba82785b54f4" ],
    "type" : [ "VerifiablePresentation", "VerifiableCredential", "Profile" ],
    "@context" : [ "https://www.w3.org/2018/credentials/v1" ],
    "issuanceDate" : "2022-10-18T09:14:26.000Z",
    "proof" : {
      "type" : "JwtProof2020",
      "jwt" : "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2cCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVQcmVzZW50YXRpb24iLCJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIlByb2ZpbGUiXSwidmVyaWZpYWJsZUNyZWRlbnRpYWwiOlsiZXlKaGJHY2lPaUpGVXpJMU5rc2lMQ0owZVhBaU9pSktWMVFpZlEuZXlKMll5STZleUpBWTI5dWRHVjRkQ0k2V3lKb2RIUndjem92TDNkM2R5NTNNeTV2Y21jdk1qQXhPQzlqY21Wa1pXNTBhV0ZzY3k5Mk1TSmRMQ0owZVhCbElqcGJJbFpsY21sbWFXRmliR1ZEY21Wa1pXNTBhV0ZzSWl3aVVISnZabWxzWlNKZExDSmpjbVZrWlc1MGFXRnNVM1ZpYW1WamRDSTZleUp1WVcxbElqb2lZWE5rSWl3aWNHaHZibVVpT2lJME16SXRORE15TkNJc0luTjFZaUk2SWpBeE1ESXlNakl6TXpNekluMTlMQ0p6ZFdJaU9pSmthV1E2WlhSb2Nqb3dlR0k0TUdFME1XTmtOVE5qTTJFME1tWmhZVFZoTldZMU9HVTJNVGt3T1dVMU1HUm1PREV4WlRBaUxDSnVZbVlpT2pFMk5qWXdPRFEwTmpJc0ltbHpjeUk2SW1ScFpEcGxkR2h5T2pCNFpESTROR05rWXprMk5HRm1PR0V3TVdRNE1tUXdZMkZoTjJSbFpXSmhPREkzT0RWaU5UUm1OQ0o5LlBxVU9WcnhGSThCbXQyVUtqSjJvRjZvRk5rVl8wczl4ekpjelB3a0RmOF9mdWVKZEJvSzNPdU9LbldQZlMtd2dTRFRETXB5TmxmX20yN0RveHZBMXBBIl19LCJuYmYiOjE2NjYwODQ0NjYsImlzcyI6ImRpZDpldGhyOjB4YjgwYTQxY2Q1M2MzYTQyZmFhNWE1ZjU4ZTYxOTA5ZTUwZGY4MTFlMCIsImF1ZCI6WyJkaWQ6ZXRocjoweGQyODRjZGM5NjRhZjhhMDFkODJkMGNhYTdkZWViYTgyNzg1YjU0ZjQiXX0.fLwCJfdJdtZDtAm8jipG7EJ_Qyrv-03XmwGWnWOhyGg_XNFKX4K271HB2zkTIUbcbU8VavjlWMNlkuwEiV8Kog"
    }
  }
}'
```

{% endtab %}

{% tab title="Response" %}

```json
{
  "token": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIwMTAyMjIyMzMzMyIsInJvbGUiOiJST0xFX1VTRVIiLCJleHAiOjE2Njg3Nzg5NzAsInVzZXIiOiI0NzAwNjBFRkNCRUMwMDJDIiwiaWF0IjoxNjY2MTg2OTcwfQ.h9bMc-mmswRcI8vLfl1E-a65hcIvqdKikcj_50ZOI8k",
  "userId": "01022223333",
  "name": "test1",
  "telNo": "01022223333",
  "email": ""
}
```

{% endtab %}
{% endtabs %}

The following **auth-user-by-app**, **cancel-auth-user-by-app**, and **auth-user-result-by-app** are provided for web site login. These APIs are used by the web server script.

<figure><img src="https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2Fgit-blob-f6ecca2a42b3de4d5bf013bd532a2cae6004c8e3%2Fimage.png?alt=media&amp;token=5fb867b1-ffec-4090-b806-da60b1fce3b1" alt=""><figcaption></figcaption></figure>

Request DID login.

{% openapi src="/files/6b2YsvYVWqaNb0xcSpOv" path="/auth/auth-user-by-app" method="post" %}
[pos-auth.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2F7hSOMIww0qRCa8ClSYPH%2Fpos-auth.yaml?alt=media\&token=b1d46fab-41de-454d-9d21-3c8adf130e91)
{% endopenapi %}

* `requestId` is an identifier that identifies the web site. In general, you can use the site URL + "?".
* `waitTime` is the maximum waiting time for login.
* If successful, new `requestId` is issued. This value should be used to check if a user is logged in by the user application.

#### Example

{% tabs %}
{% tab title="Request" %}

```bash
curl -X 'POST' \
  '{endpoint}/auth/auth-user-by-app' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "requestId": "https://my.domain?",
  "waitTime": 60
}'
```

{% endtab %}

{% tab title="Response" %}

```json
{
  "requestId": "https://my.domain?requestId=1666327791844_5954",
  "waitTime": 60
}
```

{% endtab %}
{% endtabs %}

Cancel the authentication request.

{% openapi src="/files/6b2YsvYVWqaNb0xcSpOv" path="/auth/cancel-auth-user-by-app" method="post" %}
[pos-auth.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2F7hSOMIww0qRCa8ClSYPH%2Fpos-auth.yaml?alt=media\&token=b1d46fab-41de-454d-9d21-3c8adf130e91)
{% endopenapi %}

* `requestId` is the id you want to cancel.
* `waitTime` is ignored.

#### Example

{% tabs %}
{% tab title="Request" %}

```bash
curl -X 'POST' \
  '{endpoint}/auth/cancel-auth-user-by-app' \
  -H 'accept: */*' \
  -H 'Content-Type: application/json' \
  -d '{
  "requestId": "https://my.domain?requestId=1666328121807_6979"
}'
```

{% endtab %}

{% tab title="Response" %}

```
200 OK.
```

{% endtab %}
{% endtabs %}

Check whether the login was successful.

{% openapi src="/files/6b2YsvYVWqaNb0xcSpOv" path="/auth/auth-user-result-by-app" method="post" %}
[pos-auth.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2F7hSOMIww0qRCa8ClSYPH%2Fpos-auth.yaml?alt=media\&token=b1d46fab-41de-454d-9d21-3c8adf130e91)
{% endopenapi %}

* `requestId` is the ID that checks the login success response.
* `waitTime` is ignored.
* If successful, you get a new JWT `token`. It also receives basic user information, such as user `name`, `userId`, `telNo`, and `email`.
* If there is no request or the request time is old, a 400 error occurs.
* If you're waiting for a response from your app, you'll get a 401 error.

#### Example

{% tabs %}
{% tab title="Request" %}

```bash
curl -X 'POST' \
  '{endpoint}/auth/auth-user-result-by-app' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "requestId": "https://my.domain?requestId=1666328121807_6979"
}'
```

{% endtab %}

{% tab title="Response" %}
Never requested:

```json
{
  "error": {
    "code": "400",
    "message": "Never requested or timeout"
  }
}
```

Waiting for response from user app:

```json
{
  "error": {
    "code": "401",
    "message": "Wait for response from user app"
  }
}
```

Log in normally:

```json
{
  "token": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI3MDA1NTUwMDAyIiwicm9sZSI6IlJPTEVfVVNFUiIsImV4cCI6MTY2Njc2MDYzMiwidXNlciI6IjQ3MDA2MzRGQjBGNDAwMUQiLCJpYXQiOjE2NjYzMjg2MzJ9.ltpfbFuoWEtOJRXZLAyvh5T2ZhG4g1GPjr-VwKF1AMk",
  "userId": "7005550002",
  "name": "dhjeon",
  "telNo": null,
  "email": "aaa0002@a.com"
}
```

{% endtab %}
{% endtabs %}

### DID (Decentralized Identifier)

Create your DID.

{% openapi src="/files/6b2YsvYVWqaNb0xcSpOv" path="/did/create-did" method="post" %}
[pos-auth.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2F7hSOMIww0qRCa8ClSYPH%2Fpos-auth.yaml?alt=media\&token=b1d46fab-41de-454d-9d21-3c8adf130e91)
{% endopenapi %}

* `alias` is an alias for identifying a DID.
* Use the `address` and `secretKey` that came out when you create the address to authenticate yourself.

#### Example

{% tabs %}
{% tab title="Request" %}

```bash
curl -X 'POST' \
  '{endpoint}/did/create-did' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "alias": "4700634FB09E0019",
  "address": "0x38b45217e81548733f9fd7443ecfe4ea6b5725cf",
  "secretKey": "a728102d411b1871f7ae91505b4e1558"
}'
```

{% endtab %}

{% tab title="Response" %}

```json
{
  "controllerKeyId": "0x38b45217e81548733f9fd7443ecfe4ea6b5725cf",
  "provider": "did:ethr",
  "keys": [
    {
      "kid": "0x38b45217e81548733f9fd7443ecfe4ea6b5725cf",
      "kms": "...",
      "type": "Secp256k1",
      "publicKeyHex": "0x38b45217e81548733f9fd7443ecfe4ea6b5725cf",
      "privateKeyHex": "",
      "meta": {
        "algorithms": [
          "ES256K",
          "ES256K-R",
          "eth_signTransaction",
          "eth_signTypedData",
          "eth_signMessage"
        ],
        "secretKey": "a728102d411b1871f7ae91505b4e1558"
      }
    }
  ],
  "alias": "4700634FB09E0019",
  "services": [],
  "did": "did:ethr:0x38b45217e81548733f9fd7443ecfe4ea6b5725cf"
}
```

{% endtab %}
{% endtabs %}

Create your VCs (Verifiable Credential).

Because this is the credentials used by this system, the JWT authenticated by /auth/auth-user in advance is required.

{% openapi src="/files/6b2YsvYVWqaNb0xcSpOv" path="/did/create-vc" method="post" %}
[pos-auth.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2F7hSOMIww0qRCa8ClSYPH%2Fpos-auth.yaml?alt=media\&token=b1d46fab-41de-454d-9d21-3c8adf130e91)
{% endopenapi %}

* `holder` is your issued DID.
* `issuer` is the issuer DID provided by this authentication system.
* Provides additional information to `userInfo` in key/value format.
* If successful, you will get your VC.

#### Example

{% tabs %}
{% tab title="Request" %}

```bash
curl -X 'POST' \
  '{endpoint}/did/create-vc' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0Iiwicm9sZSI6IlJPTEVfVVNFUiIsImV4cCI6MTY2ODkyMzY5MSwidXNlciI6IjQ3MDA2MDM2NDRCNzAwMDQiLCJpYXQiOjE2NjYzMzE2OTF9.c2BMNGbTUNV6HQAIBy9nHOTEK8nZOex1r-ntO3KLlNY' \
  -H 'Content-Type: application/json' \
  -d '{
  "holder": "did:ethr:0x38b45217e81548733f9fd7443ecfe4ea6b5725cf",
  "issuer": "did:ethr:0xd284cdc964af8a01d82d0caa7deeba82785b54f4",
  "userInfo": {
     "name": "Hong"
  }
}'
```

{% endtab %}

{% tab title="Response" %}

```json
{
  "credentialSubject": {
    "name": "Hong",
    "sub": "test",
    "id": "did:ethr:0x38b45217e81548733f9fd7443ecfe4ea6b5725cf"
  },
  "issuanceDate": "2022-10-21T05:56:06.000Z",
  "proof": {
    "type": "JwtProof2020",
    "jwt": "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiUHJvZmlsZSJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJuYW1lIjoiSG9uZyIsInN1YiI6InRlc3QifX0sInN1YiI6ImRpZDpldGhyOjB4MzhiNDUyMTdlODE1NDg3MzNmOWZkNzQ0M2VjZmU0ZWE2YjU3MjVjZiIsIm5iZiI6MTY2NjMzMTc2NiwiaXNzIjoiZGlkOmV0aHI6MHhkMjg0Y2RjOTY0YWY4YTAxZDgyZDBjYWE3ZGVlYmE4Mjc4NWI1NGY0In0.IvrseTkX-lnadHg7TrPcBaTC5utYIr72nbQRgdNS_jwSPy4fypUxu7_2xaJw1IqHy71-uTp1B52hAz7ZeRb89g"
  },
  "type": [
    "VerifiableCredential",
    "Profile"
  ],
  "@context": [
    "https://www.w3.org/2018/credentials/v1"
  ],
  "issuer": {
    "id": "did:ethr:0xd284cdc964af8a01d82d0caa7deeba82785b54f4"
  }
}
```

{% endtab %}
{% endtabs %}

Verify the VC.

{% openapi src="/files/6b2YsvYVWqaNb0xcSpOv" path="/did/verify-vc" method="post" %}
[pos-auth.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2F7hSOMIww0qRCa8ClSYPH%2Fpos-auth.yaml?alt=media\&token=b1d46fab-41de-454d-9d21-3c8adf130e91)
{% endopenapi %}

* The `body` of the request has the VC.
* If successful, `verified` is true.

#### Example

{% tabs %}
{% tab title="Request" %}

```bash
curl -X 'POST' \
  '{endpoint}/did/verify-vc' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "credentialSubject": {
    "name": "Hong",
    "sub": "test",
    "id": "did:ethr:0x38b45217e81548733f9fd7443ecfe4ea6b5725cf"
  },
  "issuanceDate": "2022-10-21T05:56:06.000Z",
  "proof": {
    "type": "JwtProof2020",
    "jwt": "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiUHJvZmlsZSJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJuYW1lIjoiSG9uZyIsInN1YiI6InRlc3QifX0sInN1YiI6ImRpZDpldGhyOjB4MzhiNDUyMTdlODE1NDg3MzNmOWZkNzQ0M2VjZmU0ZWE2YjU3MjVjZiIsIm5iZiI6MTY2NjMzMTc2NiwiaXNzIjoiZGlkOmV0aHI6MHhkMjg0Y2RjOTY0YWY4YTAxZDgyZDBjYWE3ZGVlYmE4Mjc4NWI1NGY0In0.IvrseTkX-lnadHg7TrPcBaTC5utYIr72nbQRgdNS_jwSPy4fypUxu7_2xaJw1IqHy71-uTp1B52hAz7ZeRb89g"
  },
  "type": [
    "VerifiableCredential",
    "Profile"
  ],
  "@context": [
    "https://www.w3.org/2018/credentials/v1"
  ],
  "issuer": {
    "id": "did:ethr:0xd284cdc964af8a01d82d0caa7deeba82785b54f4"
  }
```

{% endtab %}

{% tab title="Response" %}

```json
{
  "didResolutionResult": {
    "didDocumentMetadata": {},
    "didResolutionMetadata": {
      "contentType": "application/did+ld+json"
    },
    "didDocument": {
      "@context": [
        "https://www.w3.org/ns/did/v1",
        "https://w3id.org/security/suites/secp256k1recovery-2020/v2"
      ],
      "id": "did:ethr:0xd284cdc964af8a01d82d0caa7deeba82785b54f4",
      "verificationMethod": [
        {
          "id": "did:ethr:0xd284cdc964af8a01d82d0caa7deeba82785b54f4#controller",
          "type": "EcdsaSecp256k1RecoveryMethod2020",
          "controller": "did:ethr:0xd284cdc964af8a01d82d0caa7deeba82785b54f4",
          "blockchainAccountId": "eip155:1:0xd284CDC964aF8a01d82D0cAA7DeeBA82785B54f4"
        }
      ],
      "authentication": [
        "did:ethr:0xd284cdc964af8a01d82d0caa7deeba82785b54f4#controller"
      ],
      "assertionMethod": [
        "did:ethr:0xd284cdc964af8a01d82d0caa7deeba82785b54f4#controller"
      ]
    }
  },
  "payload": {
    "vc": {
      "@context": [
        "https://www.w3.org/2018/credentials/v1"
      ],
      "type": [
        "VerifiableCredential",
        "Profile"
      ],
      "credentialSubject": {
        "name": "Hong",
        "sub": "test"
      }
    },
    "sub": "did:ethr:0x38b45217e81548733f9fd7443ecfe4ea6b5725cf",
    "nbf": 1666331766,
    "iss": "did:ethr:0xd284cdc964af8a01d82d0caa7deeba82785b54f4"
  },
  "jwt": "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiUHJvZmlsZSJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJuYW1lIjoiSG9uZyIsInN1YiI6InRlc3QifX0sInN1YiI6ImRpZDpldGhyOjB4MzhiNDUyMTdlODE1NDg3MzNmOWZkNzQ0M2VjZmU0ZWE2YjU3MjVjZiIsIm5iZiI6MTY2NjMzMTc2NiwiaXNzIjoiZGlkOmV0aHI6MHhkMjg0Y2RjOTY0YWY4YTAxZDgyZDBjYWE3ZGVlYmE4Mjc4NWI1NGY0In0.IvrseTkX-lnadHg7TrPcBaTC5utYIr72nbQRgdNS_jwSPy4fypUxu7_2xaJw1IqHy71-uTp1B52hAz7ZeRb89g",
  "verified": true,
  "policies": {},
  "issuer": "did:ethr:0xd284cdc964af8a01d82d0caa7deeba82785b54f4",
  "signer": {
    "id": "did:ethr:0xd284cdc964af8a01d82d0caa7deeba82785b54f4#controller",
    "type": "EcdsaSecp256k1RecoveryMethod2020",
    "controller": "did:ethr:0xd284cdc964af8a01d82d0caa7deeba82785b54f4",
    "blockchainAccountId": "eip155:1:0xd284CDC964aF8a01d82D0cAA7DeeBA82785B54f4"
  },
  "verifiableCredential": {
    "credentialSubject": {
      "name": "Hong",
      "sub": "test",
      "id": "did:ethr:0x38b45217e81548733f9fd7443ecfe4ea6b5725cf"
    },
    "issuer": {
      "id": "did:ethr:0xd284cdc964af8a01d82d0caa7deeba82785b54f4"
    },
    "type": [
      "VerifiableCredential",
      "Profile"
    ],
    "@context": [
      "https://www.w3.org/2018/credentials/v1"
    ],
    "issuanceDate": "2022-10-21T05:56:06.000Z",
    "proof": {
      "type": "JwtProof2020",
      "jwt": "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiUHJvZmlsZSJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJuYW1lIjoiSG9uZyIsInN1YiI6InRlc3QifX0sInN1YiI6ImRpZDpldGhyOjB4MzhiNDUyMTdlODE1NDg3MzNmOWZkNzQ0M2VjZmU0ZWE2YjU3MjVjZiIsIm5iZiI6MTY2NjMzMTc2NiwiaXNzIjoiZGlkOmV0aHI6MHhkMjg0Y2RjOTY0YWY4YTAxZDgyZDBjYWE3ZGVlYmE4Mjc4NWI1NGY0In0.IvrseTkX-lnadHg7TrPcBaTC5utYIr72nbQRgdNS_jwSPy4fypUxu7_2xaJw1IqHy71-uTp1B52hAz7ZeRb89g"
    }
  }
}
```

{% endtab %}
{% endtabs %}

Create your VP (Verifiable Presentation).

{% openapi src="/files/6b2YsvYVWqaNb0xcSpOv" path="/did/create-vp" method="post" %}
[pos-auth.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2F7hSOMIww0qRCa8ClSYPH%2Fpos-auth.yaml?alt=media\&token=b1d46fab-41de-454d-9d21-3c8adf130e91)
{% endopenapi %}

* `holder` is your DID.
* `verifier` is the verifier DID provided by this authentication system.
* `credentials` contains a list of VCs.
* If succesful, your VP is created.

#### Example

{% tabs %}
{% tab title="Request" %}

```bash
curl -X 'POST' \
  '{endpoint}/did/create-vp' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "holder": "did:ethr:0xa54545a4e45cf5a229438695c6bea23c5d1414c9",
  "verifier": "did:ethr:0xd284cdc964af8a01d82d0caa7deeba82785b54f4",
  "credentials": [
  {
    "credentialSubject" : {
      "userId" : "sus",
      "name" : "ss",
      "phone" : "019-3992-6444",
      "birthdate" : "2022-10-19",
      "dRegNumber" : "ss",
      "sub" : "7005550002",
      "id" : "did:ethr:0xa54545a4e45cf5a229438695c6bea23c5d1414c9"
    },
    "issuer" : {
      "id" : "did:ethr:0xa3bbf50a3c3a4180521325cb99ea301142b3634e"
    },
    "type" : [ "VerifiableCredential", "Profile" ],
    "@context" : [ "https://www.w3.org/2018/credentials/v1" ],
    "issuanceDate" : "2022-10-19T10:42:13.000Z",
    "proof" : {
      "type" : "JwtProof2020",
      "jwt" : "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiUHJvZmlsZSJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJ1c2VySWQiOiJzdXMiLCJuYW1lIjoic3MiLCJwaG9uZSI6IjAxOS0zOTkyLTY0NDQiLCJiaXJ0aGRhdGUiOiIyMDIyLTEwLTE5IiwiZFJlZ051bWJlciI6InNzIiwic3ViIjoiNzAwNTU1MDAwMiJ9fSwic3ViIjoiZGlkOmV0aHI6MHhhNTQ1NDVhNGU0NWNmNWEyMjk0Mzg2OTVjNmJlYTIzYzVkMTQxNGM5IiwibmJmIjoxNjY2MTc2MTMzLCJpc3MiOiJkaWQ6ZXRocjoweGEzYmJmNTBhM2MzYTQxODA1MjEzMjVjYjk5ZWEzMDExNDJiMzYzNGUifQ.LrTCG_SPXE-qpicQvTlaw666cmDpsZEILPpCAVRMBbjB-Yp-GMY0arqTxgc0rTRD3XlXV57JhCkZKYBZ261Dxg"
    }
  }  
  ]
}'
```

{% endtab %}

{% tab title="Response" %}

```json
{
  "issuanceDate": "2022-10-21T06:16:23.000Z",
  "verifier": [
    "did:ethr:0xd284cdc964af8a01d82d0caa7deeba82785b54f4"
  ],
  "holder": "did:ethr:0xa54545a4e45cf5a229438695c6bea23c5d1414c9",
  "proof": {
    "type": "JwtProof2020",
    "jwt": "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2cCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVQcmVzZW50YXRpb24iLCJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIlByb2ZpbGUiXSwidmVyaWZpYWJsZUNyZWRlbnRpYWwiOlsiZXlKaGJHY2lPaUpGVXpJMU5rc2lMQ0owZVhBaU9pSktWMVFpZlEuZXlKMll5STZleUpBWTI5dWRHVjRkQ0k2V3lKb2RIUndjem92TDNkM2R5NTNNeTV2Y21jdk1qQXhPQzlqY21Wa1pXNTBhV0ZzY3k5Mk1TSmRMQ0owZVhCbElqcGJJbFpsY21sbWFXRmliR1ZEY21Wa1pXNTBhV0ZzSWl3aVVISnZabWxzWlNKZExDSmpjbVZrWlc1MGFXRnNVM1ZpYW1WamRDSTZleUoxYzJWeVNXUWlPaUp6ZFhNaUxDSnVZVzFsSWpvaWMzTWlMQ0p3YUc5dVpTSTZJakF4T1Mwek9Ua3lMVFkwTkRRaUxDSmlhWEowYUdSaGRHVWlPaUl5TURJeUxURXdMVEU1SWl3aVpGSmxaMDUxYldKbGNpSTZJbk56SWl3aWMzVmlJam9pTnpBd05UVTFNREF3TWlKOWZTd2ljM1ZpSWpvaVpHbGtPbVYwYUhJNk1IaGhOVFExTkRWaE5HVTBOV05tTldFeU1qazBNemcyT1RWak5tSmxZVEl6WXpWa01UUXhOR001SWl3aWJtSm1Jam94TmpZMk1UYzJNVE16TENKcGMzTWlPaUprYVdRNlpYUm9jam93ZUdFelltSm1OVEJoTTJNellUUXhPREExTWpFek1qVmpZams1WldFek1ERXhOREppTXpZek5HVWlmUS5MclRDR19TUFhFLXFwaWNRdlRsYXc2NjZjbURwc1pFSUxQcENBVlJNQmJqQi1ZcC1HTVkwYXJxVHhnYzByVFJEM1hsWFY1N0poQ2taS1lCWjI2MUR4ZyJdfSwibmJmIjoxNjY2MzMyOTgzLCJpc3MiOiJkaWQ6ZXRocjoweGE1NDU0NWE0ZTQ1Y2Y1YTIyOTQzODY5NWM2YmVhMjNjNWQxNDE0YzkiLCJhdWQiOlsiZGlkOmV0aHI6MHhkMjg0Y2RjOTY0YWY4YTAxZDgyZDBjYWE3ZGVlYmE4Mjc4NWI1NGY0Il19.AjFvyK-4yYH7PHMZT2c-ZsBiquX8ZPZARwmMHcYNtkup15CqCgq1GFcQOWEtvDfwkj8abJH4kH4ffCreWR1tWQ"
  },
  "type": [
    "VerifiablePresentation",
    "VerifiableCredential",
    "Profile"
  ],
  "@context": [
    "https://www.w3.org/2018/credentials/v1"
  ],
  "verifiableCredential": [
    {
      "credentialSubject": {
        "userId": "sus",
        "name": "ss",
        "phone": "019-3992-6444",
        "birthdate": "2022-10-19",
        "dRegNumber": "ss",
        "sub": "7005550002",
        "id": "did:ethr:0xa54545a4e45cf5a229438695c6bea23c5d1414c9"
      },
      "issuer": {
        "id": "did:ethr:0xa3bbf50a3c3a4180521325cb99ea301142b3634e"
      },
      "type": [
        "VerifiableCredential",
        "Profile"
      ],
      "@context": [
        "https://www.w3.org/2018/credentials/v1"
      ],
      "issuanceDate": "2022-10-19T10:42:13.000Z",
      "proof": {
        "type": "JwtProof2020",
        "jwt": "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiUHJvZmlsZSJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJ1c2VySWQiOiJzdXMiLCJuYW1lIjoic3MiLCJwaG9uZSI6IjAxOS0zOTkyLTY0NDQiLCJiaXJ0aGRhdGUiOiIyMDIyLTEwLTE5IiwiZFJlZ051bWJlciI6InNzIiwic3ViIjoiNzAwNTU1MDAwMiJ9fSwic3ViIjoiZGlkOmV0aHI6MHhhNTQ1NDVhNGU0NWNmNWEyMjk0Mzg2OTVjNmJlYTIzYzVkMTQxNGM5IiwibmJmIjoxNjY2MTc2MTMzLCJpc3MiOiJkaWQ6ZXRocjoweGEzYmJmNTBhM2MzYTQxODA1MjEzMjVjYjk5ZWEzMDExNDJiMzYzNGUifQ.LrTCG_SPXE-qpicQvTlaw666cmDpsZEILPpCAVRMBbjB-Yp-GMY0arqTxgc0rTRD3XlXV57JhCkZKYBZ261Dxg"
      }
    }
  ]
}
```

{% endtab %}
{% endtabs %}

Verify the VP

{% openapi src="/files/6b2YsvYVWqaNb0xcSpOv" path="/did/verify-vp" method="post" %}
[pos-auth.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2F7hSOMIww0qRCa8ClSYPH%2Fpos-auth.yaml?alt=media\&token=b1d46fab-41de-454d-9d21-3c8adf130e91)
{% endopenapi %}

* The `body` of the request has the VP.
* If successful, `verified` is true.

#### Example

{% tabs %}
{% tab title="Request" %}

```json
{
  "issuanceDate": "2022-10-21T06:16:23.000Z",
  "verifier": [
    "did:ethr:0xd284cdc964af8a01d82d0caa7deeba82785b54f4"
  ],
  "holder": "did:ethr:0xa54545a4e45cf5a229438695c6bea23c5d1414c9",
  "proof": {
    "type": "JwtProof2020",
    "jwt": "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2cCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVQcmVzZW50YXRpb24iLCJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIlByb2ZpbGUiXSwidmVyaWZpYWJsZUNyZWRlbnRpYWwiOlsiZXlKaGJHY2lPaUpGVXpJMU5rc2lMQ0owZVhBaU9pSktWMVFpZlEuZXlKMll5STZleUpBWTI5dWRHVjRkQ0k2V3lKb2RIUndjem92TDNkM2R5NTNNeTV2Y21jdk1qQXhPQzlqY21Wa1pXNTBhV0ZzY3k5Mk1TSmRMQ0owZVhCbElqcGJJbFpsY21sbWFXRmliR1ZEY21Wa1pXNTBhV0ZzSWl3aVVISnZabWxzWlNKZExDSmpjbVZrWlc1MGFXRnNVM1ZpYW1WamRDSTZleUoxYzJWeVNXUWlPaUp6ZFhNaUxDSnVZVzFsSWpvaWMzTWlMQ0p3YUc5dVpTSTZJakF4T1Mwek9Ua3lMVFkwTkRRaUxDSmlhWEowYUdSaGRHVWlPaUl5TURJeUxURXdMVEU1SWl3aVpGSmxaMDUxYldKbGNpSTZJbk56SWl3aWMzVmlJam9pTnpBd05UVTFNREF3TWlKOWZTd2ljM1ZpSWpvaVpHbGtPbVYwYUhJNk1IaGhOVFExTkRWaE5HVTBOV05tTldFeU1qazBNemcyT1RWak5tSmxZVEl6WXpWa01UUXhOR001SWl3aWJtSm1Jam94TmpZMk1UYzJNVE16TENKcGMzTWlPaUprYVdRNlpYUm9jam93ZUdFelltSm1OVEJoTTJNellUUXhPREExTWpFek1qVmpZams1WldFek1ERXhOREppTXpZek5HVWlmUS5MclRDR19TUFhFLXFwaWNRdlRsYXc2NjZjbURwc1pFSUxQcENBVlJNQmJqQi1ZcC1HTVkwYXJxVHhnYzByVFJEM1hsWFY1N0poQ2taS1lCWjI2MUR4ZyJdfSwibmJmIjoxNjY2MzMyOTgzLCJpc3MiOiJkaWQ6ZXRocjoweGE1NDU0NWE0ZTQ1Y2Y1YTIyOTQzODY5NWM2YmVhMjNjNWQxNDE0YzkiLCJhdWQiOlsiZGlkOmV0aHI6MHhkMjg0Y2RjOTY0YWY4YTAxZDgyZDBjYWE3ZGVlYmE4Mjc4NWI1NGY0Il19.AjFvyK-4yYH7PHMZT2c-ZsBiquX8ZPZARwmMHcYNtkup15CqCgq1GFcQOWEtvDfwkj8abJH4kH4ffCreWR1tWQ"
  },
  "type": [
    "VerifiablePresentation",
    "VerifiableCredential",
    "Profile"
  ],
  "@context": [
    "https://www.w3.org/2018/credentials/v1"
  ],
  "verifiableCredential": [
    {
      "credentialSubject": {
        "userId": "sus",
        "name": "ss",
        "phone": "019-3992-6444",
        "birthdate": "2022-10-19",
        "dRegNumber": "ss",
        "sub": "7005550002",
        "id": "did:ethr:0xa54545a4e45cf5a229438695c6bea23c5d1414c9"
      },
      "issuer": {
        "id": "did:ethr:0xa3bbf50a3c3a4180521325cb99ea301142b3634e"
      },
      "type": [
        "VerifiableCredential",
        "Profile"
      ],
      "@context": [
        "https://www.w3.org/2018/credentials/v1"
      ],
      "issuanceDate": "2022-10-19T10:42:13.000Z",
      "proof": {
        "type": "JwtProof2020",
        "jwt": "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiUHJvZmlsZSJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJ1c2VySWQiOiJzdXMiLCJuYW1lIjoic3MiLCJwaG9uZSI6IjAxOS0zOTkyLTY0NDQiLCJiaXJ0aGRhdGUiOiIyMDIyLTEwLTE5IiwiZFJlZ051bWJlciI6InNzIiwic3ViIjoiNzAwNTU1MDAwMiJ9fSwic3ViIjoiZGlkOmV0aHI6MHhhNTQ1NDVhNGU0NWNmNWEyMjk0Mzg2OTVjNmJlYTIzYzVkMTQxNGM5IiwibmJmIjoxNjY2MTc2MTMzLCJpc3MiOiJkaWQ6ZXRocjoweGEzYmJmNTBhM2MzYTQxODA1MjEzMjVjYjk5ZWEzMDExNDJiMzYzNGUifQ.LrTCG_SPXE-qpicQvTlaw666cmDpsZEILPpCAVRMBbjB-Yp-GMY0arqTxgc0rTRD3XlXV57JhCkZKYBZ261Dxg"
      }
    }
  ]
}
```

{% endtab %}

{% tab title="Response" %}

```json
{
  "didResolutionResult": {
    "didDocumentMetadata": {},
    "didResolutionMetadata": {
      "contentType": "application/did+ld+json"
    },
    "didDocument": {
      "@context": [
        "https://www.w3.org/ns/did/v1",
        "https://w3id.org/security/suites/secp256k1recovery-2020/v2"
      ],
      "id": "did:ethr:0xa54545a4e45cf5a229438695c6bea23c5d1414c9",
      "verificationMethod": [
        {
          "id": "did:ethr:0xa54545a4e45cf5a229438695c6bea23c5d1414c9#controller",
          "type": "EcdsaSecp256k1RecoveryMethod2020",
          "controller": "did:ethr:0xa54545a4e45cf5a229438695c6bea23c5d1414c9",
          "blockchainAccountId": "eip155:1:0xA54545a4e45CF5a229438695C6Bea23C5d1414c9"
        }
      ],
      "authentication": [
        "did:ethr:0xa54545a4e45cf5a229438695c6bea23c5d1414c9#controller"
      ],
      "assertionMethod": [
        "did:ethr:0xa54545a4e45cf5a229438695c6bea23c5d1414c9#controller"
      ]
    }
  },
  "verifiablePresentation": {
    "verifiableCredential": [
      {
        "credentialSubject": {
          "userId": "sus",
          "name": "ss",
          "phone": "019-3992-6444",
          "birthdate": "2022-10-19",
          "dRegNumber": "ss",
          "sub": "7005550002",
          "id": "did:ethr:0xa54545a4e45cf5a229438695c6bea23c5d1414c9"
        },
        "issuer": {
          "id": "did:ethr:0xa3bbf50a3c3a4180521325cb99ea301142b3634e"
        },
        "type": [
          "VerifiableCredential",
          "Profile"
        ],
        "@context": [
          "https://www.w3.org/2018/credentials/v1"
        ],
        "issuanceDate": "2022-10-19T10:42:13.000Z",
        "proof": {
          "type": "JwtProof2020",
          "jwt": "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiUHJvZmlsZSJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJ1c2VySWQiOiJzdXMiLCJuYW1lIjoic3MiLCJwaG9uZSI6IjAxOS0zOTkyLTY0NDQiLCJiaXJ0aGRhdGUiOiIyMDIyLTEwLTE5IiwiZFJlZ051bWJlciI6InNzIiwic3ViIjoiNzAwNTU1MDAwMiJ9fSwic3ViIjoiZGlkOmV0aHI6MHhhNTQ1NDVhNGU0NWNmNWEyMjk0Mzg2OTVjNmJlYTIzYzVkMTQxNGM5IiwibmJmIjoxNjY2MTc2MTMzLCJpc3MiOiJkaWQ6ZXRocjoweGEzYmJmNTBhM2MzYTQxODA1MjEzMjVjYjk5ZWEzMDExNDJiMzYzNGUifQ.LrTCG_SPXE-qpicQvTlaw666cmDpsZEILPpCAVRMBbjB-Yp-GMY0arqTxgc0rTRD3XlXV57JhCkZKYBZ261Dxg"
        }
      }
    ],
    "holder": "did:ethr:0xa54545a4e45cf5a229438695c6bea23c5d1414c9",
    "verifier": [
      "did:ethr:0xd284cdc964af8a01d82d0caa7deeba82785b54f4"
    ],
    "type": [
      "VerifiablePresentation",
      "VerifiableCredential",
      "Profile"
    ],
    "@context": [
      "https://www.w3.org/2018/credentials/v1"
    ],
    "issuanceDate": "2022-10-21T06:16:23.000Z",
    "proof": {
      "type": "JwtProof2020",
      "jwt": "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2cCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVQcmVzZW50YXRpb24iLCJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIlByb2ZpbGUiXSwidmVyaWZpYWJsZUNyZWRlbnRpYWwiOlsiZXlKaGJHY2lPaUpGVXpJMU5rc2lMQ0owZVhBaU9pSktWMVFpZlEuZXlKMll5STZleUpBWTI5dWRHVjRkQ0k2V3lKb2RIUndjem92TDNkM2R5NTNNeTV2Y21jdk1qQXhPQzlqY21Wa1pXNTBhV0ZzY3k5Mk1TSmRMQ0owZVhCbElqcGJJbFpsY21sbWFXRmliR1ZEY21Wa1pXNTBhV0ZzSWl3aVVISnZabWxzWlNKZExDSmpjbVZrWlc1MGFXRnNVM1ZpYW1WamRDSTZleUoxYzJWeVNXUWlPaUp6ZFhNaUxDSnVZVzFsSWpvaWMzTWlMQ0p3YUc5dVpTSTZJakF4T1Mwek9Ua3lMVFkwTkRRaUxDSmlhWEowYUdSaGRHVWlPaUl5TURJeUxURXdMVEU1SWl3aVpGSmxaMDUxYldKbGNpSTZJbk56SWl3aWMzVmlJam9pTnpBd05UVTFNREF3TWlKOWZTd2ljM1ZpSWpvaVpHbGtPbVYwYUhJNk1IaGhOVFExTkRWaE5HVTBOV05tTldFeU1qazBNemcyT1RWak5tSmxZVEl6WXpWa01UUXhOR001SWl3aWJtSm1Jam94TmpZMk1UYzJNVE16TENKcGMzTWlPaUprYVdRNlpYUm9jam93ZUdFelltSm1OVEJoTTJNellUUXhPREExTWpFek1qVmpZams1WldFek1ERXhOREppTXpZek5HVWlmUS5MclRDR19TUFhFLXFwaWNRdlRsYXc2NjZjbURwc1pFSUxQcENBVlJNQmJqQi1ZcC1HTVkwYXJxVHhnYzByVFJEM1hsWFY1N0poQ2taS1lCWjI2MUR4ZyJdfSwibmJmIjoxNjY2MzMyOTgzLCJpc3MiOiJkaWQ6ZXRocjoweGE1NDU0NWE0ZTQ1Y2Y1YTIyOTQzODY5NWM2YmVhMjNjNWQxNDE0YzkiLCJhdWQiOlsiZGlkOmV0aHI6MHhkMjg0Y2RjOTY0YWY4YTAxZDgyZDBjYWE3ZGVlYmE4Mjc4NWI1NGY0Il19.AjFvyK-4yYH7PHMZT2c-ZsBiquX8ZPZARwmMHcYNtkup15CqCgq1GFcQOWEtvDfwkj8abJH4kH4ffCreWR1tWQ"
    }
  },
  "payload": {
    "vp": {
      "@context": [
        "https://www.w3.org/2018/credentials/v1"
      ],
      "type": [
        "VerifiablePresentation",
        "VerifiableCredential",
        "Profile"
      ],
      "verifiableCredential": [
        "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiUHJvZmlsZSJdLCJjcmVkZW50aWFsU3ViamVjdCI6eyJ1c2VySWQiOiJzdXMiLCJuYW1lIjoic3MiLCJwaG9uZSI6IjAxOS0zOTkyLTY0NDQiLCJiaXJ0aGRhdGUiOiIyMDIyLTEwLTE5IiwiZFJlZ051bWJlciI6InNzIiwic3ViIjoiNzAwNTU1MDAwMiJ9fSwic3ViIjoiZGlkOmV0aHI6MHhhNTQ1NDVhNGU0NWNmNWEyMjk0Mzg2OTVjNmJlYTIzYzVkMTQxNGM5IiwibmJmIjoxNjY2MTc2MTMzLCJpc3MiOiJkaWQ6ZXRocjoweGEzYmJmNTBhM2MzYTQxODA1MjEzMjVjYjk5ZWEzMDExNDJiMzYzNGUifQ.LrTCG_SPXE-qpicQvTlaw666cmDpsZEILPpCAVRMBbjB-Yp-GMY0arqTxgc0rTRD3XlXV57JhCkZKYBZ261Dxg"
      ]
    },
    "nbf": 1666332983,
    "iss": "did:ethr:0xa54545a4e45cf5a229438695c6bea23c5d1414c9",
    "aud": [
      "did:ethr:0xd284cdc964af8a01d82d0caa7deeba82785b54f4"
    ]
  },
  "jwt": "eyJhbGciOiJFUzI1NksiLCJ0eXAiOiJKV1QifQ.eyJ2cCI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVQcmVzZW50YXRpb24iLCJWZXJpZmlhYmxlQ3JlZGVudGlhbCIsIlByb2ZpbGUiXSwidmVyaWZpYWJsZUNyZWRlbnRpYWwiOlsiZXlKaGJHY2lPaUpGVXpJMU5rc2lMQ0owZVhBaU9pSktWMVFpZlEuZXlKMll5STZleUpBWTI5dWRHVjRkQ0k2V3lKb2RIUndjem92TDNkM2R5NTNNeTV2Y21jdk1qQXhPQzlqY21Wa1pXNTBhV0ZzY3k5Mk1TSmRMQ0owZVhCbElqcGJJbFpsY21sbWFXRmliR1ZEY21Wa1pXNTBhV0ZzSWl3aVVISnZabWxzWlNKZExDSmpjbVZrWlc1MGFXRnNVM1ZpYW1WamRDSTZleUoxYzJWeVNXUWlPaUp6ZFhNaUxDSnVZVzFsSWpvaWMzTWlMQ0p3YUc5dVpTSTZJakF4T1Mwek9Ua3lMVFkwTkRRaUxDSmlhWEowYUdSaGRHVWlPaUl5TURJeUxURXdMVEU1SWl3aVpGSmxaMDUxYldKbGNpSTZJbk56SWl3aWMzVmlJam9pTnpBd05UVTFNREF3TWlKOWZTd2ljM1ZpSWpvaVpHbGtPbVYwYUhJNk1IaGhOVFExTkRWaE5HVTBOV05tTldFeU1qazBNemcyT1RWak5tSmxZVEl6WXpWa01UUXhOR001SWl3aWJtSm1Jam94TmpZMk1UYzJNVE16TENKcGMzTWlPaUprYVdRNlpYUm9jam93ZUdFelltSm1OVEJoTTJNellUUXhPREExTWpFek1qVmpZams1WldFek1ERXhOREppTXpZek5HVWlmUS5MclRDR19TUFhFLXFwaWNRdlRsYXc2NjZjbURwc1pFSUxQcENBVlJNQmJqQi1ZcC1HTVkwYXJxVHhnYzByVFJEM1hsWFY1N0poQ2taS1lCWjI2MUR4ZyJdfSwibmJmIjoxNjY2MzMyOTgzLCJpc3MiOiJkaWQ6ZXRocjoweGE1NDU0NWE0ZTQ1Y2Y1YTIyOTQzODY5NWM2YmVhMjNjNWQxNDE0YzkiLCJhdWQiOlsiZGlkOmV0aHI6MHhkMjg0Y2RjOTY0YWY4YTAxZDgyZDBjYWE3ZGVlYmE4Mjc4NWI1NGY0Il19.AjFvyK-4yYH7PHMZT2c-ZsBiquX8ZPZARwmMHcYNtkup15CqCgq1GFcQOWEtvDfwkj8abJH4kH4ffCreWR1tWQ",
  "verified": true,
  "policies": {},
  "issuer": "did:ethr:0xa54545a4e45cf5a229438695c6bea23c5d1414c9",
  "signer": {
    "id": "did:ethr:0xa54545a4e45cf5a229438695c6bea23c5d1414c9#controller",
    "type": "EcdsaSecp256k1RecoveryMethod2020",
    "controller": "did:ethr:0xa54545a4e45cf5a229438695c6bea23c5d1414c9",
    "blockchainAccountId": "eip155:1:0xA54545a4e45CF5a229438695C6Bea23C5d1414c9"
  }
}
```

{% endtab %}
{% endtabs %}

List issuers and verifiers.

{% openapi src="/files/6b2YsvYVWqaNb0xcSpOv" path="/did/issuers" method="get" %}
[pos-auth.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2F7hSOMIww0qRCa8ClSYPH%2Fpos-auth.yaml?alt=media\&token=b1d46fab-41de-454d-9d21-3c8adf130e91)
{% endopenapi %}

#### Example

{% tabs %}
{% tab title="Request" %}

```bash
curl -X 'GET' \
  '{endpoint}/did/issuers' \
  -H 'accept: application/json'
```

{% endtab %}

{% tab title="Response" %}

```json
[
  {
    "alias": "...",
    "did": "did:ethr:0xd284cdc964af8a01d82d0caa7deeba82785b54f4"
  },
  {
    "alias": "...",
    "did": "did:ethr:0xa3bbf50a3c3a4180521325cb99ea301142b3634e"
  }
]
```

{% endtab %}
{% endtabs %}

{% openapi src="/files/6b2YsvYVWqaNb0xcSpOv" path="/did/verifiers" method="get" %}
[pos-auth.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2F7hSOMIww0qRCa8ClSYPH%2Fpos-auth.yaml?alt=media\&token=b1d46fab-41de-454d-9d21-3c8adf130e91)
{% endopenapi %}

#### Examples

{% tabs %}
{% tab title="Request" %}

```bash
curl -X 'GET' \
  '{endpoint}/did/verifiers' \
  -H 'accept: application/json'
```

{% endtab %}

{% tab title="Response" %}

```json
[
  {
    "alias": "...",
    "did": "did:ethr:0xd284cdc964af8a01d82d0caa7deeba82785b54f4"
  },
  {
    "alias": "...",
    "did": "did:ethr:0xa3bbf50a3c3a4180521325cb99ea301142b3634e"
  }
]
```

{% endtab %}
{% endtabs %}


# Chain API

This document explains how to use Chain APIs. Chain APIs supports onchain networks ethereum, optimism, and bnb and opBNB.

## Endpoint

> **Real server:** [**https://api-ethereum.finenex.net/v1/chain**](https://api-ethereum.finenex.net/v1/chain)
>
> * "api-op", "api-bsc", or "api-op-bnb" can be used on "api-ethereum".
>
> **Test server:** [**https://test-api-sepolia.finenex.net/v1/chain**](https://test-api-sepolia.finenex.net/v1/chain)
>
> * "test-api-op-sepolia", "test-api-bsc", or "test-api-op-bnb" can be used on "test-api-sepolia".

## Using APIs

Token APIs support JsonRpc protocol. It uses /v1/chain path.

#### HTTP

```bash
 curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"transfer","params":[],"id":1}' http://hostname:6101/v1/chain/erc20
```

```json
   "jsonrpc":"2.0",
	"id":1,
	"result":{
	    "resultCode":"200",
		"resultMessage":"Success",
		"resultData":{
		    "totalDifficulty":807264,
			"receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
			"extraData":"0xf90148a00000000000000000000000000000000000000000000000000000000000000000f8549433bc60cfd1991c71b8859c83081b736f18350eec948644c82f5f1f5590615ce935ddb98127a5bb5ffe94868ff6f92fb6fd8ee485b73abe179a61f0725f6594d7cf993c24b0e212c9be85f44ed064d3a8c1e283808400000000f8c9b841428f4c187adf435299ee7041457fde76acf604625a5036846addeb6e1f1dda137c34cc94e0039a19750719144f8510cf34f13271514049784759c93a7abb1f4800b84167fbb3bd6e900d0e96d2380d8f6fae1907ffa2a5d450bc4e92bf59b3ba8d3a232684eb2482537f6e6ab69171178a8575152b9e1e71d4641b54160e1b1c1e4fe501b8416e06b176dd0cd76f74708a6b3a5bc32ea68a5572484728c54623bba039506fff72dde4fbf7aeaca6b089cad31b6913cbcc4e71b5892429a78028ae1a59ae236e00",
			"numberRaw":"0xc515f",
			"baseFeePerGas":null,
			"sealFields":null,
			"miner":"0x868ff6f92fb6fd8ee485b73abe179a61f0725f65",
			"number":807263,
			"gasLimit":9007199254740991,
			"gasUsed":0,
			"uncles":[],
			"sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
			"nonceRaw":"0x0000000000000000",
			"sizeRaw":"0x350",
			"gasUsedRaw":"0x0",
			"timestamp":1639390480,
			"difficultyRaw":"0x1",
			"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
			"author":null,
			"totalDifficultyRaw":"0xc5160",
			"transactions":[],
			"nonce":0,
			"difficulty":1,
			"size":848,
			"transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
			"timestampRaw":"0x61b71d10",
			"stateRoot":"0x10ade90ebaceda5836392e6fa155edf62710230c98d8678038db54900631efeb",
			"mixHash":"0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
			"parentHash":"0x7f59ff30d5bc58c87e476b5c571e14993570c904ecb640b8cc1e1323d9a81e05",
			"gasLimitRaw":"0x1fffffffffffff",
			"hash":"0x3a8dfa9d61625a73e7a237846c20a106e9b68a14c78b2f7910b3ded2b9518cd3"
		}
	}
}
```


# Smart Account

## Ethereum account <a href="#undefined" id="undefined"></a>

Before explaining account abstraction, let’s briefly learn about the accounts currently used in Ethereum. Ethereum uses two accounts: externally owned account (EOA) and contract account (CA), and each account has a different role. First, an externally owned account is an account that we create by obtaining a private key to trade Ethereum. Externally owned accounts are top-level accounts that have private keys and addresses and the authority to issue and sign transactions. A contract account is created when a contract is issued, and unlike externally owned accounts, it has code and storage and can execute code at a specific point in time. However, since there is no authority to issue transactions and contracts, an externally owned account must be used to issue new contracts or transactions in the contract.

## What is account abstraction? <a href="#account-abstraction" id="account-abstraction"></a>

Account abstraction refers to allowing the two Ethereum accounts described above to be combined into one account. Currently, in Ethereum, each account has a different role. In particular, there are many limitations when implementing functions with contracts because the contract account does not have the authority to issue or sign transactions. When issuing a transaction or requiring a signature, the transaction must be issued through an externally owned account, so the basic fee of 21000 gas required for transaction issuance must be used, and account management is also cumbersome. Account abstraction makes it possible to sign and issue transactions in a contract account without using two types of accounts, allowing the functions of an externally owned account and a contract account to be used with a single account. If it is possible to execute contracts and issue transactions in one account, you can implement various functions that are currently not possible with contract accounts, such as managing accounts at once using a contract wallet or paying fees on behalf of a specific account.

In Ethereum, account abstraction uses the function of the transaction mempool without the need to modify the consensus layer as presented in ERC-4337, and account abstraction was implemented without adding a new transaction using user operation.

User operation is a structure implemented as a smart contract, not a transaction. If you look at the fields that user operation has, they are similar to the fields that a transaction has. And when verifying a transaction, the signature, nonce value, gas cost to be paid, etc. are checked. The user operation object also verifies the signature, nonce value, and gas cost to be paid through the contract and executes the code. The actual verification process is different from a transaction, but if a transaction is issued by an externally owned account, it can be understood that user operation plays a similar role to a transaction in a contract account through account abstraction.

## User operation process <a href="#useroperation" id="useroperation"></a>

<figure><img src="https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2FPFIdGnBYthgOWfVKcFEW%2Fimage.png?alt=media&amp;token=b3f34d57-7b01-4fe9-9b47-b425d1bd8508" alt=""><figcaption></figcaption></figure>

When a user sends a user operation object, it is registered in the mempool. When selecting a user operation object, Bundler uses the same mechanism that selects high-fee transactions from an existing mempool. Among the user operation objects registered in mempool, objects that pay a high fee to the bundler are collected to create a “bundle transaction” and stored in a block. The picture above graphically shows the process in which the user operation object is processed.

> bundler: A node that collects user operation objects from the user operation mempool, verifies and executes them, and creates a “bundle transaction”

## Smart Account <a href="#smart-account" id="smart-account"></a>

In Chain API, an account created through account abstraction is used under the name "smart account". In other words, the user creates a smart account using the address of the server wallet, and it is the smart account address that actually owns the token. Smart account has only an address without a private key, and in order to use this address, the signature of the owner's server wallet address is required.


# API References

APIs related to besu network, token and nft.

### Net

* net\_getTempKey
* net\_getTransactionStatus
* net\_getBalance
* net\_getGasPrice
* net\_transfer

### ERC20 Token

* erc20\_getBalance
* erc20\_mint
* erc20\_burn
* erc20\_transfer
* erc20\_tranferFrom
* erc20\_approve
* erc20\_getAllowance

### ERC721 Token

* erc721\_getBalance
* erc721\_getTokenUri
* erc721\_mint
* erc721\_burn
* erc721\_transfer
* erc721\_tranferFrom
* erc721\_approve
* erc721\_getApproved

### ERC1155 Token

* erc1155\_getBalance
* erc1155\_mint
* erc1155\_burn
* erc1155\_transfer
* erc1155\_transferFrom
* erc1155\_setApprovalForAll
* erc1155\_isApprovedForAll


# Net

Chain base coin (ETH, BNB) APIs

### net\_getTempKey

Returns a generated tempKey by address

#### Parameters

| Name    | Type   | Description                |
| ------- | ------ | -------------------------- |
| address | String | Address                    |
| keyType | String | See below keyType section. |

#### keyType

| Transaction Type | keyType String |
| ---------------- | -------------- |
| Export Address   | exportAddress  |
| Burn             | burn           |
| Transfer         | transfer       |
| Approve          | approve        |
| Mint             | mint           |

#### Return Value

| Name    | Type   | Description |
| ------- | ------ | ----------- |
| tempKey | String | tempKey     |

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": { 
            "tempKey": "ffd5b9f7f4650366bd7043271bfcf0eb",
        }
    }
}
```

### net\_getTransactionStatus

Returns a status of transaction.

#### Parameters

| Name          | Type   | Description    |
| ------------- | ------ | -------------- |
| transactionId | String | Transaction Id |

#### Return Value

| Name         | Type    | Description                           |
| ------------ | ------- | ------------------------------------- |
| status       | Integer | See below status type.                |
| revertReason | String  | Reverted reason, if transaction fail. |

#### Status type

| Status | Description                       |
| ------ | --------------------------------- |
| 1      | Success                           |
| 0      | Fail                              |
| 2      | Invalid                           |
| -1     | Pending or invalid Transaction Id |

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "status": 0,
            "revertReason":"&ERC20: transfer amount exceeds balance"
        }
    }
}
```

### net\_getBalance

Return an address ETH / BNB balance.

#### Parameters

| Name    | Type   | Description |
| ------- | ------ | ----------- |
| address | String | Address     |

#### Return Value

| Name    | Type       | Description         |
| ------- | ---------- | ------------------- |
| balance | BigDecimal | balance of address. |

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "balance": "100.12"
        }
    }
}
```

### net\_getGasPrice

Returns the average gas value from the corresponding Onchain.

#### Parameters

#### Return Value

| Name     | Type       | Description |
| -------- | ---------- | ----------- |
| gasPrice | BigDecimal | gasPrice    |

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "gasPrice": "0.000000004"
        }
    }
}
```

### net\_transfer

Transfer ETH / BNB from from-address to to-address.

#### Parameters

| Name      | Type       | Description                                                                                                                                                                                                                      |
| --------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| sender    | String     | Sender address                                                                                                                                                                                                                   |
| toAddress | String     | To address                                                                                                                                                                                                                       |
| amount    | BigDecimal | Transfer amount.                                                                                                                                                                                                                 |
| tempKey   | String     | tempKey for "transfer"                                                                                                                                                                                                           |
| hashKey   | String     | hash(tempKey \| fromAddress' secretKey)                                                                                                                                                                                          |
| signature | String     | sign( hash (sender \| toAddress \| amount \| tempKey \| hashKey) ) by formAddress's privateKey using signData API                                                                                                                |
| gasPrice  | BigDecimal | gasPrice.                                                                                                                                                                                                                        |
| nonce     | BigInteger | <p>nonce value. If it is null, it will be filled in automatically. </p><p>If acceleration is needed, use the nonce value generated when performing the transaction and use a higher gasPrice than the previous transaction. </p> |

#### Return Value

| Name          | Type       | Description    |
| ------------- | ---------- | -------------- |
| transactionId | String     | Transaction Id |
| nonce         | BigInteger | nonce value    |

{% hint style="info" %}
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using getTransactionStatus.
{% endhint %}

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b",
            "nonce": "32"
        }
    }
}
```


# ERC20 Token

Token ERC20 APIs.

### erc20\_getBalance

Return an address Token balance.

#### Parameters

| Name            | Type   | Description                |
| --------------- | ------ | -------------------------- |
| contractAddress | String | Contract address of token. |
| address         | String | Address                    |

#### Return Value

| Name    | Type       | Description               |
| ------- | ---------- | ------------------------- |
| balance | BigDecimal | Token balance of address. |

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "balance": "100.12"
        }
    }
}
```

### erc20\_mint

Add token issuance. Only the token owner can do this. (There are tokens for which the mint function is not provided according to the contract.)

#### Parameters

| Name            | Type       | Description                                                                                                                                                                                                       |
| --------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contractAddress | String     | Contract address of token                                                                                                                                                                                         |
| sender          | String     | Sender Address (It's must be owner)                                                                                                                                                                               |
| amount          | BigDecimal | Mint amount of token.                                                                                                                                                                                             |
| tempKey         | String     | tempKey for "mint"                                                                                                                                                                                                |
| hashKey         | String     | hash(tempKey \| secretKey)                                                                                                                                                                                        |
| signature       | String     | sign( hash( contractAddress \| owner \| amount \| tempKey \| hashKey ) ) by sender's privateKey using signData API                                                                                                |
| gasPrice        | BigDecimal | gasPrice                                                                                                                                                                                                          |
| nonce           | BIgInteger | nonce value. If it is null, it will be filled in automatically. If acceleration is needed, use the nonce value generated when performing the transaction and use a higher gasPrice than the previous transaction. |

#### Return Value

| Name          | Type       | Description    |
| ------------- | ---------- | -------------- |
| transactionId | String     | Transaction Id |
| nonce         | BigInteger | nonce Value    |

{% hint style="info" %}
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net\_getTransactionStatus.
{% endhint %}

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b",
            "nonce": 43
        }
    }
}
```

### erc20\_burn

Burn the initial supply of token. Only the token owner can do this.

#### Parameters

| Name            | Type       | Description                                                                                                                                                                                                       |
| --------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contractAddress | String     | Contract address of token                                                                                                                                                                                         |
| sender          | String     | Sender Address (It's must be owner)                                                                                                                                                                               |
| amount          | BigDecimal | Burn amount of token.                                                                                                                                                                                             |
| tempKey         | String     | tempKey for "burn"                                                                                                                                                                                                |
| hashKey         | String     | hash(tempKey \| secretKey)                                                                                                                                                                                        |
| signature       | String     | sign( hash( contractAddress \| owner \| amount \| tempKey \| hashKey ) ) by sender's privateKey using signData API                                                                                                |
| gasPrice        | BigDecimal | gasPrice                                                                                                                                                                                                          |
| nonce           | BigInteger | nonce value. If it is null, it will be filled in automatically. If acceleration is needed, use the nonce value generated when performing the transaction and use a higher gasPrice than the previous transaction. |

#### Return Value

| Name          | Type       | Description    |
| ------------- | ---------- | -------------- |
| transactionId | String     | Transaction Id |
| nonce         | BigInteger | nonce value    |

{% hint style="info" %}
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net\_getTransactionStatus.
{% endhint %}

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b",
            "nonce": 32
        }
    }
}
```

### erc20\_transfer

Transfer Token from from-address to to-address.

#### Parameters

| Name            | Type       | Description                                                                                                                                                                                                       |
| --------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contractAddress | String     | Contract address of token                                                                                                                                                                                         |
| sender          | String     | Sender address                                                                                                                                                                                                    |
| toAddress       | String     | To address                                                                                                                                                                                                        |
| amount          | BigDecimal | Transfer amount.                                                                                                                                                                                                  |
| tempKey         | String     | tempKey for "transfer"                                                                                                                                                                                            |
| hashKey         | String     | hash(tempKey \| fromAddress' secretKey)                                                                                                                                                                           |
| signature       | String     | sign( hash( contractAddress \| sender \| toAddress \| amount \| tempKey \| hashKey ) ) by sender's privateKey using signData API                                                                                  |
| gasPrice        | BigDecimal | gasPrice                                                                                                                                                                                                          |
| nonce           | BigInteger | nonce value. If it is null, it will be filled in automatically. If acceleration is needed, use the nonce value generated when performing the transaction and use a higher gasPrice than the previous transaction. |

#### Return Value

| Name          | Type       | Description    |
| ------------- | ---------- | -------------- |
| transactionId | String     | Transaction Id |
| nonce         | BigInteger | nonce value    |

{% hint style="info" %}
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net\_getTransactionStatus.
{% endhint %}

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b",
            "nonce": 32
        }
    }
}
```

### erc20\_transferFrom

Transfer Token from from-address to to-address by spender.

#### Parameters

| Name            | Type       | Description                                                                                                                                                                                                       |
| --------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contractAddress | String     | Contract address of token                                                                                                                                                                                         |
| sender          | String     | Sender address (spender)                                                                                                                                                                                          |
| fromAddress     | String     | From address                                                                                                                                                                                                      |
| toAddress       | String     | To address                                                                                                                                                                                                        |
| amount          | BigDecimal | Transfer amount.                                                                                                                                                                                                  |
| tempKey         | String     | tempKey for "transfer"                                                                                                                                                                                            |
| hashKey         | String     | hash(tempKey \| fromAddress' secretKey)                                                                                                                                                                           |
| signature       | String     | sign( hash( contractAddress \| sender \| fromAddress \| toAddress \| amount \| tempKey \| hashKey ) ) by sender's privateKey using signData API                                                                   |
| gasPrice        | BigDecimal | gasPrice                                                                                                                                                                                                          |
| nonce           | BigInteger | nonce value. If it is null, it will be filled in automatically. If acceleration is needed, use the nonce value generated when performing the transaction and use a higher gasPrice than the previous transaction. |

#### Return Value

| Name          | Type       | Description    |
| ------------- | ---------- | -------------- |
| transactionId | String     | Transaction Id |
| nonce         | BigInteger | nonce value    |

{% hint style="info" %}
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net\_getTransactionStatus.
{% endhint %}

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b",
            "nonce": 32
        }
    }
}
```

### erc20\_approve

Approve Token from owner-address to spender-address.

#### Parameters

| Name            | Type        | Description                                                                                                                                                                                                       |
| --------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contractAddress | String      | Contract address of token                                                                                                                                                                                         |
| sender          | String      | Sender address                                                                                                                                                                                                    |
| spender         | String      | Spender address                                                                                                                                                                                                   |
| amount          | BigDecimal  | Approve amount.                                                                                                                                                                                                   |
| tempKey         | String      | tempKey for "approve"                                                                                                                                                                                             |
| hashKey         | String      | hash(tempKey \| fromAddress' secretKey)                                                                                                                                                                           |
| signature       | String      | sign( hash ( contractAddress \| sender \| spender \| amount \| tempKey \| hashKey ) ) by sender's privateKey using signData API                                                                                   |
| gasPrice        | BigDecimal  | gasPrice                                                                                                                                                                                                          |
| nonce           | BingInteger | nonce value. If it is null, it will be filled in automatically. If acceleration is needed, use the nonce value generated when performing the transaction and use a higher gasPrice than the previous transaction. |

#### Return Value

| Name          | Type       | Description    |
| ------------- | ---------- | -------------- |
| transactionId | String     | Transaction Id |
| nonce         | BigInteger | nonce value    |

{% hint style="info" %}
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net\_getTransactionStatus.
{% endhint %}

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b",
            "nonce": 32
        }
    }
}
```

### erc20\_getAllowance

Returns an allowed Token amount from owner address to to spender address.

#### Parameters

| Name            | Type   | Description                |
| --------------- | ------ | -------------------------- |
| contractAddress | String | Contract address of token. |
| sender          | String | Allower address            |
| spender         | String | Spender address            |

#### Return Value

| Name   | Type       | Description           |
| ------ | ---------- | --------------------- |
| amount | BigDecimal | Allowed Token amount. |

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "amount": "100.12"
        }
    }
}
```


# ERC721 Token

Token ERC721 APIs.

### erc721\_getBalance

Return an address Token balance.

#### Parameters

| Name            | Type   | Description                |
| --------------- | ------ | -------------------------- |
| contractAddress | String | Contract address of token. |
| address         | String | Address                    |

#### Return Value

| Name    | Type       | Description               |
| ------- | ---------- | ------------------------- |
| balance | BigInteger | Token balance of address. |

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "balance": "10"
        }
    }
}
```

### erc721\_getTokenUri

Return a minted tokenId URI.

#### Parameters

| Name            | Type       | Description                |
| --------------- | ---------- | -------------------------- |
| contractAddress | String     | Contract address of token. |
| address         | String     | Address                    |
| tokenId         | BigInteger | token id                   |

#### Return Value

| Name | Type   | Description        |
| ---- | ------ | ------------------ |
| uri  | String | minted tokenId uri |

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "uri": "http://www.test.com"
        }
    }
}
```

### erc721\_mint

Create new token with uri data. Only the token owner can do this..

#### Parameters

| Name            | Type       | Description                                                                                                                                                                                                       |
| --------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contractAddress | String     | Contract address of token                                                                                                                                                                                         |
| sender          | String     | Address of token owner                                                                                                                                                                                            |
| toAddress       | String     | Address for mint                                                                                                                                                                                                  |
| tokenId         | BigInteger | token id                                                                                                                                                                                                          |
| uri             | String     | <p>The uri data to store in the token.<br>Max length : 100</p>                                                                                                                                                    |
| tempKey         | String     | tempKey for "mint"                                                                                                                                                                                                |
| hashKey         | String     | hash(tempKey \| secretKey)                                                                                                                                                                                        |
| signature       | String     | sign( hash ( contractAddress \| sender \| toAddress \| tokenId \| uri \| tempKey \| hashKey ) ) by owner's privateKey using signData API                                                                          |
| gasPrice        | BigDecimal | gasPrice                                                                                                                                                                                                          |
| nonce           | BigInteger | nonce value. If it is null, it will be filled in automatically. If acceleration is needed, use the nonce value generated when performing the transaction and use a higher gasPrice than the previous transaction. |

#### Return Value

| Name          | Type       | Description    |
| ------------- | ---------- | -------------- |
| transactionId | String     | Transaction Id |
| nonce         | BigInteger | nonce value    |

{% hint style="info" %}
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net\_getTransactionStatus.
{% endhint %}

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b",
            "nonce": 32
        }
    }
}
```

### erc721\_transfer

Transfer NFT owner from from-address to to-address.

#### Parameters

| Name            | Type       | Description                                                                                                                                                                                                       |
| --------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contractAddress | String     | Contract address of token                                                                                                                                                                                         |
| sender          | String     | Sender address                                                                                                                                                                                                    |
| toAddress       | String     | To address                                                                                                                                                                                                        |
| tokenId         | BigInteger | Token Id                                                                                                                                                                                                          |
| tempKey         | String     | tempKey for "transfer"                                                                                                                                                                                            |
| hashKey         | String     | hash(tempKey \| fromAddress' secretKey)                                                                                                                                                                           |
| signature       | String     | sign( hash ( contractAddress \| sender \| toAddress \| tokenId \| tempKey \| hashKey ) ) by formAddress's privateKey using signData API                                                                           |
| gasPrice        | BigDecimal | gasPrice                                                                                                                                                                                                          |
| nonce           | BigInteger | nonce value. If it is null, it will be filled in automatically. If acceleration is needed, use the nonce value generated when performing the transaction and use a higher gasPrice than the previous transaction. |

#### Return Value

| Name          | Type       | Description    |
| ------------- | ---------- | -------------- |
| transactionId | String     | Transaction Id |
| none          | BigInteger | nonce value    |

{% hint style="info" %}
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net\_getTransactionStatus.
{% endhint %}

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b",
            "noce": 32
        }
    }
}
```

### erc721\_transferFrom

Transfer NFT owner from from-address to to-address by spender address.

#### Parameters

| Name            | Type       | Description                                                                                                                                                                                                       |
| --------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contractAddress | String     | Contract address of token                                                                                                                                                                                         |
| sender          | String     | Sender address                                                                                                                                                                                                    |
| fromAddress     | String     | From address                                                                                                                                                                                                      |
| toAddress       | String     | To address                                                                                                                                                                                                        |
| tokenId         | BigInteger | Token Id                                                                                                                                                                                                          |
| tempKey         | String     | tempKey for "transfer"                                                                                                                                                                                            |
| hashKey         | String     | hash(tempKey \| fromAddress' secretKey)                                                                                                                                                                           |
| signature       | String     | sign( hash ( contractAddress \| sender \| fromAddress \| toAddress \| tokenId \| tempKey \| hashKey ) ) by address's privateKey using signData API                                                                |
| gasPrice        | BigDecimal | gasPrice                                                                                                                                                                                                          |
| nonce           | BigInteger | nonce value. If it is null, it will be filled in automatically. If acceleration is needed, use the nonce value generated when performing the transaction and use a higher gasPrice than the previous transaction. |

#### Return Value

| Name          | Type       | Description    |
| ------------- | ---------- | -------------- |
| transactionId | String     | Transaction Id |
| nonce         | BigInteger | nonce value    |

{% hint style="info" %}
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net\_getTransactionStatus.
{% endhint %}

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b",
            "nonce": 32
        }
    }
}
```

### erc721\_approve

Approve token from owner-address to spender-address.

#### Parameters

| Name            | Type       | Description                                                                                                                                                                                                       |
| --------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contractAddress | String     | Contract address of token                                                                                                                                                                                         |
| sender          | String     | Sender address                                                                                                                                                                                                    |
| spender         | String     | Spender address                                                                                                                                                                                                   |
| tokenId         | BigInteger | Token Id                                                                                                                                                                                                          |
| tempKey         | String     | tempKey for "approve"                                                                                                                                                                                             |
| hashKey         | String     | hash(tempKey \| fromAddress' secretKey)                                                                                                                                                                           |
| signature       | String     | sign( hash ( contractAddress \| sender \| spender \| tokenId \| tempKey \| hashKey ) ) by formAddress's privateKey using signData API                                                                             |
| gasPrice        | BigDecimal | gasPrice                                                                                                                                                                                                          |
| nonce           | BigInteger | nonce value. If it is null, it will be filled in automatically. If acceleration is needed, use the nonce value generated when performing the transaction and use a higher gasPrice than the previous transaction. |

#### Return Value

| Name          | Type   | Description    |
| ------------- | ------ | -------------- |
| transactionId | String | Transaction Id |

{% hint style="info" %}
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net\_getTransactionStatus.
{% endhint %}

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b",
            "nonce": 32
        }
    }
}
```

### erc721\_getApproved

Returns an allowed token spender from owner address.

#### Parameters

| Name            | Type       | Description                |
| --------------- | ---------- | -------------------------- |
| contractAddress | String     | Contract address of token. |
| tokenId         | BigInteger | Token Id                   |

#### Return Value

| Name    | Type   | Description       |
| ------- | ------ | ----------------- |
| address | String | Spender's address |

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "address": "0x666cf9aed17a9dfb4ae91b80789dd99803568b11"
        }
    }
}
```


# ERC1155 Token

Token ERC1155 APIs.

### erc1155\_getBalance

Return an address Token balance.

#### Parameters

| Name            | Type       | Description                |
| --------------- | ---------- | -------------------------- |
| contractAddress | String     | Contract address of token. |
| address         | String     | Address                    |
| tokenId         | BigInteger | tokenId                    |

#### Return Value

| Name    | Type       | Description                           |
| ------- | ---------- | ------------------------------------- |
| balance | BigInteger | Token balance of address and tokenId. |

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "balance": "10000"
        }
    }
}
```

### erc1155\_mint

Mint the new tokenId by amount. Only the token owner can do this.

#### Parameters

| Name            | Type       | Description                                                                                                                                                                                                       |
| --------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contractAddress | String     | Contract address of token                                                                                                                                                                                         |
| sender          | String     | address of owner                                                                                                                                                                                                  |
| account         | String     | address of mint                                                                                                                                                                                                   |
| tokenId         | BigInteger | tokenId to mint                                                                                                                                                                                                   |
| amount          | BigInteger | amount to mint                                                                                                                                                                                                    |
| tempKey         | String     | tempKey for "mint"                                                                                                                                                                                                |
| hashKey         | String     | hash(tempKey \| secretKey)                                                                                                                                                                                        |
| signature       | String     | sign(hash( contractAddress \| sender \| account \| tokenId \| amount \| tempKey \| hashKey ) ) by owner's privateKey using signData API                                                                           |
| gasPrice        | BigDecimal | gasPrice                                                                                                                                                                                                          |
| nonce           | BigInteger | nonce value. If it is null, it will be filled in automatically. If acceleration is needed, use the nonce value generated when performing the transaction and use a higher gasPrice than the previous transaction. |

#### Return Value

| Name          | Type       | Description    |
| ------------- | ---------- | -------------- |
| transactionId | String     | Transaction Id |
| nonce         | BigInteger | nonce          |

{% hint style="info" %}
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net\_getTransactionStatus.
{% endhint %}

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b",
            "nonce": 32
        }
    }
}
```

### erc1155\_burn

Burn the tokenId by amount. Only the token owner can do this.

#### Parameters

| Name            | Type       | Description                                                                                                                                                                                                       |
| --------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contractAddress | String     | Contract address of token                                                                                                                                                                                         |
| sender          | String     | address of owner                                                                                                                                                                                                  |
| account         | String     | address of mint                                                                                                                                                                                                   |
| tokenId         | BigInteger | tokenId to mint                                                                                                                                                                                                   |
| amount          | BigInteger | amount to mint                                                                                                                                                                                                    |
| tempKey         | String     | tempKey for "burn"                                                                                                                                                                                                |
| hashKey         | String     | hash(tempKey \| secretKey)                                                                                                                                                                                        |
| signature       | String     | sign(hash( contractAddress \| sender \| account \| tokenId \| amount \| tempKey \| hashKey ) ) by owner's privateKey using signData API                                                                           |
| gasPrice        | BigDecimal | gasPrice                                                                                                                                                                                                          |
| nonce           | BigInteger | nonce value. If it is null, it will be filled in automatically. If acceleration is needed, use the nonce value generated when performing the transaction and use a higher gasPrice than the previous transaction. |

#### Return Value

| Name          | Type       | Description    |
| ------------- | ---------- | -------------- |
| transactionId | String     | Transaction Id |
| nonce         | BigInteger | nonce          |

{% hint style="info" %}
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net\_getTransactionStatus.
{% endhint %}

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b",
            "nonce": 32
        }
    }
}
```

### erc1155\_transfer

Transfer token amount from sender to to-address.

#### Parameters

| Name            | Type       | Description                                                                                                                                                                                                       |
| --------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contractAddress | String     | Contract address of token                                                                                                                                                                                         |
| sender          | String     | Sender address                                                                                                                                                                                                    |
| toAddress       | String     | To address                                                                                                                                                                                                        |
| tokenId         | BigInteger | tokenId                                                                                                                                                                                                           |
| amount          | BigInteger | Transfer amount                                                                                                                                                                                                   |
| tempKey         | String     | tempKey for "transfer"                                                                                                                                                                                            |
| hashKey         | String     | hash(tempKey \| fromAddress' secretKey)                                                                                                                                                                           |
| signature       | String     | sign( hash( contractAddress \| sender \| toAddress \| tokenId \| amount \| tempKey \| hashKey ) ) by address's privateKey using signData API                                                                      |
| gasPrice        | BigDecimal | gasPrice                                                                                                                                                                                                          |
| nonce           | BigInteger | nonce value. If it is null, it will be filled in automatically. If acceleration is needed, use the nonce value generated when performing the transaction and use a higher gasPrice than the previous transaction. |

#### Return Value

| Name          | Type       | Description    |
| ------------- | ---------- | -------------- |
| transactionId | String     | Transaction Id |
| nonce         | BigInteger | nonce value    |

{% hint style="info" %}
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net\_getTransactionStatus.
{% endhint %}

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b",
            "nonce": 32
        }
    }
}
```

### erc1155\_transferFrom

Transfer token amount from from-address to to-address.

#### Parameters

| Name            | Type       | Description                                                                                                                                                                                                       |
| --------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contractAddress | String     | Contract address of token                                                                                                                                                                                         |
| sender          | String     | Sender address                                                                                                                                                                                                    |
| fromAddress     | String     | From address                                                                                                                                                                                                      |
| toAddress       | String     | To address                                                                                                                                                                                                        |
| tokenId         | BigInteger | tokenId                                                                                                                                                                                                           |
| amount          | BigInteger | Transfer amount                                                                                                                                                                                                   |
| tempKey         | String     | tempKey for "transfer"                                                                                                                                                                                            |
| hashKey         | String     | hash(tempKey \| fromAddress' secretKey)                                                                                                                                                                           |
| signature       | String     | sign( hash( contractAddress \| sender \| fromAddress \| toAddress \| tokenId \| amount \| tempKey \| hashKey ) ) by address's privateKey using signData API                                                       |
| gasPrice        | BigDecimal | gasPrice                                                                                                                                                                                                          |
| nonce           | BigInteger | nonce value. If it is null, it will be filled in automatically. If acceleration is needed, use the nonce value generated when performing the transaction and use a higher gasPrice than the previous transaction. |

#### Return Value

| Name          | Type       | Description    |
| ------------- | ---------- | -------------- |
| transactionId | String     | Transaction Id |
| nonce         | BigInteger | nonce value    |

{% hint style="info" %}
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net\_getTransactionStatus.
{% endhint %}

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b",
            "nonce": 32
        }
    }
}
```

### erc1155\_setApprovalForAll

Approval settings for all token to operator.

#### Parameters

| Name            | Type       | Description                                                                                                                                                                                                       |
| --------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| contractAddress | String     | Contract address of token                                                                                                                                                                                         |
| sender          | String     | Sender address                                                                                                                                                                                                    |
| operator        | String     | Operator address                                                                                                                                                                                                  |
| approved        | Boolean    | true \| false                                                                                                                                                                                                     |
| tempKey         | String     | tempKey for "approve"                                                                                                                                                                                             |
| hashKey         | String     | hash(tempKey \| fromAddress' secretKey)                                                                                                                                                                           |
| signature       | String     | sign( hash( contractAddress \| sender \| operator \| approved \| tempKey \| hashKey ) ) by formAddress's privateKey using signData API                                                                            |
| gasPrice        | BigDecimal | gasPrice                                                                                                                                                                                                          |
| nonce           | BigInteger | nonce value. If it is null, it will be filled in automatically. If acceleration is needed, use the nonce value generated when performing the transaction and use a higher gasPrice than the previous transaction. |

#### Return Value

| Name          | Type       | Description    |
| ------------- | ---------- | -------------- |
| transactionId | String     | Transaction Id |
| nonce         | BigInteger | nonce          |

{% hint style="info" %}
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net\_getTransactionStatus.
{% endhint %}

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b",
            "nonce": 32
        }
    }
}
```

### erc1155\_isApprovedForAll

Returns the value of the operator's approval setting for address .

#### Parameters

| Name            | Type   | Description                |
| --------------- | ------ | -------------------------- |
| contractAddress | String | Contract address of token. |
| account         | String | Owner address              |
| operator        | String | Operator address           |

#### Return Value

| Name     | Type    | Description                       |
| -------- | ------- | --------------------------------- |
| approved | Boolean | Approval set value. true \| false |

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "approved": true
        }
    }
}
```


# Smart Account

### sa\_getSmartAccount <a href="#sa_getsmartaccount" id="sa_getsmartaccount"></a>

Get the smart account of address. Smart account has the same value in all networks. In other words, the smart account of the same address is the same in the Ether mainnet and the BSC mainnet.

#### Parameters <a href="#parameter" id="parameter"></a>

| Name    | Type   | Description |
| ------- | ------ | ----------- |
| address | String | Address     |

#### Return Value <a href="#parameter" id="parameter"></a>

| Name         | Type   | Description              |
| ------------ | ------ | ------------------------ |
| smartAccount | String | Smart account of address |

#### Example

```json
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": { 
            "smartAccount": "0x79bbD96C7fd6bef0ED943ee42D8D350867d0D61E",
        }
    }
}
```

### sa\_getUserOpReceipt <a href="#sa_getuseropreceipt" id="sa_getuseropreceipt"></a>

Queries the results of user operation. Unlike regular transactions, user operation must call sc\_getUserOpReceipt to check whether execution was successful.

#### Parameters <a href="#parameter" id="parameter"></a>

| Name       | Type   | Description         |
| ---------- | ------ | ------------------- |
| userOpHash | String | User operation hash |

#### Return Value <a href="#parameter" id="parameter"></a>

| Name            | Type       | Description                                     |
| --------------- | ---------- | ----------------------------------------------- |
| userOpHash      | String     | User operation hash                             |
| success         | String     | “true” or “false”                               |
| actualGasCost   | BigInteger | Gas cost used                                   |
| actualGasUsed   | BigInteger | Gas volume used                                 |
| reason          | String     | Error details in case of failure                |
| status          |            | <p>Transaction status value</p><p>See below</p> |
| transactionHash | String     | Transaction hash                                |

#### Transaction status value

| Code | Description |
| ---- | ----------- |
| 0x1  | Success     |
| 0x0  | Fail        |

#### Example

```json
{
  "resultCode":"200",
  "resultMessage":"success",
  "resultData":{
    "userOpHash":"0xdba638a19c23ee0f69fb9e8683528531211d1a9deb8c93402c9294b170080415",
    "success":"true",
    "actualGasCost":595091657654760,
    "actualGasUsed":169890,
    "reason":"",
    "status":"0x1",
    "transactionHash":"0xe822beb4b6700802df2b5bf459afa1bef5e53b83c47b75126c8b5e4450968675"
  }
}
```

If userOpHash is invalid or pending, the error below is returned.

```json
{
  "resultCode":"532",
  "resultMessage":"USEROP_RECEIPT_NOT_FOUND",
  "resultData":""
}
```

### sa\_erc20\_transfer <a href="#sa_erc20_transfer" id="sa_erc20_transfer"></a>

Create and submit an ERC20 token transfer transaction using user operation. The result is a user operation hash. You can check the success of the returned user operation hash through sc\_getUserOpReceipt.

Because it is processed as a user operation, it is processed even if neither the owner nor the sender have a balance in the network's main coin (e.g. Ether, BNB) for gas fees. The gas fee will be paid on your behalf from your predefined payment master account.

#### Parameters <a href="#parameter" id="parameter"></a>

| Name            | Type       | Description                                                                                                                                |
| --------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| contractAddress | String     | Token contract address                                                                                                                     |
| owner           | String     | Owner address of smart account                                                                                                             |
| sender          | String     | <p>Sender address</p><p>(Must be a smart account)</p>                                                                                      |
| toAddress       | String     | To address                                                                                                                                 |
| amount          | BigDecimal | Amount of transfer                                                                                                                         |
| gasPrice        | BigDecimal | Gas price                                                                                                                                  |
| tempKey         | String     | tempKey for “transfer”                                                                                                                     |
| hashKey         | String     | hash(tempKey \| secretKey)                                                                                                                 |
| signature       | String     | sign ( hash ( contractAddress \| owner \| sender \| toAddress \| amount \| tempKey \| hashKey ) ) by owner’s privateKey using signData API |

#### Return Value <a href="#parameter" id="parameter"></a>

| Name       | Type   | Description         |
| ---------- | ------ | ------------------- |
| userOpHash | String | User Operation Hash |

#### Example

```json
{
  "resultCode":"200",
  "resultMessage":"success",
  "resultData":{
    "userOpHash":"0xdba638a19c23ee0f69fb9e8683528531211d1a9deb8c93402c9294b170080415"
  }
}
```


# Chain Application API

### [ServerWallet API](https://docs.finenex.net/application-apis/account)

You can create and use a private key using the Server Wallet.

* createAccount
* getAddressInfo
* exportAddress
* importAddress
* importAddressWithPrivateKey
* getAddressTokenList

### [Payment API](https://docs.finenex.net/application-apis/payment-apis/payment-grpc)

PaymentAPIs offers an easily applicable blockchain-based reward and payment feature through its console and API.

* [Points (REST)](https://docs.finenex.net/application-apis/payment-apis/points-rest)

### [IPFS API](https://docs.finenex.net/application-apis/ipfs-apis)

We provide a private IPFS service for storage of non-fungible content.\
You can find a developer reference for private IPFS here.

* [API References](https://docs.finenex.net/application-apis/ipfs-apis/api-references)


# ServerWallet API

ServerWallet APIs support HTTP protocol.  It uses /wallet path.

## Endpoint

> **Real Server :** [**https://api.finenex.net/wallet**](https://api.finenex.net/wallet)
>
> **Test Server :** [**https://test-api.finenex.net/wallet**](https://test-api.finenex.net/wallet)

### createAddress

Returns a new address. After generating a new private key in Server Wallet, Address, secretKey, and mnemonic are returned.

#### Parameters

| Name    | Type   | Description                                                                                         |
| ------- | ------ | --------------------------------------------------------------------------------------------------- |
| addInfo | String | <p>Address Information. This can be retrieved using the getAddressInfo API.<br>Max length : 200</p> |

#### Return Value

| Name      | Type   | Description                                                                                                                            |
| --------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------- |
| address   | String | Address                                                                                                                                |
| secretKey | String | It is used for authentication when requesting SignData to the Server Wallet. It cannot be viewed or exported, so it must be kept well. |
| mnemonic  | String | Used for address recovery if necessary                                                                                                 |

{% hint style="info" %}
A new secretKey is created when ImportAddress is called.
{% endhint %}

#### Example

```
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "address": "0xce808360b37030c29bdf3eacbc6c8cda62c04c39",
            "mnemonic": "bulk tomorrow beauty tag fragile rough quit antique shock river powder ghost",
            "secretKey": "49d274d8fcbd00b862dbfb01a759d233"
        }
    }
}
```

### getAddressInfo

Return an address information.

#### Parameters

| Name    | Type   | Description |
| ------- | ------ | ----------- |
| address | String | Address     |

#### Return Value

| Name    | Type   | Description                                         |
| ------- | ------ | --------------------------------------------------- |
| address | String | Address                                             |
| addInfo | String | Address information saved when creating an address. |

#### Example

```
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "address": "0xce808360b37030c29bdf3eacbc6c8cda62c04c39",
            "mnemonic": "My Test Address"
        }
    }
}
```

### exportAddress

Returns the mnemonic of a given address. if hashKey is not correct, it will return error.

#### Parameters

| Name         | Type   | Description                                       |
| ------------ | ------ | ------------------------------------------------- |
| address      | String | Address                                           |
| languageType | String | mnemonic language (Currently only "en" available) |
| tempKey      | String | tempKey for "exportAddress"                       |
| hashKey      | String | hash(tempKey \| secretKey)                        |

#### Return Value

| Name     | Type   | Description                             |
| -------- | ------ | --------------------------------------- |
| mnemonic | String | Used for address recovery if necessary. |

#### Example

```
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "mnemonic": "bulk tomorrow beauty tag fragile rough quit antique shock river powder ghost"
        }
    }
}
```

### importAddress

Import an Address using mnemonic. Store private key in Server Wallet, and Address, secretKey, and mnemonic are returned.

#### Parameters

| Name         | Type   | Description                                                                                         |
| ------------ | ------ | --------------------------------------------------------------------------------------------------- |
| languageType | String | mnemonic language (Currently only "en" available)                                                   |
| mnemonic     | String | Mnemonic String                                                                                     |
| addInfo      | String | <p>Address Information. This can be retrieved using the getAddressInfo API.<br>Max length : 200</p> |

#### Return Value

| Name      | Type   | Description                                                                                                                            |
| --------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------- |
| address   | String | Address                                                                                                                                |
| secretKey | String | It is used for authentication when requesting SignData to the Server Wallet. It cannot be viewed or exported, so it must be kept well. |
| mnemonic  | String | Address can be restored using Mnemonic.                                                                                                |

#### Example

```
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "address": "0xce808360b37030c29bdf3eacbc6c8cda62c04c39",
            "mnemonic": "bulk tomorrow beauty tag fragile rough quit antique shock river powder ghost",
            "secretKey": "49d274d8fcbd00b862dbfb01a759d233"
        }
    }
}
```

### importAddressWithPrivateKey

Import an Address using private key. Store private key in Server Wallet, and Address, secretKey are returned. Unlike importAddress , mnemonic is not returned.

#### Parameters

| Name       | Type   | Description                                                                                         |
| ---------- | ------ | --------------------------------------------------------------------------------------------------- |
| privateKey | String | private Key                                                                                         |
| addInfo    | String | <p>Address Information. This can be retrieved using the getAddressInfo API.<br>Max length : 200</p> |

#### Return Value

| Name      | Type   | Description                                                                                                                            |
| --------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------- |
| address   | String | Address (0x....)                                                                                                                       |
| secretKey | String | It is used for authentication when requesting SignData to the Server Wallet. It cannot be viewed or exported, so it must be kept well. |
| mnemonic  | String | empty.                                                                                                                                 |

#### Example

```
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "address": "0xce808360b37030c29bdf3eacbc6c8cda62c04c39",
            "mnemonic": "",
            "secretKey": "49d274d8fcbd00b862dbfb01a759d233"
        }
    }
}
```

### getAddressTokenList

Returns a list of tokens held by address.

#### Parameters

| Name    | Type   | Description |
| ------- | ------ | ----------- |
| address | String | Address     |

#### Return Value

| Name            | Type       | Description                                                               |
| --------------- | ---------- | ------------------------------------------------------------------------- |
| address         | String     | Address                                                                   |
| contractAddress | String     | Contract address of token.                                                |
| symbol          | String     | Symbol of token.                                                          |
| tokenType       | String     | Type of token "ERC20", "ERC721", "ERC1155"                                |
| tokenId         | BigInteger | tokenId of ERC1155, In case of ERC20, ERC721 token, it is the blank.      |
| balance         | BigDecimal | Balance of token. In case of ERC1155 token, it is the balance of tokenId. |

#### Example

```
{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": { 
            [ 
                { 
                    "address": "0x39fdfdsfsdsdfsdf9sd0sfds9fsd0fsdgsd",
                    "contractAddress": "0xce808360b37030c29bdf3eacbc6c8cda62c04c39",
                    "symbol": "TOK1",
                    "tokenType": "ERC20",
                    "tokenId": "",
                    "balance": "10.292"
                },
                { 
                    "address": "0x39fdfdsfsdsdfsdf9sd0sfds9fsd0fsdgsd",
                    "contractAddress": "0xce808360b37030c29bdf3eacbc6c8cda62c04c39",
                    "symbol": "TOK2",
                    "tokenType": "ERC1155",
                    "tokenId": "2",
                    "balance": "10"
                }
            ]
        }
    }
}
```

### signData

Returns data signed with the private key of address to make a transaction.

#### Parameters

| Name    | Type   | Description                                       |
| ------- | ------ | ------------------------------------------------- |
| address | String | Address                                           |
| data    | String | Data to be signed. This is probably a hash value. |
| tempKey | String | tempKey for "signData"                            |
| hashKey | String | hash(tempKey \| secretKey)                        |

#### Return Value

| Name       | Type   | Description |
| ---------- | ------ | ----------- |
| signedData | String | Signed data |

#### Example

```
{
    "jsonrpc": "2.0",
    "id": "00456", 
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "signedData": "3043021f6741c7c4ec...ac6d7f7ba8350608"
        }
    }
}
```

###


# Payment API

Payment APIs offers an easily applicable blockchain-based reward and payment feature through its console and API.


# Payment (gRPC)

## Protocol

We use gRPC/Protocol buffers to communicate with the POS application (for a store), the TokenPay application (for a user), and the Payment server.

#### Messages

```protobuf
message Common {
    string target_name = 1; // Payments
    string target_svc = 2; // payments.finenex.net
    string target_package = 3; // g00.payments.v1
    string target_api = 4;
    string source_svc = 5;
    string source_ver = 6;
    string source_addr = 7;
    string req_timestamp = 8;
    string language_code = 9;
    string rsp_timestamp = 10;
    string tran_no = 11;
    string res_code = 12;
    string res_message = 13;
}

message PayData {
    enum State {
        START_PAY = 0;
        REQUEST_TRANSFER = 1;
        TRANSFER = 2;
        END_PAY = 3;
        START_REWARD = 4;
        END_REWARD = 5;
    }

    message Content {
        State state = 1;
        string tran_no = 2;
        string user_uuid = 3;
        string token_id = 4; // not used; only for compatibility
        string user_address = 5;
        int64 expiration_time = 6;
        string settlement_address = 7;
        string store_name = 8;
        string token_amount = 9;
        string transfer_key = 10;
        string transfer_signature = 11;
        string transfer_comment = 12;
        string transfer_transaction_id = 13;
        string approval_no = 14;
        string approval_date = 15;
        string exchange_date_index = 16;
        string exchange_rate = 17;
        string exchange_amount = 18;
        string exchange_currency = 19;
        string reward_id = 20;
        string reward_date = 21;
        string reward_reason = 22;
        string tid = 23;
        string contract_address = 24;
        string token_symbol = 25;
        string hash_key = 26;
    }

    Common common = 1;
    Content content = 2;
}
```

A message consists of a "common" and a "content" fields. Fields in the "common " are fields commonly used in all APIs. Fields in the "content" are different depending on how API is used. However currently only PayData is used.

| Field Name      | Description                                   |
| --------------- | --------------------------------------------- |
| target\_name    | "Payment API"                                 |
| target\_svc     | "payments.finenex.net"                        |
| target\_package | Should be "g00.payments.v2"                   |
| target\_api     | API name                                      |
| source\_svc     | Source service name                           |
| source\_ver     | Source version                                |
| source\_addr    | Source address, for example IP                |
| req\_timestamp  | Request timestamp                             |
| rsp\_timestamp  | Response timestamp (only set on the response) |
| tran\_no        | Request serial number                         |
| res\_code       | Response code (only set on the response)      |
| res\_message    | Response message (only set on the response)   |

#### Services

```protobuf
service PaymentsService {
    rpc StartPayment(stream PayData) returns (stream PayData);

    rpc DoPayment(stream PayData) returns (stream PayData);

    rpc CancelPayment(PayData) returns (PayData);

    rpc IssueReward(PayData) returns (PayData);

    rpc CancelReward(PayData) returns (PayData);
}
```

## Payment

### Approval

The POS uses StartPayment method, while the TokenPay uses DoPayment method. These methods are implemented as bidirectional streaming RPC.

![](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2FaqdN5NV2d0kvMoOWHy3k%2Fpayment.png?alt=media\&token=e533a7b0-753b-42e7-9455-6620e96cef2e)

#### DoPayment(START\_PAY)

The TokenPay connects to the Payment server.

| Field Name  | Description      |
| ----------- | ---------------- |
| target\_api | "doPayment"      |
| state       | State.START\_PAY |

#### StartPayment(START\_PAY)

The POS connects to the Payment server and starts a payment transaction. The QR code is read from the TokenPay application.

| Field Name        | Description                                   |
| ----------------- | --------------------------------------------- |
| target\_api       | "startPayment"                                |
| state             | State.START\_PAY                              |
| tid               | Store TID                                     |
| tran\_no          | Transaction number created by POS             |
| exchange\_amount  | Currency amount                               |
| user\_uuid        | User ID in the QR code read from the TokenPay |
| contract\_address | Token contract address in the QR code         |
| token\_symbol     | Token symbol in the QR code                   |
| user\_address     | User account address in the QR                |
| expiration\_time  | Transaction expiration time in the QR code    |

#### DoPayment(REQUEST\_TRANSFER)

The Payment server sends a token transfer request to the TokenPay.

| Field Name                | Description                                                      |
| ------------------------- | ---------------------------------------------------------------- |
| target\_api               | "doPayment"                                                      |
| state                     | State.REQUEST\_TRANSFER                                          |
| tran\_no                  | Transaction number                                               |
| contract\_address         | Token contract address                                           |
| token\_amount             | Token amount                                                     |
| settlement\_address       | Store account address to transfer                                |
| store\_name               | Store name to transfer                                           |
| transfer\_comment         | Transfer comment                                                 |
| exchange\_\_date\_in\_dex | <p>Exchange rate notice date and index<br>(yyyyMMdd + NNNNN)</p> |
| exchange\_rate            | Exchange rate                                                    |
| exchange\_amount          | Currency amount                                                  |

#### StartPayment(REQUEST\_TRANSFER)

The POS is informed that the user is preparing a bank transfer.

| Field Name  | Description             |
| ----------- | ----------------------- |
| target\_api | "startPayment"          |
| state       | State.REQUEST\_TRANSFER |
| tran\_no    | Transaction number      |

#### DoPayment(TRANSFER)

The user sends relevant information for transfer from the user account to the store account (settlement address).

| Field Name          | Description                  |
| ------------------- | ---------------------------- |
| target\_api         | "doPayment"                  |
| state               | State.TRANSFER               |
| tran\_no            | Transaction number           |
| transfer\_key       | Temp key for token transfer  |
| hash\_key           | Hash key for token transfer  |
| transfer\_signature | Signature for token transfer |
| transfer\_comment   | Transfer comment             |

#### StartPayament(END\_PAY)

If the transfer is successful, the approval result is returned.

| Field Name                    | Description                         |
| ----------------------------- | ----------------------------------- |
| target\_api                   | "startPayment"                      |
| state                         | State.END\_PAY                      |
| tran\_no                      | Transaction number                  |
| contract\_address             | Token contract address              |
| token\_symbol                 | Token symbol                        |
| user\_address                 | User account address transferred    |
| token\_amount                 | Token amount                        |
| transfer\_\_transaction\_\_id | Transaction ID in the block-chain   |
| approval\_no                  | Approval number                     |
| approval\_date                | Approval date (yyyyMMddHHmmss)      |
| exchange\_\_date\_\_index     | Exchange rate notice date and index |
| exchange\_rate                | Exchange rate                       |
| exchange\_amount              | Currency amount                     |

#### DoPayment(END\_PAY)

If the transfer is successful, the approval result is returned.

| Field Name                    | Description                         |
| ----------------------------- | ----------------------------------- |
| target\_api                   | "doPayment"                         |
| state                         | State.END\_PAY                      |
| tran\_no                      | Transaction number                  |
| contract\_address             | Token contract address              |
| token\_symbol                 | Token symbol                        |
| user\_address                 | User account address transferred    |
| token\_amount                 | Token amount                        |
| transfer\_\_transaction\_\_id | Transaction ID in the block-chain   |
| exchange\_\_date\_\_index     | Exchange rate notice date and index |
| exchange\_rate                | Exchange rate                       |
| exchange\_amount              | Currency amount                     |

### Cancellation

The POS uses CancelPayment method. If successful, the token from the store account is transferred to the user account. The request is as follows.

| Field Name                    | Description                                      |
| ----------------------------- | ------------------------------------------------ |
| target\_api                   | "cancelPayment"                                  |
| tid                           | Transaction number created by POS                |
| transfer\_\_transaction\_\_id | Transaction ID of token transfer of the approval |
| contract\_address             | Token contract address                           |
| token\_symbol                 | Token symbol                                     |
| user\_address                 | User account address                             |
| token\_amount                 | Token amount                                     |
| exchange\_amount              | Currency amount                                  |

The response is as follows.

| Field Name                    | Description                                                               |
| ----------------------------- | ------------------------------------------------------------------------- |
| contract\_address             | Token contract address                                                    |
| token\_symbol                 | Token symbol                                                              |
| user\_address                 | User account address to be transferred                                    |
| token\_amount                 | Token amount                                                              |
| transfer\_\_transaction\_\_id | Transaction ID of the transfer from the store account to the user account |
| approval\_no                  | Approval cancellation number                                              |
| approval\_date                | Approval cancellation date (yyyyMMddHHmmss)                               |

## Reward

### Issuance

The POS uses IssueReward method. The request is as follows.

| Field Name       | Description                               |
| ---------------- | ----------------------------------------- |
| target\_api      | "issueReward"                             |
| tid              | Store TID                                 |
| reward\_reason   | Reward reason to avoid reward duplication |
| exchange\_amount | Reward amount                             |

The response is as follows.

| Field Name                | Description                                  |
| ------------------------- | -------------------------------------------- |
| contract\_address         | Token contract address                       |
| token\_symbol             | Token symbol                                 |
| token\_amount             | Token amount as a reward                     |
| exchange\_\_date\_\_index | Exchange rate notice date and index          |
| exchange\_rate            | Exchange rate                                |
| exchange\_amount          | Currency amount                              |
| reward\_id                | Reward ID which is used for a reward request |
| reward\_date              | Rewarded date (yyyyMMddHHmmss)               |

### Reward

There are two ways to reward. The first is to reward at the POS.

The POS uses StartPayment method, while the TokenPay uses DoPayment method. These methods are implemented as bidirectional streaming RPC.ima

![](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2Fy0xyuJgfnyqxPMQ49XP9%2Freward.png?alt=media\&token=5acf6775-46bb-410b-9559-3610af218103)

#### DoPayment(START\_PAY)

The TokenPay app connects to the Payment server.

| Field Name  | Description                                             |
| ----------- | ------------------------------------------------------- |
| target\_api | "doPayment"                                             |
| state       | <p>State.START\_PAY</p><p>(Not State.START\_REWARD)</p> |

#### StartPayment(START\_REWARD)

| Field Name    | Description                                 |
| ------------- | ------------------------------------------- |
| target\_api   | "StartPayment"                              |
| state         | State.START\_REWARD                         |
| tid           | Store TID                                   |
| tran\_no      | Transaction number create by POS            |
| reward\_id    | Reward ID                                   |
| token\_amount | Token amount as a reward                    |
| user\_uuid    | User ID in the QR code read by the TokenPay |
| user\_address | User account address in the QR code         |

#### DoPayment(END\_REWARD)

| Field Name              | Description                         |
| ----------------------- | ----------------------------------- |
| state                   | State.END\_REWARD                   |
| contract\_address       | Token contract address              |
| token\_symbol           | Token symbol                        |
| user\_address           | User account address to be rewarded |
| token\_amount           | Token amount as a reward            |
| exchange\_*date*\_index | Exchange rate notice date and index |
| exchange\_rate          | Exchange rate                       |
| exchange\_amount        | Currency amount                     |

#### StartPayment(END\_REWARD)

| Field Name              | Description                         |
| ----------------------- | ----------------------------------- |
| state                   | State.END\_REWARD                   |
| contract\_address       | Token contract address              |
| token\_symbol           | Token symbol                        |
| user\_address           | User account address to be rewarded |
| token\_amount           | Token amount as a reward            |
| exchange\_*date*\_index | Exchange rate notice date and index |
| exchange\_rate          | Exchange rate                       |
| exchange\_amount        | Currency amount                     |

The second way is to reward from receipts printed at the POS.

<img src="https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2FYSExJxKaotXyJ516JtIH%2Freward2.png?alt=media&amp;token=c8c57b5f-3dba-4f7d-b0f0-23f318dbb631" alt="" width="541">

#### DoPayment(START\_REWARD)

| Field Name    | Description                        |
| ------------- | ---------------------------------- |
| target\_api   | "StartPayment"                     |
| state         | State.START\_REWARD                |
| reward\_id    | Reward ID read from the receipt    |
| token\_amount | Token amount read from the receipt |
| token\_symbol | Token symbol read from the receipt |
| user\_address | User account address               |

#### DoPayment(END\_REWARD)

| Field Name              | Description                         |
| ----------------------- | ----------------------------------- |
| state                   | State.END\_REWARD                   |
| contract\_address       | Token contract address              |
| token\_symbol           | Token symbol                        |
| user\_address           | User account address to be rewarded |
| token\_amount           | Token amount as a reward            |
| exchange\_*date*\_index | Exchange rate notice date and index |
| exchange\_rate          | Exchange rate                       |
| exchange\_amount        | Currency amount                     |

### Cancellation

The POS uses CancelReward method. The request is as follows.

| Field Name    | Description    |
| ------------- | -------------- |
| target\_api   | "cancelReward" |
| rewar\_id     | Reward ID      |
| token\_amount | Token amount   |

The response is as follows.

| Field Name                    | Description                                            |
| ----------------------------- | ------------------------------------------------------ |
| contract\_address             | "cancelReward"                                         |
| token\_symbol                 | Token symbol                                           |
| user\_address                 | User account address to be rewarded                    |
| token\_amount                 | Token amount                                           |
| transfer\_\_transaction\_\_id | Transaction ID of the transfer for reward cancellation |
| approval\_no                  | Approval cancellation number                           |
| approval\_date                | Approval cancellation date (yyyyMMddHHmmss)            |

## Error

For each request, the Payment server sends a response with resCode and resMessage.

| Type    | resCode | resMessage               |
| ------- | ------- | ------------------------ |
| Common  | 00      | Success                  |
|         | 10      | Internal server error    |
| Payment | 01      | Canceled by the user     |
|         | 02      | Insufficient balance     |
|         | 03      | Transaction time expired |
|         | 04      | Token API error          |
| Reward  | 01      | Reward not issued        |
|         | 02      | Reward expired           |
|         | 03      | Reward already canceled  |
|         | 04      | Bad reward amount        |
|         | 05      | Already rewarded         |


# Points (REST)

## Endpoint

> **Real Server :** [**https://api.finenex.net/v1**](https://api.finenex.net/v1)
>
> **Test Server :** [**https://test1-api.finenex.net/v1**](https://test1-api.finenex.net/v1)

## Authentication

To make a request, you need to include the JWT in the HTTP header. JWT can be received through the authentication server.

#### Example

If JWT is "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NDgyMDc1OTIsImlhdCI6MTY0ODEyMTE5Mn0.AYNcBLhKqtqwzxNm7kOREEUH0\_3gFevOXxI94TBORao",

```
curl -X 'POST' \
  '{endpoint}/nlp/issue' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NDgyMDc1OTIsImlhdCI6MTY0ODEyMTE5Mn0.AYNcBLhKqtqwzxNm7kOREEUH0_3gFevOXxI94TBORao' \
  -H 'Content-Type: application/json' \
  -d '{
  "tokenAmount": "10"
}'
```

## API References

### Issue

{% openapi src="/files/FfZ24VDpByNXvNRqlNsA" path="/points/{name}/issue" method="post" %}
[points.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2FrIAcmVKUoGFBV8mXXXmb%2Fpoints.yaml?alt=media\&token=52b61b24-b370-45bc-93b7-fce96d211329)
{% endopenapi %}

{% hint style="info" %}
If tranNo, amount, and the token name of recently issued points are the same, it is treated as a duplicate issuance and is failed.
{% endhint %}

#### Example

{% tabs %}
{% tab title="Reqeust" %}

```
curl -X 'POST' \
  '{endpoint}/points/nlp/issue' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNzgxNTgsImlhdCI6MTY1MjE5MTc1OH0.MqMd26110LlpuVrY-17so_WJ0icVlom0iqbp_0dVo58' \
  -H 'Content-Type: application/json' \
  -d '{
  "tokenAmount": "10",
  "tid": "test01"
}'
```

{% endtab %}

{% tab title="Response" %}

```
{
  "rewardId": "6500627A723D0000",
  "tokenSymbol": "NLP",
  "tokenAmount": "10",
  "contractAddress": "0x31a093de11a38d00ec33f112cac623afb1ae9276",
  "rewardDate": "20220510231005+0900"
}
```

{% endtab %}
{% endtabs %}

### Accumulate

{% openapi src="/files/FfZ24VDpByNXvNRqlNsA" path="/points/{name}/{rewardId}/accumulate" method="post" %}
[points.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2FrIAcmVKUoGFBV8mXXXmb%2Fpoints.yaml?alt=media\&token=52b61b24-b370-45bc-93b7-fce96d211329)
{% endopenapi %}

#### Example

{% tabs %}
{% tab title="Request" %}

```
curl -X 'POST' \
  '{endpoint}/points/nlp/6500627A723D0000/accumulate' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNzgxNTgsImlhdCI6MTY1MjE5MTc1OH0.MqMd26110LlpuVrY-17so_WJ0icVlom0iqbp_0dVo58' \
  -H 'Content-Type: application/json' \
  -d '{
  "tokenAmount": "10",
  "userAddress": "user-address"
}'
```

{% endtab %}

{% tab title="Response" %}

```
{
  "userAddress": "user-address",
  "tokenSymbol": "NLP",
  "tokenAmount": "10.00",
  "contractAddress": "0x31a093de11a38d00ec33f112cac623afb1ae9276"
}
```

{% endtab %}
{% endtabs %}

### Status

{% openapi src="/files/FfZ24VDpByNXvNRqlNsA" path="/points/{name}/{rewardId}/status" method="get" %}
[points.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2FrIAcmVKUoGFBV8mXXXmb%2Fpoints.yaml?alt=media\&token=52b61b24-b370-45bc-93b7-fce96d211329)
{% endopenapi %}

#### Example

{% tabs %}
{% tab title="Request" %}

```
curl -X 'GET' \
  '{endpoint}/points/nlp/6500627A723D0000/status' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNzgxNTgsImlhdCI6MTY1MjE5MTc1OH0.MqMd26110LlpuVrY-17so_WJ0icVlom0iqbp_0dVo58'
```

{% endtab %}

{% tab title="Response" %}

```
{
  "userAddress": "user-address",
  "accumulated": true,
  "tokenSymbol": "NLP",
  "contractAddress": "0x31a093de11a38d00ec33f112cac623afb1ae9276"
}
```

{% endtab %}
{% endtabs %}

### Cancel

{% openapi src="/files/FfZ24VDpByNXvNRqlNsA" path="/points/{name}/{rewardId}/cancel" method="post" %}
[points.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2FrIAcmVKUoGFBV8mXXXmb%2Fpoints.yaml?alt=media\&token=52b61b24-b370-45bc-93b7-fce96d211329)
{% endopenapi %}

#### Example

{% tabs %}
{% tab title="Request" %}

```
curl -X 'POST' \
  '{endpoint}/points/nlp/6500627A723D0000/cancel' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNzgxNTgsImlhdCI6MTY1MjE5MTc1OH0.MqMd26110LlpuVrY-17so_WJ0icVlom0iqbp_0dVo58' \
  -H 'Content-Type: application/json' \
  -d '{
  "tokenAmount": "10"
}'
```

{% endtab %}

{% tab title="Response" %}

```
{
  "userAddress": "user-address",
  "tokenSymbol": "NLP",
  "tokenAmount": "10",
  "contractAddress": "0x31a093de11a38d00ec33f112cac623afb1ae9276"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
The token amount should be the same as when the points are issued.
{% endhint %}

## Error Codes (resCode)

* 200: Success
* 400: Bad parameters
* 401: Unauthenticated
* 404: Not found
* 500: Internal server error. Please see resMessage


# IPFS API

We provide private IFPS services. You can use the private IPFS service by referring to this document.

## REST API

It exposes the HTTP API that allows you to control the private IPFS node and run the same commands you can from the command line.

* [add](https://docs.finenex.net/application-apis/ipfs-apis/api-references#api-v0-add)
* [cat](https://docs.finenex.net/application-apis/ipfs-apis/api-references#api-v0-cat)
* [get](https://docs.finenex.net/application-apis/ipfs-apis/api-references#get)
* [id](https://docs.finenex.net/application-apis/ipfs-apis/api-references#api-v0-id)
* [version](https://docs.finenex.net/application-apis/ipfs-apis/api-references#api-v0-version)

## Endpoint

> **Real Server :** [**https://api.finenex.net/v1**](https://api.finenex.net/v1)
>
> **Test Server :** [**https://test1-api.finenex.net/v1**](https://test1-api.finenex.net/v1)

## Status Codes

Status codes used at the RPC layer are simple:

* 200 - The request was processed or is being processed (streaming)
* 500 - RPC endpoint returned an error
* 400 - Malformed RPC, argument type error, etc
* 403 - RPC call forbidden
* 404 - RPC endpoint doesn't exist
* 405 - HTTP Method Not Allowed

Status code 500 means that the function does exist, but private IPFS was not able to fulfill the request because of an error. To know that reason, you have to look at the the error message that is usually returned with the body of the response.

Streaming endpoints fail as above, unless they have started streaming. That means they will have sent a 200 status code already. If an error happens during the stream, it will be included in a Trailer response header (some endpoints may additionally include an error in the last streamed object).

A 405 error may mean that you are using the wrong HTTP method (i.e. GET instead of POST), or that you are not allowed to call that method (i.e. due to CORS restrictions when making a request from a browser)

## Gateway

The priavte IPFS deployment seeks to include native support for all popular browsers and tools.\
Gateways provide workarounds for applications that do not yet support IPFS natively.\
For example, errors occur when a browser that does not support IPFS attempts access to IPFS content in the canonical form of ipfs\://{CID}/{optional path to resource}. Other tools that rely solely on HTTP encounter similar errors in accessing IPFS content in canonical form, such as Curl (opens new window)and Wget (opens new window).

This gateway provide an HTTP-based service that allows IPFS-ignorant browsers and tools to access private IPFS content.

If you add a file or directory into private IPFS, you can view them in the browser.


# API References

Private IPFS for NFT

### Add

{% openapi src="/files/QTU4j8fMYG9Fmsrk3GXJ" path="/ipfs/add" method="post" %}
[ipfs.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2Fxv4gWSnDg2KetPTwCeWK%2Fipfs.yaml?alt=media\&token=312e329b-4066-4a6d-8cdf-7389dfefe1c5)
{% endopenapi %}

#### Request Body

This endpoint expects one or several files (depending on the command) in the body of the request as 'multipart/form-data'.

The `add` command not only allows adding files, but also uploading directories and complex hierarchies.

This happens as follows: Every part in the multipart request is a *directory* or a *file* to be added to IPFS.

Directory parts have a special content type `application/x-directory`. These parts do not carry any data. The part headers look as follows:

```
Content-Disposition: form-data; name="file"; filename="folderName"
Content-Type: application/x-directory
```

File parts carry the file payload after the following headers:

```
Abspath: /absolute/path/to/file.txt
Content-Disposition: form-data; name="file"; filename="folderName%2Ffile.txt"
Content-Type: application/octet-stream

...contents...
```

The above file includes its path in the "folderName/file.txt" hierarchy and IPFS will therefore be able to add it inside "folderName". The parts declaring the directories are optional when they have files inside and will be inferred from the filenames. In any case, a depth-first traversal of the directory tree is recommended to order the different parts making the request.

The `Abspath` header is included for filestore/urlstore features that are enabled with the `nocopy` option and it can be set to the location of the file in the filesystem (within the IPFS root), or to its full web URL.

#### Example

{% tabs %}
{% tab title="Request" %}

```
curl -X 'POST' \
  '{endpoint}/ipfs/add' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o' \
  -H 'Content-Type: multipart/form-data' \
  -F 'file=@file.yaml'
```

{% endtab %}

{% tab title="Response" %}

```
{
  "cid": "QmVuLWZ1cmZiujoM9y6r6nd19x9kVEARYa9NABzf6GbxRN"
}
```

{% endtab %}
{% endtabs %}

### Cat

{% openapi src="/files/QTU4j8fMYG9Fmsrk3GXJ" path="/ipfs/{cid}" method="get" %}
[ipfs.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2Fxv4gWSnDg2KetPTwCeWK%2Fipfs.yaml?alt=media\&token=312e329b-4066-4a6d-8cdf-7389dfefe1c5)
{% endopenapi %}

#### Example

{% tabs %}
{% tab title="Request" %}

```
curl -X 'GET' \
  '{endpoint}/ipfs/QmVuLWZ1cmZiujoM9y6r6nd19x9kVEARYa9NABzf6GbxRN' \
  -H 'accept: text/plain' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o'
```

{% endtab %}

{% tab title="Response" %}

```
File contents
```

{% endtab %}
{% endtabs %}

### Get

{% openapi src="/files/QTU4j8fMYG9Fmsrk3GXJ" path="/ipfs/{cid}/get" method="get" %}
[ipfs.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2Fxv4gWSnDg2KetPTwCeWK%2Fipfs.yaml?alt=media\&token=312e329b-4066-4a6d-8cdf-7389dfefe1c5)
{% endopenapi %}

#### Example

{% tabs %}
{% tab title="Request" %}

```
curl -X 'GET' \
  '{endpoint}/ipfs/QmVuLWZ1cmZiujoM9y6r6nd19x9kVEARYa9NABzf6GbxRN/get?filename=temp' \
  -H 'accept: application/x-tar' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o'
```

{% endtab %}

{% tab title="Response" %}

```
Tar file
```

{% endtab %}
{% endtabs %}

### Id

{% openapi src="/files/QTU4j8fMYG9Fmsrk3GXJ" path="/ipfs/id" method="get" %}
[ipfs.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2Fxv4gWSnDg2KetPTwCeWK%2Fipfs.yaml?alt=media\&token=312e329b-4066-4a6d-8cdf-7389dfefe1c5)
{% endopenapi %}

#### Example

{% tabs %}
{% tab title="Request" %}

```
curl -X 'GET' \
  '{endpoint}/ipfs/id' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o'
```

{% endtab %}

{% tab title="Response" %}

```
{
  "id": "12D3KooWN4tTkHvjMttH77tMtcTBz5HJqEfNveJsnDo828JjHcjL"
}
```

{% endtab %}
{% endtabs %}

## Version <a href="#api-v0-version" id="api-v0-version"></a>

{% openapi src="/files/QTU4j8fMYG9Fmsrk3GXJ" path="/ipfs/version" method="get" %}
[ipfs.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2Fxv4gWSnDg2KetPTwCeWK%2Fipfs.yaml?alt=media\&token=312e329b-4066-4a6d-8cdf-7389dfefe1c5)
{% endopenapi %}

#### Example

{% tabs %}
{% tab title="Request" %}

```
curl -X 'GET' \
  '{endpoint}/ipfs/version' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o'
```

{% endtab %}

{% tab title="Response" %}

```
{
  "version": "0.10.0"
}
```

{% endtab %}
{% endtabs %}


# Chain API Errors

Describes error codes returned by token APIs and block APIs.

| resultCode | resultMessage                   | remark |
| ---------- | ------------------------------- | ------ |
| 200        | Success                         |        |
| 500        | Internal Server Error           |        |
| 501        | Signature Verify Error          |        |
| 502        | Signature Verify Fail           |        |
| 503        | Invalid TempKey                 |        |
| 504        | Sign Transaction Error          |        |
| 505        | Contract Address Not Found      |        |
| 506        | Contract Address Type Not Match |        |
| 507        | Address Not Found               |        |
| 508        | Address invalid                 |        |
| 509        | Address information invalid     |        |
| 510        | Contract address invalid        |        |
| 511        | Contract name invalid           |        |
| 512        | Token description invalid       |        |
| 513        | Symbol invalid                  |        |
| 514        | Comment invalid                 |        |
| 515        | Transaction id invalid          |        |
| 516        | Date invalid                    |        |
| 517        | Meta data invalid               |        |
| 518        | Order invalid                   |        |
| 519        | Batch count not match           |        |
| 520        | Decimal point invalid           |        |


