diff --git a/Bin/Light/Tera-light.zip b/Bin/Light/Tera-light.zip index 69882bc..c00e1aa 100644 Binary files a/Bin/Light/Tera-light.zip and b/Bin/Light/Tera-light.zip differ diff --git a/Bin/Light/tera_light_setup.exe b/Bin/Light/tera_light_setup.exe index 6d8638a..d744671 100644 Binary files a/Bin/Light/tera_light_setup.exe and b/Bin/Light/tera_light_setup.exe differ diff --git a/Doc/Eng/API.md b/Doc/Eng/API.md index eeddae7..9bdc919 100644 --- a/Doc/Eng/API.md +++ b/Doc/Eng/API.md @@ -1,9 +1,9 @@ -## API +## API v1 This API is available if the node is running public http-access. Set the constant HTTP_HOSTING_PORT. #### Getting the current status of the blockchain -http://194.1.237.94/GetCurrentInfo?Diagram=0 +http://194.1.237.94/api/v1/GetCurrentInfo Result: * MaxNumBlockDB - the maximum block number stored in the database (the current height of the blockchain) @@ -19,7 +19,7 @@ An example of the result: ``` #### Get a list of nodes that have a public API -http://194.1.237.94/GetNodeList +http://194.1.237.94/api/v1/GetNodeList An example of the result: ``` @@ -28,7 +28,7 @@ An example of the result: #### Getting a list of accounts -http://194.1.237.94/GetAccountList?StartNum=0&CountNum=1 +http://194.1.237.94/api/v1/GetAccountList?StartNum=0&CountNum=1 An example of the result: ``` @@ -36,7 +36,7 @@ An example of the result: ``` #### Getting a list of blocks -http://194.1.237.94/GetBlockList?StartNum=12373020&CountNum=1 +http://194.1.237.94/api/v1/GetBlockList?StartNum=12373020&CountNum=1 An example of the result: ``` @@ -44,7 +44,7 @@ An example of the result: ``` #### Getting a list of block transactions -http://194.1.237.94/GetTransactionList?BlockNum=12373020?StartNum=0&CountNum=10 +http://194.1.237.94/api/v1/GetTransactionList?BlockNum=12373020?StartNum=0&CountNum=10 An example of the result: ``` @@ -54,7 +54,7 @@ An example of the result: #### Getting a list of DAPs -http://194.1.237.94/GetDappList?StartNum=8&CountNum=1 +http://194.1.237.94/api/v1/GetDappList?StartNum=8&CountNum=1 An example of the result: ``` @@ -64,7 +64,7 @@ An example of the result: #### Getting a list of accounts by public key -http://194.1.237.94/GetAccountListByKey?Key=027AE0DCE92D8BE1F893525B226695DDF0FE6AD756349A76777FF51F3B59067D70 +http://194.1.237.94/api/v1/GetAccountListByKey?Key=027AE0DCE92D8BE1F893525B226695DDF0FE6AD756349A76777FF51F3B59067D70 Result: ``` @@ -74,7 +74,7 @@ Note: public key in hex format can be taken from the wallet on EXPLORER -> Accou #### Sending a transaction -http://194.1.237.94/SendTransactionHex?Hex=6F030000000000002D00000000000100000000008400000000000100000000000000000004007465737425000000000000007AA29739FD458DF8AB1139881DAA4584CCDA3D4995B6849FB1F55F3B2EA40704116647823E97A60C70213EFA8D83CBFBEE6D753FCA6771B4792985B57186F3BCFBCEC0000000930600000000 +http://194.1.237.94/api/v1/SendTransactionHex?Hex=6F030000000000002D00000000000100000000008400000000000100000000000000000004007465737425000000000000007AA29739FD458DF8AB1139881DAA4584CCDA3D4995B6849FB1F55F3B2EA40704116647823E97A60C70213EFA8D83CBFBEE6D753FCA6771B4792985B57186F3BCFBCEC0000000930600000000 Result: ``` diff --git a/Doc/Rus/API.md b/Doc/Rus/API.md index af00e4c..b4d913d 100644 --- a/Doc/Rus/API.md +++ b/Doc/Rus/API.md @@ -1,4 +1,4 @@ -## API +## API v1 Данный API доступен если на ноде запущен публичный http-доступ. Т.е. задана константа HTTP_HOSTING_PORT @@ -54,7 +54,7 @@ http://194.1.237.94/GetTransactionList?BlockNum=12373020?StartNum=0&CountNum=10 #### Получение списка ДАпов -http://194.1.237.94/GetDappList?StartNum=8&CountNum=1 +http://194.1.237.94/api/v1/GetDappList?StartNum=8&CountNum=1 Пример результата: ``` @@ -63,7 +63,7 @@ http://194.1.237.94/GetDappList?StartNum=8&CountNum=1 #### Получение списка счетов по публичному ключу -http://194.1.237.94/GetAccountListByKey?Key=027AE0DCE92D8BE1F893525B226695DDF0FE6AD756349A76777FF51F3B59067D70 +http://194.1.237.94/api/v1/GetAccountListByKey?Key=027AE0DCE92D8BE1F893525B226695DDF0FE6AD756349A76777FF51F3B59067D70 Результат: @@ -74,7 +74,7 @@ http://194.1.237.94/GetAccountListByKey?Key=027AE0DCE92D8BE1F893525B226695DDF0FE #### Отправка транзакции -http://194.1.237.94/SendTransactionHex?Hex=6F030000000000002D00000000000100000000008400000000000100000000000000000004007465737425000000000000007AA29739FD458DF8AB1139881DAA4584CCDA3D4995B6849FB1F55F3B2EA40704116647823E97A60C70213EFA8D83CBFBEE6D753FCA6771B4792985B57186F3BCFBCEC0000000930600000000 +http://194.1.237.94/api/v1/SendTransactionHex?Hex=6F030000000000002D00000000000100000000008400000000000100000000000000000004007465737425000000000000007AA29739FD458DF8AB1139881DAA4584CCDA3D4995B6849FB1F55F3B2EA40704116647823E97A60C70213EFA8D83CBFBEE6D753FCA6771B4792985B57186F3BCFBCEC0000000930600000000 Результат: ``` diff --git a/Source/HTML/JS/client.js b/Source/HTML/JS/client.js index 6c300b4..cc477dd 100644 --- a/Source/HTML/JS/client.js +++ b/Source/HTML/JS/client.js @@ -1300,7 +1300,6 @@ function ParseFileName(Str) } return Ret; }; -var glTrSendNum = 0; window.MapSendTransaction = {}; function SendTransaction(Body,TR,SumPow,F) @@ -1313,7 +1312,6 @@ function SendTransaction(Body,TR,SumPow,F) F(1, TR, Body); return ; } - glTrSendNum++; if(window.SetStatus) SetStatus("Prepare to sending..."); CreateNonceAndSend(1, 0, 0); @@ -1322,10 +1320,9 @@ function CreateNonceAndSend(bCreateNonce,startnonce,NumNext) { if(!NumNext) NumNext = 0; - var CurTrNum = glTrSendNum; var nonce = startnonce; if(bCreateNonce) - nonce = CreateHashBodyPOWInnerMinPower(Body, SumPow); + nonce = CreateHashBodyPOWInnerMinPower(Body, SumPow, startnonce); var StrHex = GetHexFromArr(Body); if(NumNext > 10) { diff --git a/Source/HTML/JS/crypto-client.js b/Source/HTML/JS/crypto-client.js index bf7f438..4f4a138 100644 --- a/Source/HTML/JS/crypto-client.js +++ b/Source/HTML/JS/crypto-client.js @@ -110,7 +110,7 @@ window.SetBlockChainConstant = function (Data) Data.DELTA_CURRENT_TIME = 0; window.DELTA_CURRENT_TIME2 = Data.DELTA_CURRENT_TIME - DeltaServerClient; window.MIN_POWER_POW_TR = DELTA_POWER_POW_TR + Data.MIN_POWER_POW_TR; - window.MIN_POWER_POW_ACC_CREATE = Data.MIN_POWER_POW_ACC_CREATE + 3; + window.MIN_POWER_POW_ACC_CREATE = Data.MIN_POWER_POW_ACC_CREATE; window.FIRST_TIME_BLOCK = Data.FIRST_TIME_BLOCK; window.CONSENSUS_PERIOD_TIME = Data.CONSENSUS_PERIOD_TIME; window.GetCurrentBlockNumByTime = function () @@ -143,7 +143,7 @@ var LastCreatePOWTrType = 0; var LastCreatePOWBlockNum = 0; var LastCreatePOWHash = [255, 255, 255, 255]; -function CreateHashBodyPOWInnerMinPower(arr,MinPow) +function CreateHashBodyPOWInnerMinPower(arr,MinPow,startnonce) { var TrType = arr[0]; var BlockNum = GetBlockNumTr(arr); @@ -151,7 +151,7 @@ function CreateHashBodyPOWInnerMinPower(arr,MinPow) { MinPow = MIN_POWER_POW_TR + Math.log2(arr.length / 128); } - var nonce = 0; + var nonce = startnonce; while(1) { var arrhash = CreateHashBody(arr, BlockNum, nonce); @@ -265,7 +265,7 @@ function ComputeSecretWithCheck(PubKey,StrPrivKey,F) F(sha3(Result)); }; -function ComputeSecret(PubKey,F) +function ComputeSecret(Account,PubKey,F) { if(localStorage["idPrivKey"]) { @@ -273,7 +273,7 @@ function ComputeSecret(PubKey,F) } else { - GetData("GetWalletInfo", {}, function (Data) + GetData("GetWalletInfo", {Account:Account}, function (Data) { if(!Data || !Data.result) return ; diff --git a/Source/HTML/JS/dapp-inner.js b/Source/HTML/JS/dapp-inner.js index e9e77b6..fef1514 100644 --- a/Source/HTML/JS/dapp-inner.js +++ b/Source/HTML/JS/dapp-inner.js @@ -125,13 +125,15 @@ function OpenLink(Str) SendData({cmd:"OpenLink", Message:Str}); }; -function ComputeSecret(PubKey,F) +function ComputeSecret(PubKey,F,Account) { if(!INFO.WalletCanSign) { SetError("Pls, open wallet"); return 0; } + if(!Account && USER_ACCOUNT.length) + Account = USER_ACCOUNT[0].Num; if(typeof PubKey === "number") { var AccNum = PubKey; @@ -143,13 +145,13 @@ function ComputeSecret(PubKey,F) } else { - SendData({cmd:"ComputeSecret", PubKey:Arr[0].PubKey.data}, F); + SendData({cmd:"ComputeSecret", Account:Account, PubKey:Arr[0].PubKey.data}, F); } }); } else { - SendData({cmd:"ComputeSecret", PubKey:PubKey}, F); + SendData({cmd:"ComputeSecret", Account:Account, PubKey:PubKey}, F); } }; diff --git a/Source/HTML/JS/tx-lib.js b/Source/HTML/JS/tx-lib.js new file mode 100644 index 0000000..8659b5d --- /dev/null +++ b/Source/HTML/JS/tx-lib.js @@ -0,0 +1,10 @@ +/* + * @project: TERA + * @version: Development (beta) + * @license: MIT (not for evil) + * @copyright: Yuriy Ivanov 2017-2019 [progr76@gmail.com] + * Web: https://terafoundation.org + * Twitter: https://twitter.com/terafoundation + * Telegram: https://web.telegram.org/#/im?p=@terafoundation +*/ + diff --git a/Source/HTML/JS/wallet-lib.js b/Source/HTML/JS/wallet-lib.js index dc9e007..8a1a257 100644 --- a/Source/HTML/JS/wallet-lib.js +++ b/Source/HTML/JS/wallet-lib.js @@ -173,8 +173,9 @@ function CreateTransaction(F,CheckErr,Run) } else { - ToID = 0; - ToPubKey = ""; + if(CheckErr) + SetError("Valid 'Pay to' - required!"); + return ; } } if(CheckErr && ToID <= 0 && ToPubKey === "" && !AttachItem) diff --git a/Source/HTML/dapp-frame.html b/Source/HTML/dapp-frame.html index 7fcbfeb..e31acc9 100644 --- a/Source/HTML/dapp-frame.html +++ b/Source/HTML/dapp-frame.html @@ -240,7 +240,7 @@ } case "ComputeSecret": { - ComputeSecret(Data.PubKey,function (Result) + ComputeSecret(Data.Account,Data.PubKey,function (Result) { Data.Result=Result; SendMessage(Data); diff --git a/Source/HTML/wallet.html b/Source/HTML/wallet.html index de4373c..0a46f60 100644 --- a/Source/HTML/wallet.html +++ b/Source/HTML/wallet.html @@ -85,7 +85,7 @@ //CONFIG function IsPrivateMode() { - if(PrivKeyStr && PrivKeyStr.length===64) + if(PrivKeyStr && PrivKeyStr.length===64 && PrivKeyStr!=="0000000000000000000000000000000000000000000000000000000000000000") return true; else return false; @@ -890,7 +890,7 @@ if(window.location.hash) { var LocationPath=window.location.hash.substr(1); - console.log("LocationPath="+LocationPath) + //console.log("LocationPath="+LocationPath) if(LocationPath) { SelectTab(LocationPath); diff --git a/Source/HTML/web-wallet.html b/Source/HTML/web-wallet.html index 008ba40..521c405 100644 --- a/Source/HTML/web-wallet.html +++ b/Source/HTML/web-wallet.html @@ -22,6 +22,7 @@