## API v1 Данный API доступен если на ноде запущен публичный http-доступ. Т.е. задана константа HTTP_HOSTING_PORT #### Получение текущего статуса блокчейна http://194.1.237.94/GetCurrentInfo?Diagram=0 Result: * MaxNumBlockDB - максимальный номер блока записанный в БД (текущая высота блокчейна) * CurBlockNum - новый формируемый блок * MaxAccID - текущий максимальный номер счета * MaxDappsID - текущий максимальный номер Dapp * VersionNum - версия программы на которой работает нода Пример результата: ``` {"result":1,"VersionNum":706,"MaxNumBlockDB":12371158,"CurBlockNum":12371166,"MaxAccID":187783,"MaxDappsID":20,"FIRST_TIME_BLOCK":1530446400000} ``` #### Получение списка нод, имеющий публичный интерфейс API http://194.1.237.94/GetNodeList Пример результата: ``` {"arr":[{"ip":"149.154.70.158","port":80},{"ip":"195.211.195.236","port":88}],"result":1} ``` #### Получение списка счетов http://194.1.237.94/GetAccountList?StartNum=0&CountNum=1 Пример результата: ``` {"arr":[{"Currency":0,"PubKey":{"type":"Buffer","data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},"Name":"System account","Value":{"SumCOIN":735207181,"SumCENT":160466160,"OperationID":29702004,"Smart":0,"Data":{"type":"Buffer","data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},"BlockNumCreate":0,"Adviser":0,"Reserve":{"type":"Buffer","data":[0,0,0,0,0,0,0,0,0]},"Num":0,"WN":"","PubKeyStr":"000000000000000000000000000000000000000000000000000000000000000000"}],"result":1} ``` #### Получение списка блоков http://194.1.237.94/GetBlockList?StartNum=12373020&CountNum=1 Пример результата: ``` {"arr":[{"Info":"","TreeHash":[21,49,137,245,12,76,228,206,53,77,30,148,98,24,170,149,57,42,182,70,241,34,109,212,139,164,6,188,58,123,144,148],"AddrHash":[59,221,2,0,0,0,245,10,0,0,0,0,51,114,239,24,0,0,83,43,13,45,0,0,109,0,111,11,175,220,151,110],"PrevHash":[43,137,15,86,33,224,34,209,250,223,179,165,117,195,85,221,20,170,165,242,21,224,66,113,34,236,242,73,175,220,151,110],"SumHash":[161,234,144,48,195,161,175,59,95,210,65,224,12,209,47,194,107,237,238,253,203,103,50,204,176,175,14,165,123,176,151,31],"SumPow":343061509,"BodyFileNum":0,"TrDataPos":171851211,"TrDataLen":45,"TrCount":0,"BlockNum":12373020,"SeqHash":[203,159,178,200,40,56,216,192,98,72,79,17,138,85,110,107,9,236,236,192,221,31,8,3,64,220,78,104,23,69,185,237],"Hash":[201,154,249,76,189,63,83,170,17,113,155,168,49,61,237,225,23,82,25,64,252,187,83,235,66,123,53,140,224,15,213,30],"PowHash":[0,0,0,0,0,43,172,90,172,102,174,20,63,206,173,42,64,212,122,194,192,206,0,19,247,148,244,38,50,110,104,65],"Power":42,"bSave":true,"Prepared":true,"Num":12373020,"Miner":187707,"Hash1":[0,0,0,0,0,43,172,90,172,102,174,20,63,206,173,42,64,212,122,194,192,206,0,19,247,148,244,38,50,110,104,65],"Hash2":[0,0,0,0,0,0,26,182,13,93,155,155,161,188,243,123,15,140,197,136,187,52,200,57,96,167,222,160,83,243,232,92]}],"result":1} ``` #### Получение списка транзакций блока http://194.1.237.94/GetTransactionList?BlockNum=12373020?StartNum=0&CountNum=10 Пример результата: ``` {"arr":[{"body":{"type":"Buffer","data":[119,52,200,188,0,0,0,191,18,76,46,177,111,26,110,203,159,23,235,146,77,199,1,149,89,136,142,14,63,114,189,13,6,60,28,76,11,146,102]},"num":6656082722574,"hashPow":[21,49,137,245,12,76,228,206,53,77,30,148,98,24,170,149,57,42,182,70,241,34,109,212,139,164,6,188,58,123,144,148],"HASH":[21,49,137,245,12,76,228,206,53,77,30,148,98,24,170,149,57,42,182,70,241,34,109,212,139,164,6,188,58,123,144,148],"power":3,"TimePow":6656082722578.715,"Num":0,"Type":119,"Length":39,"Body":[119,52,200,188,0,0,0,191,18,76,46,177,111,26,110,203,159,23,235,146,77,199,1,149,89,136,142,14,63,114,189,13,6,60,28,76,11,146,102],"Script":"{\n \"Type\": 119,\n \"BlockNum\": 12372020,\n \"Hash\": \"BF124C2EB16F1A6ECB9F17EB924DC7019559888E0E3F72BD0D063C1C4C0B9266\"\n}","Verify":1,"VerifyHTML":""}],"result":1} ``` #### Получение списка ДАпов http://194.1.237.94/api/v1/GetDappList?StartNum=8&CountNum=1 Пример результата: ``` {"arr":[{"Version":0,"TokenGenerate":0,"ISIN":"","Zip":0,"BlockNum":10034043,"TrNum":0,"IconBlockNum":10033892,"IconTrNum":0,"ShortName":"","Name":"List-Lib","Account":187007,"AccountLength":1,"Category1":40,"Category2":0,"Category3":0,"Owner":186573,"Reserve":{"type":"Buffer","data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},"StateFormat":"","Description":"List-lib v1.0","Num":"8","CodeLength":3705,"HTMLLength":0}],"result":1} ``` #### Получение списка счетов по публичному ключу http://194.1.237.94/api/v1/GetAccountListByKey?Key=027AE0DCE92D8BE1F893525B226695DDF0FE6AD756349A76777FF51F3B59067D70 Результат: ``` {"result":1,"arr":[{"Currency":0,"PubKey":{"type":"Buffer","data":[2,122,224,220,233,45,139,225,248,147,82,91,34,102,149,221,240,254,106,215,86,52,154,118,119,127,245,31,59,89,6,125,112]},"Name":"Founder account","Value":{"SumCOIN":40000005,"SumCENT":0,"OperationID":7,"Smart":0,"Data":{"type":"Buffer","data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},"BlockNumCreate":0,"Adviser":0,"Reserve":{"type":"Buffer","data":[0,0,0,0,0,0,0,0,0]},"Num":8,"WN":""}]} ``` Комментарий: публичный ключ в формате hex можно взять из кошельке на EXPLORER->Accounts (колонка PubKey) #### Отправка транзакции http://194.1.237.94/api/v1/SendTransactionHex?Hex=6F030000000000002D00000000000100000000008400000000000100000000000000000004007465737425000000000000007AA29739FD458DF8AB1139881DAA4584CCDA3D4995B6849FB1F55F3B2EA40704116647823E97A60C70213EFA8D83CBFBEE6D753FCA6771B4792985B57186F3BCFBCEC0000000930600000000 Результат: ``` {"result":1,"text":"OK"} ``` Комментарий: транзакцию в формате hex можно получить если использовать функции из библиотек на языке javascript * Библиотеки находятся по адресу: https://github.com/terafoundation/wallet/raw/master/Bin/Light/Tera-light.zip * Пример: http://dappsgate.com/test-api.html ```html Test2-API Priv key:
Tx (after each transaction is sent, the OperationID number is increased by 1):

Actions:

Result:
```