This commit is contained in:
progr76@gmail.com
2019-02-16 20:08:41 +03:00
parent 4087d50a65
commit 5affe69fe0
19 changed files with 304 additions and 77 deletions

View File

@@ -23,7 +23,7 @@ http://194.1.237.94/api/v2/GenerateKeys
As a result, JSON is returned, which contains the required result field with the value:
* 0 - the request contains errors or the result is not possible to get (for example, there is no such account),
* 1 - successful execution of the query
* 1 or >1 - successful execution of the query
text - the optional field contains a detailed description of the result
@@ -52,20 +52,28 @@ return:
2)**/api/v2/CreateAccount** - create a new account (account). In Tere free account creation is possible only in the intervals of 10 seconds. The paid version is given in the example of 2 methods **Send**
#### Parameters:
* Name - account name up to 40 bytes
* PubKey - public key in hex-format
* PrivKey - private key in hex-format
* Wait - if the number 1 is set, the response to the request is not returned until the transaction is written to the blockchain (the response time to the request is increased to 18 seconds)
example:
```js
http://127.0.0.1/api/v2/CreateAccount
{
"Name": "Hellow, world",
"PubKey": "0240EDF5ECB25D886FD58DB92A53914FAC975078C1C2EDD1AC292B70C7BC13461F"
"Name": "PrivTest02",
"PrivKey": "A2D45610FE8AC931F32480BFE3E78D26E45B0A4F88045D6518263DA12FA9C033",
"Wait":1
}
```
return:
```js
{"result":1,"text":"Added to timer","TxID":"DC316BD766AC654E0AF7260F2E010000","BlockNum":19795750}
{
"result": 190552,
"text": "Add to blockchain",
"TxID": "04711036904F1F2DDF49CC7B2F010000",
"BlockNum": 19889100
}
```
result - returns the id (number) of the created account
## Send
@@ -77,6 +85,7 @@ return:
* ToID - the account number of the recipient, the number or public key in hex format (in this case, it will create a new account with the name specified in the first line of the description of the payment and the payment the account will be charged 10 Tera)
* Amount - sum, floating-point number, or object format {SumCOIN,SumCENT}
* Description - description of payment order (optional)
* Wait - if the number 1 is set, the response to the request is not returned until the transaction is written to the blockchain (the response time to the request is increased to 8 seconds)
example1:
@@ -87,28 +96,50 @@ http://127.0.0.1/api/v2/Send
"FromPrivKey": "A2D45610FE8AC931F32480BFE3E78D26E45B0A4F88045D6518263DA12FA9C033",
"ToID":190165,
"Amount":10.5,
"Description":"Test"
"Description":"Тест",
"Wait":1
}
```
example2 (create a new account):
return:
```js
{
"result": 1,
"text": "Add to blockchain",
"TxID": "C08A0C18C1ABF4062B149B7C2F010000",
"BlockNum": 19889307
}
```
example2 (создание нового счета):
```js
http://127.0.0.1/api/v2/Send
{
"FromID": 190085,
"FromID": 190059,
"FromPrivKey": "A2D45610FE8AC931F32480BFE3E78D26E45B0A4F88045D6518263DA12FA9C033",
"ToID22":190516,
"ToID":"0240EDF5ECB25D886FD58DB92A53914FAC975078C1C2EDD1AC292B70C7BC13461F",
"Amount":10,
"Description":"New account"
"Description":"New account",
"Wait":1
}
```
return:
```js
{"result":1,"text":"OK","TxID":"BE10810FDE7A1317D9DF51D62D010000","BlockNum":19781201}
{
"result": 190551,
"text": "Add to blockchain",
"TxID": "9DD4869C4515B2A3340E887A2F010000",
"BlockNum": 19888776
}
```
result - returns the id (number) of the created account
## GetBalance
4)**/api/v2/GetBalance** - get account balance
@@ -119,15 +150,16 @@ example:
```js
http://127.0.0.1/api/v2/GetBalance
{
"AccountID": 0
"AccountID": 9
}
```
return:
```js
{
"result": 1,
"SumCOIN": 580222966,
"SumCENT": 527313901
"SumCOIN": 5589146,
"SumCENT": 555765670,
"PubKey": "02769165A6F9950D023A415EE668B80BB96B5C9AE2035D97BDFB44F356175A44FF"
}
```
@@ -137,7 +169,7 @@ return:
#### Parameters:
* TxID - Transaction ID in hex format
example:
example1:
```js
http://127.0.0.1/api/v2/GetTransaction
{
@@ -166,6 +198,26 @@ return:
"result": 1
}
```
example2:
```js
http://127.0.0.1/api/v2/GetTransaction
{
"TxID": "04711036904F1F2DDF49CC7B2F010000"
}
```
return:
```js
{
"Type": 100,
"Currency": 0,
"PubKey": "0240EDF5ECB25D886FD58DB92A53914FAC975078C1C2EDD1AC292B70C7BC13461F",
"Name": "PrivTest02",
"Adviser": 0,
"Smart": 0,
"Reserve": "000000",
"result": 190552
}
```
## GetHistoryTransactions