API Documentation

Website Cryptocurrency Mining

Introduction

The API allows users to programmatically connect with the blockchain using their API key as a credential. Digital signing is carried out on the server using ECDSA which keeps the API really simple for developers.

To get started log in to the platform at https://jsecoin.com/platform/ and go to “settings”. Click the button saying show API Key. This will provide you with your API key keep this somewhere safe as anyone who gets hold of it will be able to access your account. DO NOT upload software to GitHub or public repositories containing your API key. You can set an environmental variable and access it from the server keeping the code clean.

Once you have your API key you need to set the API Access Level. 0 is set as standard and is turned off, i.e. the API key wont work. Level 1 is read access and will enable you to get balances and access some private data such as siteid’s. Level 2 is write access and gives full control to export and transfer funds. Use with caution.

Rate limiting is set to 500 queries per 15 minute period. If you start hitting limits and require more just let us know.

 

Balance

Returns a users balance. Can also be used to look up the current balance for a site id or sub id. This can be used with dynamic insertion of a subid to track earnings on a per visitor basis.

  • URL for main balance lookup: https://api.jsecoin.com/server/api/balance/:apiKey/0/
  • URL for siteid or subid query: https://api.jsecoin.com/server/api/balance/:apiKey/:lookup/
  • Method:GET
  • URL Params Required:apiKey=[string]
    lookup=[string]
  • Data Params None
  • API Access Level
    1 – Read
  • Success Response:
    • Code: 200
      Content: {“success”:1,”notification”:”Your balance is 99 JSE”,”balance”:99}
  • Error Response:
    • Code: 200
      Content: {“fail”:1,”notification”:”API key does not have read access”}
  • Sample Call:
      $.ajax({
        url: "https://jsecoin.com/server/api/balance/d23Vif2wjKc5qie29f/mysite.com/",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });

 

Transfer

Creates a transfer signed internally on the server.

  • URL: https://api.jsecoin.com/server/api/transfer/:apiKey/:toEmailOrPublicKey/:toAmount/:toReference/
  • Method:GET
  • URL Params Required:apiKey=[string]
    toEmailOrPublicKey=[string]
    toAmount=[Float]
    toReference=[String]
  • Data Params None
  • API Access Level
    2 – Write
  • Success Response:
    • Code: 200
      Content: {"success": 1, "notification":
      "Transfer Has Been Confirmed"}
  • Error Response:
    • Code: 200
      Content: {“fail”:1,”notification”:”API key not recognized”}
  • Sample Call:
      $.ajax({
        url: "https://jsecoin.com/server/api/transfer/d23Vif2wjKc5qie29f/charity@jsecoin.com/0.001/TestingTransfer/",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });

The sender and receiver will be able to see the transfer when logging into the platform under the “Recent Transactions” Table.

 

Export

Exports coin codes from your account.

  • URL https://api.jsecoin.com/server/api/export/:apiKey/:exportAmount/
  • Method:GET
  • URL Params Required:apiKey=[string]
    exportAmount=[Float]
  • Data Params None
  • API Access Level
    2 – Write
  • Success Response:
    • Code: 200
      Content: {“success”:1,”coinCode”:”43iDFSdXsdf8fsSDEFC9jf93qfjAf'”,”notification”:”Export Successful”}
  • Error Response:
    • Code: 200
      Content: {“fail”:1,”notification”:”Failed: Error 709 – Could Not Verify Data Signature”}
  • Sample Call:
      $.ajax({
        url: "https://jsecoin.com/server/api/export/d23Vif2wjKc5qie29f/0.001/",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });

Exported coin codes via the API will also be displayed in the platform on the “Export” page.

 

Import

Imports coin codes to your account.

  • URL https://api.jsecoin.com/server/api/import/:apiKey/:coinCode/
  • Method:GET
  • URL Params Required:apiKey=[string]
    coinCode=[string]
  • Data Params None
  • API Access Level
    2 – Write
  • Success Response:
    • Code: 200
      Content: {“success”:1,”value”:”0.003″}
  • Error Response:
    • Code: 200
      Content: {“fail”:1,”notification”:”Transfer Failed: Coin Code Used”}
  • Sample Call:
      $.ajax({
        url: "https://jsecoin.com/server/api/import/d23Vif2wjKc5qie29f/fab6d9ea9b9896aa6a2833d7dbf5172e49345037b901033785f3cef23b29a47d/",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });

 

History

Download account history including transfers, exports etc.

URL https://api.jsecoin.com/server/api/history/:apiKey/

  • Method:GET
  • URL Params Required:apiKey=[string]
  • Data Params None
  • API Access Level
    1 – Read
  • Success Response:
    • Code: 200
      Content:
      {
      “success”: 1,
      “history”: {
      “-KwAMFQ7wY1H5rep7O99”: {
      “coinCode”: “9cdf7e9ca01924331c6a097eeab71903731dbasdf8ede1af308fe79f3c84941”,
      “command”: “import”,
      “publicKey”: “04f9126417e71a78e1863236416e41a416d823d36aa23140aaf74c07c8b172e79b639e5f2164a368a8698c5c5768af0967c987306c7e49415d66e0c05ef0d8eaf9”,
      “ts”: 1507724166853,
      “user1”: 123,
      “value”: 0.5
      },
      “-KwAMN2B6yvjA6-k0fYO”: {
      “command”: “transfer”,
      “data”: “{\”publicKey\”:\”04f9126417e71a78e1863236416e41a416d823d36aa23140aaf74c07c8b172e79b639e5f2164a368a8698c5c5768af0967c987306c7e49415d66e0c05ef0d8eaf9\”,\”toPublicKey\”:\”045a0688dcaf1ca952b26895f3b885b398dd7318f71f306e4d519901c4c34f12486e46345b87f00de1e381729ecddc0ef9d05c0fd5d0a9d3d1b7b3ecb92df774be\”,\”user1\”:123,\”user2\”:2895,\”command\”:\”transfer\”,\”value\”:0.001,\”tid\”:\”-KwAMMuKdv_67kklqYxj\”,\”ts\”:1507724197530}”,
      “host”: “::”,
      “publicKey”: “04f9126417e71a78e1863236416e41a416d823d36aa23140aaf74c07c8b172e79b639e5f2164a368a8698c5c5768af0967c987306c7e49415d66e0c05ef0d8eaf9”,
      “received”: 1507724198073,
      “reference”: “testing”,
      “signature”: “3045022100d423c269b7b22eebf94447a69c92adf6f2a2ec30ccb3e89f689be4e885d5a5db02200aef856f47aa9b625d55ad496838c7afed27b5c79f74a2241305ada7e4506513”,
      “tid”: “-KwAMMuKdv_67kklqYxj”,
      “toPublicKey”: “045a0688dcaf1ca952b26895f3b885b398dd7318f71f306e4d519901c4c34f12486e46345b87f00de1e381729ecddc0ef9d05c0fd5d0a9d3d1b7b3ecb92df774be”,
      “ts”: 1507724197530,
      “user1”: 123,
      “user1email”: “user@myemail.com”,
      “user2”: 2895,
      “user2email”: “charity@jsecoin.com”,
      “value”: -0.001
      }
      }
      }
  • Error Response:
    • Code: 200
      Content: {“fail”:1,”notification”:”API key not recognized”}
  • Sample Call:
      $.ajax({
        url: "https://jsecoin.com/server/api/history/d23Vif2wjKc5qie29f/",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });

 

Current Block ID

Returns the current block ID.

  • URL https://api.jsecoin.com/server/api/currentblockid/:apiKey/
  • Method:GET
  • URL Params Required:apiKey=[string]
  • Data Params None
  • API Access Level
    1 – Read
  • Success Response:
    • Code: 200
      Content: {“success”:1,”blockID”:”72318″}
  • Error Response:
    • Code: 200
      Content: {“fail”:1,”notification”:”API key not recognized”}
  • Sample Call:
      $.ajax({
        url: "https://jsecoin.com/server/api/currentblockid/d23Vif2wjKc5qie29f/",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });

 

Get Block

Returns the requested block at a given block number.

  • URL https://api.jsecoin.com/server/api/getblock/:blockNumber/:apiKey/
  • Method:GET
  • URL Params Required:
    apiKey=[string]
    blockNumber=[Float]
  • Data Params None
  • API Access Level
    1 – Read
  • Success Response:
    • Code: 200
      Content:
      {
      “success”: 1,
      “block”: {
      “blockID”: 72138,
      “blockReference”: 72,
      “difficulty”: 5,
      “frequency”: 30000,
      “hash”: “0000000000241d254ec7c966e6e7d2af3f284b37e4dc0588e2c8a75d09e09305”,
      “input”: {
      “-Kx8IgbHold–5pFx94S”: {
      “command”: “mining”,
      “user1”: 1505,
      “value”: 0.005
      },
      “-Kx8IjJs5tRmWE_-9V_E”: {
      “command”: “transfer”,
      “data”: “{\”publicKey\”:\”05 35dd069b6e876a330b25f1035b332bc6b62d3bebc7ead0a11345d790fc3d3ba48a68f375440b3360eec7176a11b5cc5be0d56c70bc85c3bcc88808943e3fcb0\”,\”toPublicKey\”:\”0486000a3a4e53d662ae3a52784dd9d8782594da56e115de9906a8f2ad69939ce74a0fce700b228150d97ab2d93ec6e31557a0e5daa962eed0f8e5948468853efe\”,\”command\”:\”transfer\”,\”value\”:0.12,\”user1\”:0,\”user2\”:25012,\”ts\”:1508763431737}”,
      “hash”: “a27e2826db85bf6a3f232thisisnttheactualhash0082642579c75131941ece2”,
      “host”: “::”,
      “publicKey”: “04d35dd069b6e876a440b25f1035b331bc6b62d3bebc7ead0a11345d790fc3d3ba48a68f375440b3360eec7176a11b5cc5be0d56c70bc85c3bcc88808943e3fcb0”,
      “received”: 1508763431744,
      “signature”: “305502207c32bb17120f1notarealsignatured0e083103cc61587255f0220514b424baf9002df0bbfaeec2162fd378be297b0609ce831f56110518d34caf3”,
      “toPublicKey”: “0576000a3a4e53d662ae3a52784dd9d8782594da56e115de9906a8f2ad69939ce74a0fce700b228150d97ab2d93ec6e31557a0e5daa962eed0f8e5948468853efe”,
      “ts”: 1508763431737,
      “user1”: 0,
      “user2”: 25046,
      “value”: 0.12
      }
      },
      “mainChain”: true,
      “nonce”: “1196562910”,
      “open”: false,
      “previousHash”: “00000068c3cc6452af485bd573b8f1ce5a5efb2b206f93447668fc13302c2153”,
      “server”: “jsecoin”,
      “startTime”: 1508763420006,
      “version”: “JSEcoin Controller v1.504”
      }
      }
  • Error Response:
    • Code: 200
      Content: {“fail”:1,”notification”:”API key not recognized”}
  • Sample Call:
      $.ajax({
        url: "https://jsecoin.com/server/api/getblock/12345/d23Vif2wjKc5qie29f/",
        dataType: "json",
        type : "GET",
        success : function(r) {
          console.log(r);
        }
      });