HPB wallet and middleware interface

Time:2020-5-26

In order to make it easier for developers to develop or use HPB wallets, HPB wallets developers have prepared a common API interface introduction.

1、 HPB version controller

1. Query version No

describe: apply wallet to query version number.

Request description

Request method: Post 
Request URL: http://47.75.96.163 :9888/HpbComponent/cms/version

Call example:

[

  "1","0"

]

Request parameter description:
HPB wallet and middleware interface

Return data example:

[

  "000000", // response status (000000: success; 999999: failure)

  "Success", // response message prompt
  {
 
 "Map": {}, // reserve map

  "Id": 36, // current version ID

  "Verno": "1.0.0", // version number

  "downloadUrl": "https://fir.im/mw6r",                             
//Download address

  "Mobiletype": 1, // mobile phone type 0 - Android 1-ios 2 - others

  "Remark": "1.0.2 test 1120180806111",                       
//Remarks

  "createTime": 1533547987870,                                      
//Create timestamp

  "updateTime": 1534570817329,                                     
//Update timestamp

  "State": "1", // status: 1-effective; 0-invalid

  "Userid": 1, // user ID

  "Isforceflag": "0", // force update: 1-yes; 0-no

  "Langtype": "0", // language type: 0-chinese; 1-english

  "Vercontent": "a1.0.2" // version content

  }

]

2、 Personal account

1. Get account balance

Description:Apply wallet user to get account balance.

Request method: Post 
Request URL: http://47.75.96.163 :9888/HpbComponent/personal/getBalance

Call example

[

  "0x09a0e8893efd605e6aaae9b0c8285a3f16e5f198"

]

Request parameter description
HPB wallet and middleware interface
Return data example:

[

  "000000", // response status (000000: success; 999999: failure)

  "Success", // response message prompt

  0 // balance

]

2. Get account nonce

Description:The random number of accounts obtained by the wallet users.

Request description:

Request method: Post 
Request URL: http://47.75.96.163 :9888/HpbComponent/personal/getNonce

Call example:

[

  "0x09a0e8893efd605e6aaae9b0c8285a3f16e5f198"

]

Request parameter description:
HPB wallet and middleware interface
Return data example:

[

   "000000", // response status (000000: success; 999999: failure)

  "Success", // response message prompt

  {
  "gasLimit": "50000",                                                                               // gasLimit

  "nonce": 0,                                                                                                 //nonce

  "gasPrice": "18000000000"                                                                 // gasPrice  
  }                                                                                  

]

3、 Personal query

1. Query transaction

describe: the application wallet queries the transaction according to the transaction hash.

Request description:

Request method: Post 
Request URL: http://47.75.96.163 :9888/HpbComponent/transaction/getTransactionByHash

Call example:

[

  " 0x78a7012f467035e4ca1a8f6dffe6e138e1a24e591ba4945de5ef74bbcb69cd63"

]

Request parameter description:
HPB wallet and middleware interface
Return data sample

[

  " 0x847af04fbd21a909726cf00aaa06acd820035d5a","0","1"

]

Request parameter description:
HPB wallet and middleware interface
Return data example:

[

  "000000",                                                                                  

//Response status (000000: success; 999999: failure)

  "Success",                                                                                                                                              

//Response message prompt

  {

 "Pagenum": 1, // current page number

 "PageSize": 10, // current page size

 "Size": 6, // data volume

 "StartRow": 1, // start row

 "EndRow": 6, // end line

  "Total": 6, // total records

  "Pages": 1, // total pages

  "List": [// data list

   {

  "Map": {}, // reserve map

  "transactionHash": "0xf467c92777a820cb92f75556b5d06f69b635197c997b910c7dc4219a83f85ef9",
                                                                                                               //Transaction hash

  "fromAccount": "0x847af04fbd21a909726cf00aaa06acd820035d5a",             

//Initiator

 "toAccount": "0x3795435afaec3bfb2388a1e2ef58108f564d3e07",                    

//Receiver

  "nonce": 4,                                                                                  //nonce

 "Tvalue": "0", // amount

  "gas": "90000",                                                                      //gas

 "gasPrice": "18000000000",                                                   //gasPrice

 "Status": "0x1", // status

 "Blockhash": "0x9163f7ff6b4611b3bd6957c4560ff3a45d4cc31f85753f6ec6819bd33d67eb34", // hash of the block

 "blockNumber": 150612,                                                  
 //Block height

 "Transactionindex": null, // sequence number of the transaction in the block

 "tTimestap": 1534820055,                                                
//Time stamp

  "Gasused": "633", // gas fee

 "remark": null,                                                                     //

 "Tinput": null, // input parameter field

 "actulTxFee": "11394000000000"

   }      

],

  "Prepage": 0, // previous page

  "NextPage": 0, // next page

  "Isfirstpage": true, // is the first page

  "Islastpage": true, // is the last page

  "Haspreviouspage": false, // whether there is a previous page

   "Hasnextpage": false, // whether there is a next page

   "Navigatepages": 8, // the maximum number of pages that can be displayed

   "Navigatepagenums": [// page number field                                                 
      1
    ],

    "Navigatefirstpage": 1, // first page

    "Navigatelastpage": 1, // last page

    "Firstpage": 1, // first page

    "Lastpage": 1 // last page

  }                                              

]

3. Send transaction

describe: the application wallet user initiates the transaction.

Request description:

Request method: Post 
Request URL: http://47.75.96.163 :9888/HpbComponent/transaction/sendRawTransaction

Call example:

[

  " 0xf467c92777a820cb92f75556b5d06f69b635197c997b910c7dc4219a83f85ef9"

]

Request parameter description:
HPB wallet and middleware interface
Return data sample

[
  "000000", // response status (000000: success; 999999: failure)

  "Success", // response message prompt

  {
  "Hash": "0xdd19d1946bc000294d5d5e2ee01943bdd07165576460bd20e73964029214071", // transaction hash

  "nonce": 2,                                                                                                  //nonce

  "Blockhash": null, // the transaction is still packing, and the block value is empty

  "Blocknumber": null, // the transaction is still packing, and the block value is empty

  "Transactionindex": null, // the transaction is still packing

  "From": "0x847af04fbd21a909726cf00aaa06acd820035d5a", // sender

  "to": "0x3795435afaec3bfb2388a1e2ef58108f564d3e07",                      
//Receiver

 "Value": 0, // value

 "gasPrice": 18000000000,                                                  //gasPrice

 "gas": 90000,                                                                          // gas number

 "Input": null, // input field

 "creates": null,  
// null

  "publicKey": null,                                                                     // null

  }                                              

]

More technical consultation

1. If you want to learn more about HPB technology, please visit our GitHub Wiki:
HPB WiKi of GitHub

2. If you want to get more HPB information, please follow our official website:
HPB Website