fix: error global replace

Signed-off-by: MiaoWoo <admin@yumc.pw>
master
MiaoWoo 2019-07-12 22:46:26 +08:00
parent 92a1edb789
commit 1225f4b2f5
27 changed files with 504 additions and 723 deletions

View File

@ -18,13 +18,11 @@
"clean": "npx rimraf dist",
"prebuild": "yarn clean",
"watch": "npx tsc --watch",
"postbuild": "cp src/HTML/* dist/HTML/ -rf",
"postbuild": "cp src/HTML/* dist/HTML/ -rf && cp package.json dist/",
"build": "npx tsc",
"start": "node dist/run-node.js"
},
"dependencies": {
"@types/bintrees": "^1.0.2",
"@types/secp256k1": "^3.5.0",
"bintrees": "^1.0.2",
"greenlock": "^2.6.7",
"ntp-client": "^0.5.3",
@ -34,9 +32,11 @@
"zip": "^1.2.0"
},
"devDependencies": {
"@types/bintrees": "^1.0.2",
"@types/secp256k1": "^3.5.0",
"@types/node": "^12.6.1",
"rimraf": "^2.6.3",
"ts-node-dev": "^1.0.0-pre.40",
"typescript": "^3.5.3"
}
}
}

View File

@ -1,162 +0,0 @@
‘à ¢­¥­¨¥ ä ©«®¢ mobile-wallet.html ¨ _MOBILE-WALLET.HTML
***** mobile-wallet.html
<a onclick="SelectTab('TabWelcome')" class="header__logo-link" id="MTabWelcome">
<!--<img src="./PIC/Tera_logo2.svg" alt="Tera logo" height="25" width="104">-->
<svg width="104" height="25" viewBox="0 0 105 25" fill="none" xmlns="http://www.w3.org/2000/svg">
***** _MOBILE-WALLET.HTML
<a onclick="SelectTab('TabWelcome')" class="header__logo-link" id="MTabWelcome">
<svg width="104" height="25" viewBox="0 0 105 25" fill="none" xmlns="http://www.w3.org/2000/svg">
*****
***** mobile-wallet.html
<div class="welcome__img">
<svg class="mobile" id="tera-logo" height="126" width="130" fill="#445368" xmlns="http://www.w3.org/2000/svg" viewB
ox="0 0 992.13 992.13">
***** _MOBILE-WALLET.HTML
<div class="welcome__img">
<svg class="mobile" id="tera-logo" height="104" width="107" fill="#445368" xmlns="http://www.w3.org/2000/svg" viewB
ox="0 0 992.13 992.13">
*****
***** mobile-wallet.html
<textarea name="private-key" id="idPrivKeyEdit" placeholder="Insert your private key or generate a new key below...
" class="key-field__textarea" oninput="OnEditPrivKey()">
</textarea>
***** _MOBILE-WALLET.HTML
<textarea name="private-key"
id="idPrivKeyEdit"
placeholder="Insert your private key or generate a new key below..."
class="key-field__textarea"
oninput="OnEditPrivKey()">
</textarea>
*****
***** mobile-wallet.html
<select size="1" id="idAccountCur" class="bigs key-field__input key-field__input--select">
<option value="0">TERA</option>
***** _MOBILE-WALLET.HTML
<select size="1" id="idAccountCur" class="bigs key-field__input">
<option value="0">TERA</option>
*****
***** mobile-wallet.html
<p class="key-field__title">From:</p>
<button onclick="SetAllSum()" title="Paste total amount" class="key-field__btn btn-no-bg no-mr" style="padding:
0; margin-left: 10px;">
<svg width="18" height="18" viewBox="0 0 18 18" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M15 1H3C1.89543 1 1 1.89543 1 3V15C1 16.1046 1.89543 1
7 3 17H15C16.1046 17 17 16.1046 17 15V3C17 1.89543 16.1046 1 15 1ZM3 0C1.34315 0 0 1.34315 0 3V15C0 16.6569 1.34315 18 3 18H15C
16.6569 18 18 16.6569 18 15V3C18 1.34315 16.6569 0 15 0H3ZM6.64645 10.6464C6.84171 10.4512 7.15829 10.4512 7.35355 10.6464L9.5
12.7929V6C9.5 5.17157 8.82843 4.5 8 4.5H6C5.72386 4.5 5.5 4.27614 5.5 4C5.5 3.72386 5.72386 3.5 6 3.5H8C9.38071 3.5 10.5 4.6192
9 10.5 6V12.7929L12.6464 10.6464C12.8417 10.4512 13.1583 10.4512 13.3536 10.6464C13.5488 10.8417 13.5488 11.1583 13.3536 11.353
6L10.3536 14.3536L10 14.7071L9.64645 14.3536L6.64645 11.3536C6.45118 11.1583 6.45118 10.8417 6.64645 10.6464Z"/>
</svg>
</button>
<select size="1" id="idAccount" class="key-field__select" oninput="OnEditTransactionFields(); CheckSending();">
***** _MOBILE-WALLET.HTML
<p class="key-field__title">From:</p>
<select size="1" id="idAccount" class="key-field__select" oninput="OnEditTransactionFields(); CheckSending();">
*****
***** mobile-wallet.html
<label for="idTo" class="key-field__title">Pay to:</label>
<span id="idNameTo2" style="margin: 5px 10px 0 15px"></span>
<!--<button class="key-field__btn btn-no-bg">Paste</button>-->
***** _MOBILE-WALLET.HTML
<label for="idTo" class="key-field__title">Pay to:</label>
<span id="idNameTo2" style="margin: 0 10px 0 0"></span>
<!--<button class="key-field__btn btn-no-bg">Paste</button>-->
*****
***** mobile-wallet.html
<!--<b>2 000 000 000,00000000</b>-->
<input type="number"
***** _MOBILE-WALLET.HTML
<!--<b>2 000 000 000,00000000</b>-->
<button onclick="SetAllSum()" title="Paste total amount" class="key-field__btn btn-no-bg no-mr" style="padding:
0; margin-left: 10px;">
<svg width="18" height="18" viewBox="0 0 18 18" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M15 1H3C1.89543 1 1 1.89543 1 3V15C1 16.1046 1.89543 1
7 3 17H15C16.1046 17 17 16.1046 17 15V3C17 1.89543 16.1046 1 15 1ZM3 0C1.34315 0 0 1.34315 0 3V15C0 16.6569 1.34315 18 3 18H15C
16.6569 18 18 16.6569 18 15V3C18 1.34315 16.6569 0 15 0H3ZM6.64645 10.6464C6.84171 10.4512 7.15829 10.4512 7.35355 10.6464L9.5
12.7929V6C9.5 5.17157 8.82843 4.5 8 4.5H6C5.72386 4.5 5.5 4.27614 5.5 4C5.5 3.72386 5.72386 3.5 6 3.5H8C9.38071 3.5 10.5 4.6192
9 10.5 6V12.7929L12.6464 10.6464C12.8417 10.4512 13.1583 10.4512 13.3536 10.6464C13.5488 10.8417 13.5488 11.1583 13.3536 11.353
6L10.3536 14.3536L10 14.7071L9.64645 14.3536L6.64645 11.3536C6.45118 11.1583 6.45118 10.8417 6.64645 10.6464Z"/>
</svg>
</button>
<input type="number"
*****
***** mobile-wallet.html
<label for="idDescription" class="key-field__title">Description:</label>
<textarea name="description" id="idDescription" rows="2" placeholder="Optional..." class="key-field__textarea"
oninput="CheckLengthAccDesription('idDescription',200); OnEditTransactionFields()">
</textarea>
***** _MOBILE-WALLET.HTML
<label for="idDescription" class="key-field__title">Description:</label>
<textarea name="description"
id="idDescription"
rows="2"
placeholder="Optional..."
class="key-field__textarea"
oninput="CheckLengthAccDesription('idDescription',200);OnEditTransactionFields()">
</textarea>
*****
***** mobile-wallet.html
<div class="dapps-page__pagination page-pagination">
<button onclick="ViewBegin(DefDapps)" class="btn dapps-page__page-btns">| &lt;</button>
<button onclick="ViewPrev(DefDapps)" class="btn dapps-page__page-btns">&lt;</button>
***** _MOBILE-WALLET.HTML
<div class="dapps-page__pagination page-pagination">
<button onclick="ViewBegin(DefDapps)" class="btn dapps-page__page-btns">|&lt;</button>
<button onclick="ViewPrev(DefDapps)" class="btn dapps-page__page-btns">&lt;</button>
*****
***** mobile-wallet.html
<button onclick="ViewNext(DefDapps,CONFIG_DATA.MaxDappsID)" class="btn dapps-page__page-btns">&gt;</button>
<button onclick="ViewEnd(DefDapps,CONFIG_DATA.MaxDappsID)" class="btn dapps-page__page-btns">&gt; |</button>
</div>
***** _MOBILE-WALLET.HTML
<button onclick="ViewNext(DefDapps,CONFIG_DATA.MaxDappsID)" class="btn dapps-page__page-btns">&gt;</button>
<button onclick="ViewEnd(DefDapps,CONFIG_DATA.MaxDappsID)" class="btn dapps-page__page-btns">&gt;|</button>
</div>
*****
***** mobile-wallet.html
<div class="explorer-page__table-wrap">
<table id="dapps_list" class="grid dapps__table">
<tr>
***** _MOBILE-WALLET.HTML
<div class="explorer-page__table-wrap">
<table id="dapps_list" class="grid">
<tr>
*****
***** mobile-wallet.html
<div class="prod-card__heading">
<a href="#" class="prod-card__link" onclick="OpenDapp(Item.Num)">Item.Name</a>
<!--<span class="lighter-grey-text">Without token generate</span>-->
***** _MOBILE-WALLET.HTML
<div class="prod-card__heading">
Item.Name
<!--<span class="lighter-grey-text">Without token generate</span>-->
*****
***** mobile-wallet.html
<div class="prod-card__second-line-img">
<a href="#" class="prod-card__link" onclick="OpenDapp(Item.Num)"><img src="Item.IconPath" alt="dApp
logo" width="32"></a>
</div>
***** _MOBILE-WALLET.HTML
<div class="prod-card__second-line-img">
<img src="Item.IconPath" alt="dApp logo" width="32">
</div>
*****

View File

@ -36,8 +36,7 @@ function GetPowPower(arrhash) {
for (var b = 7; b >= 0; b--) {
if ((byte >> b) & 1) {
return SumBit;
}
else {
} else {
SumBit++;
}
}

View File

@ -1409,26 +1409,21 @@
<DIV id="idNodeUpdateMiningStatus" style="display: block">
<DIV style="float: left">
<input type="checkbox" class="checkbox" id="idAutoUpdate" onchange = "UseAutoUpdate()"/>
<label for="idAutoUpdate">自动更新</label>
<label for="idAutoUpdate">AutoUpdate</label>
</DIV>
<DIV style="float: left">
<input type="checkbox" class="checkbox" id="idUseMining" onchange = "UseMining()"/>
<label for="idUseMining">挖矿</label>
</DIV>
<DIV style="float: left">
<label>此版本由 MiaoWoo 使用 TypeScript 重构</label>
<label for="idUseMining">UseMining</label>
</DIV>
<DIV style="float: left;display: none" id="idMiningParams">
<DIV style="float: left; color: blue;">CPU
use:<input type="number" min=0 max=100 id="idPercentMining" onchange="SetPercentMining()"/>%</DIV>
<DIV style="float: left; margin: 2px 0 0 8px;" id="idStatusMining"></DIV>
</DIV>
</DIV>
<DIV id="idDevelopService" style="display: none">
<BR>
<INPUT type="button" id="idDown" onclick="SetVisibleBlock('idDevelopServiceView',!IsVisibleBlock('idDevelopServiceView'));SetImg(this,'idDevelopServiceView')"
class="btdoit bt" value="DEV SERVICE">
<DIV id="idDevelopServiceView" style="display: none">
<INPUT type="button" id="idDown" onclick="SetVisibleBlock('idDevelopServiceView',!IsVisibleBlock('idDevelopServiceView'));SetImg(this,'idDevelopServiceView')" class="btdoit bt" value="DEV SERVICE">
<DIV id="idDevelopServiceView">
<table>
<tr>
<td style="width: 100px">
@ -1437,11 +1432,11 @@
<INPUT type="button" class="bt btdoit" onclick="SetCorrTimeJSON()" value="DELTA TIME >>"><BR>
<INPUT type="button" class="bt btdoit" onclick="SetNetConstJSON()" value="NET CONST >>"><BR>
</td>
</td>
<td style="width: 500px">
Value:<INPUT type="string" id="idDevValue" value="0"><BR>
<TEXTAREA id="idDevService" rows="15" cols="90"> </TEXTAREA><BR>
</td>
</td>
</tr>
</table>
<INPUT type="button" onclick="CreateCheckPoint()" class="btdoit bt" value="CHECK POINT">
@ -1461,6 +1456,7 @@
</DIV>
<canvas width='800' height='30' id='idBlockInfo'></canvas>
<BR><BR>
<DIV style="float: left;" id="idStatusMining"></DIV>
<DIV style="float: left; font-family: monospace">
Block:<B id="idCurBlockNum"></B>
DB delta:<B id="idDeltaDB" style="min-width: 30px"></B>
@ -1475,24 +1471,17 @@
<b class="red">*************** WARNING: VERY SLOW LIBRARY: secp256k1 ***************<BR>Install all dependent packages, see detail: <a href="https://www.npmjs.com/package/secp256k1">https://www.npmjs.com/package/secp256k1</a></b>
</DIV>
<BR>
</DIV>
</DIV>
<DIV id="wallet_config_tab" style="display: none;float: left">
钱包数据目录: <B id="idDataPath"></B><BR>
账户公钥: <B id="idPubKey"></B><BR>
DataPath: <B id="idDataPath"></B><BR>
PubKey: <B id="idPubKey"></B><BR>
<!--Node addr: <B id="idNodeAddr"></B><BR>-->
<INPUT type="button" onclick="MoveUp($('edit_keys'));NewPrivateKey();" class="btdoit bt" value="新建钱包" id="idDown2">
<INPUT type="button" onclick="MoveUp($('edit_keys'));EditPrivateKey();SetImg(this,'edit_keys');" class="btdoit bt" value="编辑钱包" id="idDown">
<INPUT type="button" onclick="MoveUp($('idAccountEdit'));ViewNewAccount();SetImg(this,'idAccountEdit');" class="btdoit bt" value="新建账户" id="idDown">
<INPUT type="button" onclick="MoveUp($('edit_mining_set'));MiningSets();SetImg(this,'edit_mining_set');" class="btdoit bt" value="设置挖矿账号" id="idDown">
<INPUT type="button" onclick="ViewSetPassword();itemBtPassword=this; SetImg(itemBtPassword,'idBlockPasswordSet');" class="bt btdoit" value="设置密码" id="idDown">
</DIV>
<INPUT type="button" onclick="MoveUp($('edit_keys'));NewPrivateKey();" class="btdoit bt" value="NewWallet" id="idDown2">
<INPUT type="button" onclick="MoveUp($('edit_keys'));EditPrivateKey();SetImg(this,'edit_keys');" class="btdoit bt" value="EditWallet" id="idDown">
<INPUT type="button" onclick="MoveUp($('idAccountEdit'));ViewNewAccount();SetImg(this,'idAccountEdit');" class="btdoit bt" value="NewAccount" id="idDown">
<INPUT type="button" onclick="MoveUp($('edit_mining_set'));MiningSets();SetImg(this,'edit_mining_set');" class="btdoit bt" value="MiningSet" id="idDown">
<INPUT type="button" onclick="ViewSetPassword();itemBtPassword=this; SetImg(itemBtPassword,'idBlockPasswordSet');" class="bt btdoit" value="SetPassword" id="idDown">
</DIV>
<DIV>
<DIV id="edit_mining_set" style="display: none">
<table class="form_input keys" id="grid_mining_set">
@ -1665,464 +1654,468 @@
<HR>
</DIV>
</DIV>
Style:
<select size="1" id="idSelStyle" onkeyup="SelectStyle();SaveValues()" onchange="SelectStyle();SaveValues()">
<option value="styleBrown">Brown</option>
<option value="styleBlue">Blue</option>
<option value="styleGreen">Green</option>
<option value="styleDark">Dark</option>
<option value="styleGray">Gray</option>
<option value="styleContrast1">Contrast 1</option>
<option value="styleContrast2">Contrast 2</option>
<option value="styleContrast3">Contrast 3</option>
</select>
<option value="styleBrown">Brown</option>
<option value="styleBlue">Blue</option>
<option value="styleGreen">Green</option>
<option value="styleDark">Dark</option>
<option value="styleGray">Gray</option>
<option value="styleContrast1">Contrast 1</option>
<option value="styleContrast2">Contrast 2</option>
<option value="styleContrast3">Contrast 3</option>
</select>
此版本由 MiaoWoo 使用 TypeScript 重构<BR>
</DIV>
<DIV id="TabSend" style="display: none">
<DIV id="idSendList"> </DIV>
<table class="form_input">
<tr>
<td style="min-width: 115px">From account</td>
<td>
<select size="1" id="idAccount" onkeyup="OnEditTransactionFields()" onchange="OnEditTransactionFields()">
</select>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<DIV id="idNameTo" class="smallbold"></DIV>
</td>
</tr>
<tr>
<td>Pay to</td>
<td>
<INPUT style="float: left" type="string" id="idTo" value="" onkeyup="OnEditIdTo()" onchange="OnEditIdTo()"placeholder="Payee (required)" >
<DIV id="TabSend" style="display: none">
<DIV id="idSendList"> </DIV>
<table class="form_input">
<tr>
<td style="min-width: 115px">From account</td>
<td>
<select size="1" id="idAccount" onkeyup="OnEditTransactionFields()" onchange="OnEditTransactionFields()">
</select>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<DIV id="idNameTo" class="smallbold"></DIV>
</td>
</tr>
<tr>
<td>Pay to</td>
<td>
<INPUT style="float: left" type="string" id="idTo" value="" onkeyup="OnEditIdTo()" onchange="OnEditIdTo()"placeholder="Payee (required)" >
</td>
</tr>
<tr>
<td>Amount</td>
<td>
<INPUT type="number" id="idSumSend" style="color:#1e21cb" value="" step=0 min=0 max=1000000000 onkeyup="OnEditTransactionFields()" onchange="OnEditTransactionFields()">&nbsp;
<button style="font-family: monospace;" onclick="SetAllSum()"></button>
<B id="idCoinName"></B>
</td>
</tr>
<tr>
<td>Description (optional)</td>
<td><textarea id="idDescription" rows="4" onkeyup="CheckLengthAccDesription('idDescription',200);OnEditTransactionFields()" onchange="OnEditTransactionFields()"></textarea>
</td>
<td>
<DIV id="idAttach"> </DIV>
</td>
</tr>
<tr>
<td>
</td>
<td>
<INPUT type="button" onclick="ClearTransaction()" class="bsend bt" value="Clear">
<INPUT type="button" onclick="EditJSONTransaction();SetImg(this,'edit_transaction');" class="bsend bt" value="Edit JSON" id="idDown">
<INPUT type="button" onclick="SendMoneyBefore()" class="bsend bt" id="idSendButton" value="Send" >
</td>
</tr>
<tr>
<td>Amount</td>
<td>
<INPUT type="number" id="idSumSend" style="color:#1e21cb" value="" step=0 min=0 max=1000000000 onkeyup="OnEditTransactionFields()" onchange="OnEditTransactionFields()">&nbsp;
<button style="font-family: monospace;" onclick="SetAllSum()"></button>
<B id="idCoinName"></B>
</td>
</tr>
<tr>
<td>Description (optional)</td>
<td><textarea id="idDescription" rows="4" onkeyup="CheckLengthAccDesription('idDescription',200);OnEditTransactionFields()" onchange="OnEditTransactionFields()"></textarea>
</td>
<td>
<DIV id="idAttach"> </DIV>
</td>
</tr>
<tr>
<td>
</td>
<td>
<INPUT type="button" onclick="ClearTransaction()" class="bsend bt" value="Clear">
<INPUT type="button" onclick="EditJSONTransaction();SetImg(this,'edit_transaction');" class="bsend bt" value="Edit JSON" id="idDown">
<INPUT type="button" onclick="SendMoneyBefore()" class="bsend bt" id="idSendButton" value="Send" >
</td>
</tr>
</table>
<DIV id="edit_transaction" style="display: none">
<textarea id="idTransaction" rows="20" onkeyup="StartEditTransactionJSON()" onchange="StartEditTransactionJSON()"></textarea>
<BR>
<INPUT type="button" onclick="SignJSON()" class="btdoit bt" value="Sign JSON" id="idSignJSON">
<INPUT type="button" onclick="SendMoneyJSON()" class="btdoit bt" value="Send from JSON">
</tr>
</table>
<DIV id="edit_transaction" style="display: none">
<textarea id="idTransaction" rows="20" onkeyup="StartEditTransactionJSON()" onchange="StartEditTransactionJSON()"></textarea>
<BR>
<INPUT type="button" onclick="SignJSON()" class="btdoit bt" value="Sign JSON" id="idSignJSON">
<INPUT type="button" onclick="SendMoneyJSON()" class="btdoit bt" value="Send from JSON">
</DIV>
<script>
function SetAllSum()
<script>
function SetAllSum()
{
var Item=MapAccounts[$("idAccount").value];
if(Item)
$("idSumSend").value=FLOAT_FROM_COIN(Item.Value).toStringF();
}
</script>
</DIV>
<DIV id="TabDapps" style="display: none">
<INPUT type="button" onclick="window.Open('./HTML/dapp-edit.html','smart',1240)" class="btdoit btopen bt" id="idOpenSmart" value="Dapps editor">
<BR>
<DIV id="idPaginationDapps" style="display: block">
<!--<DIV id="view_header" >DAPPS</DIV><BR>-->
Search:<INPUT type="search" id="idViewDappsFilter" value="" onchange="CheckNewSearch(DefDapps); ViewCurrent(DefDapps)">
Category:
<select size="1" id="idCategory" onchange="ViewCurrent(DefDapps)">
</select>
<BR>
<INPUT type="button" onclick="ViewBegin(DefDapps)" class="btdoitm bt" value="|&lt;-">
<INPUT type="button" onclick="ViewPrev(DefDapps)" class="btdoit bt" value="&lt;&lt; Prev">
<INPUT type="number" id="idViewDappNum" style="text-align: center" value="0" min=0 max=1000000000 onchange="ViewCurrent(DefDapps)">
<INPUT type="button" onclick="ViewNext(DefDapps,MaxDappsID)" class="btdoit bt" value="Next &gt;&gt;">
<INPUT type="button" onclick="ViewEnd(DefDapps,MaxDappsID)" class="btdoitm bt" value="-&gt;|">
<table id="grid_dapps_all" class="grid">
<tr>
<th id="(RetNumDapp(Item))" class="num">ID</th>
<th id="(RetOpenDapps(Item,0,0))" class="accname">Name</th>
<th id="Item.Description" class="code">Description</th>
<th id="(RetCategory(Item))" class="">Category</th>
<th id="(RetBaseAccount(Item))" class="num">Base Account</th>
<th id="(RetHistoryAccount(Item,'Owner'))" class="num">Owner</th>
<th id="RetBool(Item.TokenGenerate)" class="bool">Token generate</th>
<!--<th id="Item.ISIN" class="num">ISIN</th>-->
<th id="(RetOpenBlock(Item.BlockNum,1))" class="num">Block Num</th>
<!--<th id="GetHexFromArr(Item.SumHash)" class="hash">SumHash</th>-->
</tr>
</table>
<INPUT type="button" onclick="ViewPrev(DefDapps)" class="btdoit bt" value="&lt;&lt; Prev">
<INPUT type="button" onclick="ViewNext(DefDapps,MaxDappsID)" class="btdoit bt" value="Next &gt;&gt;">
</DIV>
</script>
</DIV>
<DIV id="TabExplorer" style="display: none">
<DIV id="TabDapps" style="display: none">
<INPUT type="button" onclick="window.Open('./HTML/stat.html','counters',920)" class="btdoit btopen bt" id="idCounters" value="Counters">
<INPUT type="button" onclick="window.Open('./HTML/chains.html','chains',1240,600)" class="btdoit btopen bt" id="idChains" value="Chains">
<INPUT type="button" onclick="window.Open('./HTML/console.html','console',1240)" class="btdoit btopen bt" id="idConsole" value="Console">
<INPUT type="button" onclick="window.Open('./HTML/monitor.html','monitor',1200)" class="btdoit btopen bt" id="idMonitor" value="Monitor">
<INPUT type="button" onclick="window.Open('./HTML/network.html','network',1200)" class="btdoit btopen bt" id="idNetwork" value="Network">
<INPUT type="button" onclick="window.Open('./HTML/dapp-edit.html','smart',1240)" class="btdoit btopen bt" id="idOpenSmart" value="Dapps editor">
<BR>
<INPUT type="button" onclick="ViewCurrent(DefAccounts,1,this);" class="btdoit bt btexlporer" id="idDown" value="Accounts">
<INPUT type="button" onclick="ViewCurrent(DefBlock,1,this)" class="btdoit bt btexlporer" id="idDown" value="Blocks & Tr">
<INPUT type="button" onclick="ViewCurrent(DefActs,1,this)" class="btdoit bt btexlporer" id="idDown" value="Accounts acts">
<INPUT type="button" onclick="ViewCurrent(DefHash,1,this)" class="btdoit bt btexlporer" id="idDown" value="Accounts hash">
<INPUT type="button" onclick="SetVisibleUtil(this)" class="btdoit bt btexlporer" id="idDown" value="Utilites">
<DIV id="idPaginationDapps" style="display: block">
<!--<DIV id="view_header" >DAPPS</DIV><BR>-->
Search:<INPUT type="search" id="idViewDappsFilter" value="" onchange="CheckNewSearch(DefDapps); ViewCurrent(DefDapps)">
Category:
<select size="1" id="idCategory" onchange="ViewCurrent(DefDapps)">
</select>
<BR>
<script>
function SetVisibleUtil(This)
<INPUT type="button" onclick="ViewBegin(DefDapps)" class="btdoitm bt" value="|&lt;-">
<INPUT type="button" onclick="ViewPrev(DefDapps)" class="btdoit bt" value="&lt;&lt; Prev">
<INPUT type="number" id="idViewDappNum" style="text-align: center" value="0" min=0 max=1000000000 onchange="ViewCurrent(DefDapps)">
<INPUT type="button" onclick="ViewNext(DefDapps,MaxDappsID)" class="btdoit bt" value="Next &gt;&gt;">
<INPUT type="button" onclick="ViewEnd(DefDapps,MaxDappsID)" class="btdoitm bt" value="-&gt;|">
<table id="grid_dapps_all" class="grid">
<tr>
<th id="(RetNumDapp(Item))" class="num">ID</th>
<th id="(RetOpenDapps(Item,0,0))" class="accname">Name</th>
<th id="Item.Description" class="code">Description</th>
<th id="(RetCategory(Item))" class="">Category</th>
<th id="(RetBaseAccount(Item))" class="num">Base Account</th>
<th id="(RetHistoryAccount(Item,'Owner'))" class="num">Owner</th>
<th id="RetBool(Item.TokenGenerate)" class="bool">Token generate</th>
<!--<th id="Item.ISIN" class="num">ISIN</th>-->
<th id="(RetOpenBlock(Item.BlockNum,1))" class="num">Block Num</th>
<!--<th id="GetHexFromArr(Item.SumHash)" class="hash">SumHash</th>-->
</tr>
</table>
<INPUT type="button" onclick="ViewPrev(DefDapps)" class="btdoit bt" value="&lt;&lt; Prev">
<INPUT type="button" onclick="ViewNext(DefDapps,MaxDappsID)" class="btdoit bt" value="Next &gt;&gt;">
</DIV>
</DIV>
<DIV id="TabExplorer" style="display: none">
<INPUT type="button" onclick="window.Open('./HTML/stat.html','counters',920)" class="btdoit btopen bt" id="idCounters" value="Counters">
<INPUT type="button" onclick="window.Open('./HTML/chains.html','chains',1240,600)" class="btdoit btopen bt" id="idChains" value="Chains">
<INPUT type="button" onclick="window.Open('./HTML/console.html','console',1240)" class="btdoit btopen bt" id="idConsole" value="Console">
<INPUT type="button" onclick="window.Open('./HTML/monitor.html','monitor',1200)" class="btdoit btopen bt" id="idMonitor" value="Monitor">
<INPUT type="button" onclick="window.Open('./HTML/network.html','network',1200)" class="btdoit btopen bt" id="idNetwork" value="Network">
<BR>
<INPUT type="button" onclick="ViewCurrent(DefAccounts,1,this);" class="btdoit bt btexlporer" id="idDown" value="Accounts">
<INPUT type="button" onclick="ViewCurrent(DefBlock,1,this)" class="btdoit bt btexlporer" id="idDown" value="Blocks & Tr">
<INPUT type="button" onclick="ViewCurrent(DefActs,1,this)" class="btdoit bt btexlporer" id="idDown" value="Accounts acts">
<INPUT type="button" onclick="ViewCurrent(DefHash,1,this)" class="btdoit bt btexlporer" id="idDown" value="Accounts hash">
<INPUT type="button" onclick="SetVisibleUtil(this)" class="btdoit bt btexlporer" id="idDown" value="Utilites">
<script>
function SetVisibleUtil(This)
{
MoveUp($("idUtilView"));
SetVisibleBlock('idUtilView',!IsVisibleBlock('idUtilView'));
SetImg(This,'idUtilView');
}
</script>
</script>
<BR>
<DIV>
<DIV id="idPaginationAccount" style="display: none">
<HR>
<DIV id="view_header">Accounts</DIV><BR>
Search:<INPUT type="search" id="idViewAccountFilter" value="" onchange="CheckNewSearch(DefAccounts); ViewCurrent(DefAccounts)">
<INPUT type="button" onclick="ViewBegin(DefAccounts)" class="btdoitm bt" value="|&lt;-">
<INPUT type="button" onclick="ViewPrev(DefAccounts)" class="btdoit bt" value="&lt;&lt; Prev">
<INPUT type="number" id="idViewAccountNum" style="text-align: center" value="0" min=0 max=1000000000 onchange="ViewCurrent(DefAccounts)">
<INPUT type="button" onclick="ViewNext(DefAccounts,MaxAccID)" class="btdoit bt" value="Next &gt;&gt;">
<INPUT type="button" onclick="ViewEnd(DefAccounts,MaxAccID)" class="btdoitm bt" value="-&gt;|">
<table id="grid_accounts_all" class="grid">
<tr>
<th id="(RetHistoryAccount(Item))" class="num">ID</th>
<th id="SUM_TO_STRING(Item.Value)" class="sum smallbold">Amount</th>
<th id="CurrencyNameItem(Item)" class="cur">Cur</th>
<th id="Item.Name" class="accname">Name</th>
<th id="Item.PubKeyStr" class="pubkey">PubKey</th>
<th id="Item.Value.OperationID" class="num">Operation</th>
<th id="(RetHistoryAccount(Item,'Adviser'))" class="num">Adviser
</th>
<th id="Item.Value.Smart" class="num">Smart</th>
<th id="(RetOpenBlock(Item.BlockNumCreate,1))" class="num">Block Num
</th>
<!--<th id="Item.Arr[0].BlockNum" class="num">0</th>-->
<!--<th id="Item.Arr[1].BlockNum" class="num">1</th>-->
<!--<th id="Item.Arr[2].BlockNum" class="num">2</th>-->
<!--<th id="Item.Arr[3].BlockNum" class="num">3</th>-->
<!--<th id="Item.Arr[4].BlockNum" class="num">4</th>-->
</tr>
</table>
<INPUT type="button" onclick="ViewPrev(DefAccounts)" class="btdoit bt" value="&lt;&lt; Prev">
<INPUT type="button" onclick="ViewNext(DefAccounts,MaxAccID)" class="btdoit bt" value="Next &gt;&gt;">
<BR>
<B><DIV id="idTotalSum"></DIV></B>
<BR>
</DIV>
<DIV id="idPaginationBlock" style="display: none">
<BR>
<DIV>
<DIV id="idPaginationAccount" style="display: none">
<HR>
<DIV id="view_header">Blocks<BR></DIV>
<!--<DIV id="idFilterB">JS:<INPUT type="search" id="idViewBlockFilter" value="" onchange="ViewCurrent(DefBlock)"></DIV>-->
<INPUT type="button" onclick="ViewBegin(DefBlock)" class="btdoitm bt" value="|&lt;-">
<INPUT type="button" onclick="ViewPrev(DefBlock)" class="btdoit bt" value="&lt;&lt; Prev">
<INPUT type="number" id="idViewBlockNum" style="text-align: center" value="0" min=0 max=1000000000 onchange="ViewCurrent(DefBlock)">
<INPUT type="button" onclick="ViewNext(DefBlock,ServerBlockNumDB)" class="btdoit bt" value="Next &gt;&gt;">
<INPUT type="button" onclick="ViewEnd(DefBlock,ServerBlockNumDB)" class="btdoitm bt" value="-&gt;|">
<DIV id="view_header">Accounts</DIV><BR>
Search:<INPUT type="search" id="idViewAccountFilter" value="" onchange="CheckNewSearch(DefAccounts); ViewCurrent(DefAccounts)">
<INPUT type="button" onclick="ViewBegin(DefAccounts)" class="btdoitm bt" value="|&lt;-">
<INPUT type="button" onclick="ViewPrev(DefAccounts)" class="btdoit bt" value="&lt;&lt; Prev">
<INPUT type="number" id="idViewAccountNum" style="text-align: center" value="0" min=0 max=1000000000 onchange="ViewCurrent(DefAccounts)">
<INPUT type="button" onclick="ViewNext(DefAccounts,MaxAccID)" class="btdoit bt" value="Next &gt;&gt;">
<INPUT type="button" onclick="ViewEnd(DefAccounts,MaxAccID)" class="btdoitm bt" value="-&gt;|">
<table id="grid_block_all" class="grid">
<tr>
<table id="grid_accounts_all" class="grid">
<tr>
<th id="(RetHistoryAccount(Item))" class="num">ID</th>
<th id="SUM_TO_STRING(Item.Value)" class="sum smallbold">Amount
</th>
<th id="CurrencyNameItem(Item)" class="cur">Cur</th>
<th id="Item.Name" class="accname">Name</th>
<th id="Item.PubKeyStr" class="pubkey">PubKey</th>
<th id="Item.Value.OperationID" class="num">Operation</th>
<th id="(RetHistoryAccount(Item,'Adviser'))" class="num">Adviser
</th>
<th id="Item.Value.Smart" class="num">Smart</th>
<th id="(RetOpenBlock(Item.BlockNumCreate,1))" class="num">Block
Num
</th>
<!--<th id="Item.Arr[0].BlockNum" class="num">0</th>-->
<!--<th id="Item.Arr[1].BlockNum" class="num">1</th>-->
<!--<th id="Item.Arr[2].BlockNum" class="num">2</th>-->
<!--<th id="Item.Arr[3].BlockNum" class="num">3</th>-->
<!--<th id="Item.Arr[4].BlockNum" class="num">4</th>-->
</tr>
</table>
<th id="(RetOpenBlock(Item.BlockNum,Item.TrDataLen))"
class="num">Num</th>
<th id="(DateFromBlock(Item.BlockNum,1))" class="date">Date
</th>
<th id="GetHexFromArr(Item.TreeHash)" class="hash">Data Hash
</th>
<th id="GetHexFromArr(Item.PowHash)" class="hash">PowHash
</th>
<th id="GetHexFromArr(Item.Hash)" class="hash">Block Hash
</th>
<!--<th id="GetHexFromArr(Item.SumHash)" class="hash">SumHash</th>-->
<th id="Item.TrDataLen" class="num">Bytes</th>
<th id="Item.Power" class="num">Pow</th>
<th id="(RetHistoryAccount(Item,'Miner')+'<BR><b>'+Item.MinerName)+'</b>'"
class="num">Miner</th>
<INPUT type="button" onclick="ViewPrev(DefAccounts)" class="btdoit bt" value="&lt;&lt; Prev">
<INPUT type="button" onclick="ViewNext(DefAccounts,MaxAccID)" class="btdoit bt" value="Next &gt;&gt;">
<BR>
<B><DIV id="idTotalSum"></DIV></B>
<BR>
</DIV>
<DIV id="idPaginationBlock" style="display: none">
<HR>
<DIV id="view_header">Blocks<BR></DIV>
<!--<DIV id="idFilterB">JS:<INPUT type="search" id="idViewBlockFilter" value="" onchange="ViewCurrent(DefBlock)"></DIV>-->
<INPUT type="button" onclick="ViewBegin(DefBlock)" class="btdoitm bt" value="|&lt;-">
<INPUT type="button" onclick="ViewPrev(DefBlock)" class="btdoit bt" value="&lt;&lt; Prev">
<INPUT type="number" id="idViewBlockNum" style="text-align: center" value="0" min=0 max=1000000000 onchange="ViewCurrent(DefBlock)">
<INPUT type="button" onclick="ViewNext(DefBlock,ServerBlockNumDB)" class="btdoit bt" value="Next &gt;&gt;">
<INPUT type="button" onclick="ViewEnd(DefBlock,ServerBlockNumDB)" class="btdoitm bt" value="-&gt;|">
<table id="grid_block_all" class="grid">
<tr>
<th id="(RetOpenBlock(Item.BlockNum,Item.TrDataLen))"
class="num">Num</th>
<th id="(DateFromBlock(Item.BlockNum,1))" class="date">
Date
</th>
<th id="GetHexFromArr(Item.TreeHash)" class="hash">Data
Hash
</th>
<th id="GetHexFromArr(Item.PowHash)" class="hash">
PowHash
</th>
<th id="GetHexFromArr(Item.Hash)" class="hash">Block
Hash
</th>
<!--<th id="GetHexFromArr(Item.SumHash)" class="hash">SumHash</th>-->
<th id="Item.TrDataLen" class="num">Bytes</th>
<th id="Item.Power" class="num">Pow</th>
<th id="(RetHistoryAccount(Item,'Miner')+'<BR><b>'+Item.MinerName)+'</b>'"
class="num">Miner</th>
<!--<th id="GetHexFromArr(Item.Hash1)" class="hash">Hash1</th>-->
<!--<th id="GetHexFromArr(Item.Hash2)" class="hash">Hash2</th>-->
<!--<th id="GetHexFromArr(Item.Hash1)" class="hash">Hash1</th>-->
<!--<th id="GetHexFromArr(Item.Hash2)" class="hash">Hash2</th>-->
<!--<th id="GetHexFromArr(Item.AddrHash)" class="hash">AddrHash</th>-->
<!--<th id="GetHexFromArr(Item.AddrHash)" class="hash">AddrHash</th>-->
<!--<th id="ReadUintFromArr(Item.AddrHash,6)" class="hash">Nonce0</th>-->
<!--<th id="ReadUintFromArr(Item.AddrHash,12)" class="hash">Nonce1</th>-->
<!--<th id="ReadUintFromArr(Item.AddrHash,18)" class="hash">Nonce2</th>-->
<!--<th id="ReadUintFromArr(Item.AddrHash,6)" class="hash">Nonce0</th>-->
<!--<th id="ReadUintFromArr(Item.AddrHash,12)" class="hash">Nonce1</th>-->
<!--<th id="ReadUintFromArr(Item.AddrHash,18)" class="hash">Nonce2</th>-->
<!--<th id="GetPowPower(Item.Hash1)" class="num">Pow1</th>-->
<!--<th id="GetPowPower(Item.Hash2)" class="num">Pow2</th>-->
</tr>
</table>
<!--<th id="GetPowPower(Item.Hash1)" class="num">Pow1</th>-->
<!--<th id="GetPowPower(Item.Hash2)" class="num">Pow2</th>-->
</tr>
</table>
<INPUT type="button" onclick="ViewPrev(DefBlock)" class="btdoit bt" value="&lt;&lt; Prev">
<INPUT type="button" onclick="ViewNext(DefBlock,ServerBlockNumDB)" class="btdoit bt" value="Next &gt;&gt;">
<INPUT type="button" onclick="ViewPrev(DefBlock)" class="btdoit bt" value="&lt;&lt; Prev">
<INPUT type="button" onclick="ViewNext(DefBlock,ServerBlockNumDB)" class="btdoit bt" value="Next &gt;&gt;">
</DIV>
<DIV id="idPaginationAct" style="display: none">
<HR>
<DIV id="view_header">Accounts acts<BR></DIV>
<INPUT type="button" onclick="ViewBegin(DefActs)" class="btdoitm bt" value="|&lt;-">
<INPUT type="button" onclick="ViewPrev(DefActs)" class="btdoit bt" value="&lt;&lt; Prev">
<INPUT type="number" id="idViewActNum" style="text-align: center" value="0" min=0 max=1000000000 onchange="ViewCurrent(DefActs)">
<INPUT type="button" onclick="ViewNext(DefActs,MaxActNum)" class="btdoit bt" value="Next &gt;&gt;">
<INPUT type="button" onclick="ViewEnd(DefActs,MaxActNum)" class="btdoitm bt" value="-&gt;|">
<DIV id="idPaginationAct" style="display: none">
<HR>
<DIV id="view_header">Accounts acts<BR></DIV>
<INPUT type="button" onclick="ViewBegin(DefActs)" class="btdoitm bt" value="|&lt;-">
<INPUT type="button" onclick="ViewPrev(DefActs)" class="btdoit bt" value="&lt;&lt; Prev">
<INPUT type="number" id="idViewActNum" style="text-align: center" value="0" min=0 max=1000000000 onchange="ViewCurrent(DefActs)">
<INPUT type="button" onclick="ViewNext(DefActs,MaxActNum)" class="btdoit bt" value="Next &gt;&gt;">
<INPUT type="button" onclick="ViewEnd(DefActs,MaxActNum)" class="btdoitm bt" value="-&gt;|">
<table id="grid_acts_all" class="grid">
<tr>
<th id="Item.Num" class="num">Num</th>
<th id="Item.ID" class="num">Account</th>
<th id="Item.Mode">Mode</th>
<th id="(RetOpenBlock(Item.BlockNum,1))"
class="num">Block</th>
<th id="Item.TrNum" class="num">TrNum</th>
<th id="(escapeHtml(DateFromBlock(Item.BlockNum,1)))"
class="date">Date</th>
<table id="grid_acts_all" class="grid">
<tr>
<th id="Item.Num" class="num">Num</th>
<th id="Item.ID" class="num">Account</th>
<th id="Item.Mode">Mode</th>
<th id="(RetOpenBlock(Item.BlockNum,1))"
class="num">Block</th>
<th id="Item.TrNum" class="num">TrNum</th>
<th id="(escapeHtml(DateFromBlock(Item.BlockNum,1)))"
class="date">Date</th>
<th id="Item.PrevValue.OperationID" class="num">
Prev. Operation</th>
<th id="SUM_TO_STRING(Item.PrevValue)" class="sum">
Prev. amount</th>
<th id="Item.PrevValue.NextPos" class="num">Prev.
History</th>
</tr>
</table>
<INPUT type="button" onclick="ViewPrev(DefActs)" class="btdoit bt" value="&lt;&lt; Prev">
<INPUT type="button" onclick="ViewNext(DefActs,MaxActNum)" class="btdoit bt" value="Next &gt;&gt;">
<th id="Item.PrevValue.OperationID" class="num">
Prev. Operation</th>
<th id="SUM_TO_STRING(Item.PrevValue)"
class="sum">
Prev. amount</th>
<th id="Item.PrevValue.NextPos" class="num">
Prev.
History</th>
</tr>
</table>
<INPUT type="button" onclick="ViewPrev(DefActs)" class="btdoit bt" value="&lt;&lt; Prev">
<INPUT type="button" onclick="ViewNext(DefActs,MaxActNum)" class="btdoit bt" value="Next &gt;&gt;">
</DIV>
<DIV id="idPaginationHash" style="display: none">
<HR>
<DIV id="view_header">Accounts hash<BR></DIV>
<INPUT type="button" onclick="ViewBegin(DefHash)" class="btdoitm bt" value="|&lt;-">
<INPUT type="button" onclick="ViewPrev(DefHash)" class="btdoit bt" value="&lt;&lt; Prev">
<INPUT type="number" id="idViewHashNum" style="text-align: center" value="0" min=0 max=1000000000 onchange="ViewCurrent(DefHash)">
<INPUT type="button" onclick="ViewNext(DefHash,CONFIG_DATA.MAX_ACCOUNT_HASH)" class="btdoit bt" value="Next &gt;&gt;">
<INPUT type="button" onclick="ViewEnd(DefHash,CONFIG_DATA.MAX_ACCOUNT_HASH)" class="btdoitm bt" value="-&gt;|">
<DIV id="idPaginationHash" style="display: none">
<HR>
<DIV id="view_header">Accounts hash<BR></DIV>
<INPUT type="button" onclick="ViewBegin(DefHash)" class="btdoitm bt" value="|&lt;-">
<INPUT type="button" onclick="ViewPrev(DefHash)" class="btdoit bt" value="&lt;&lt; Prev">
<INPUT type="number" id="idViewHashNum" style="text-align: center" value="0" min=0 max=1000000000 onchange="ViewCurrent(DefHash)">
<INPUT type="button" onclick="ViewNext(DefHash,CONFIG_DATA.MAX_ACCOUNT_HASH)" class="btdoit bt" value="Next &gt;&gt;">
<INPUT type="button" onclick="ViewEnd(DefHash,CONFIG_DATA.MAX_ACCOUNT_HASH)" class="btdoitm bt" value="-&gt;|">
<table id="grid_hash_all" class="grid">
<tr>
<th id="Item.Num" class="num">Num</th>
<th id="(RetOpenBlock(Item.BlockNum,3))"
class="">Block</th>
<th id="(escapeHtml(DateFromBlock(Item.BlockNum,1)))"
class="date">Date</th>
<th id="GetHexFromArr(Item.AccHash)"
class="code">AccHash</th>
<th id="GetHexFromArr(Item.SumHash)"
class="code">SumHash</th>
<th id="Item.AccountMax" class="num">
AccountMax</th>
<th id="Item.SmartCount" class="num">
SmartCount</th>
<th id="GetHexFromArr(Item.SmartHash)"
class="code">SmartHash</th>
<th id="GetHexFromArr(Item.Hash100)"
class="code">Hash100</th>
</tr>
</table>
<INPUT type="button" onclick="ViewPrev(DefHash)" class="btdoit bt" value="&lt;&lt; Prev">
<INPUT type="button" onclick="ViewNext(DefHash,CONFIG_DATA.MAX_ACCOUNT_HASH)" class="btdoit bt" value="Next &gt;&gt;">
<table id="grid_hash_all" class="grid">
<tr>
<th id="Item.Num" class="num">Num</th>
<th id="(RetOpenBlock(Item.BlockNum,3))"
class="">Block</th>
<th id="(escapeHtml(DateFromBlock(Item.BlockNum,1)))"
class="date">Date</th>
<th id="GetHexFromArr(Item.AccHash)"
class="code">AccHash</th>
<th id="GetHexFromArr(Item.SumHash)"
class="code">SumHash</th>
<th id="Item.AccountMax" class="num">
AccountMax</th>
<th id="Item.SmartCount" class="num">
SmartCount</th>
<th id="GetHexFromArr(Item.SmartHash)"
class="code">SmartHash</th>
<th id="GetHexFromArr(Item.Hash100)"
class="code">Hash100</th>
</tr>
</table>
<INPUT type="button" onclick="ViewPrev(DefHash)" class="btdoit bt" value="&lt;&lt; Prev">
<INPUT type="button" onclick="ViewNext(DefHash,CONFIG_DATA.MAX_ACCOUNT_HASH)" class="btdoit bt" value="Next &gt;&gt;">
</DIV>
<DIV id="idUtilView" style="display: none">
<HR>
<DIV id="view_header">UTILITES<BR></DIV>
<DIV id="idUtilView" style="display: none">
<HR>
<DIV id="view_header">UTILITES<BR></DIV>
Number of blocks in
depth:<INPUT type="number" id="idBlockCount" onchange = "SaveValues()" value="0"><BR>
<INPUT type="button" onclick="RestartNode()" class="bt btdoit btlong" value="Restart node">
<INPUT type="button" onclick="RewriteTransactions()" class="bt btdoit btlong" value="Rewrite transactions">
<INPUT type="button" onclick="TruncateBlockChain()" class="btdoit btlong bt" value="Truncate chain">
<INPUT type="button" onclick="ClearDataBase();InitArrInfo();" class="btdoit btlong bt" value="Clear DataBase <!>">
Number of blocks in
depth:<INPUT type="number" id="idBlockCount" onchange = "SaveValues()" value="0"><BR>
<INPUT type="button" onclick="RestartNode()" class="bt btdoit btlong" value="Restart node">
<INPUT type="button" onclick="RewriteTransactions()" class="bt btdoit btlong" value="Rewrite transactions">
<INPUT type="button" onclick="TruncateBlockChain()" class="btdoit btlong bt" value="Truncate chain">
<INPUT type="button" onclick="ClearDataBase();InitArrInfo();" class="btdoit btlong bt" value="Clear DataBase <!>">
<DIV id="idDevelopService2">
<INPUT type="button" onclick="CleanChain()" class="bt btdoit btlong" value="Clean chain">
<BR>
<textarea id="idRunText" rows="8" cols="98" autofocus></textarea>
<BR>
<INPUT type="button" onclick="SetRun()" class="bt btdoit" value="Set run">
<DIV id="idDevelopService2">
<INPUT type="button" onclick="CleanChain()" class="bt btdoit btlong" value="Clean chain">
<BR>
<textarea id="idRunText" rows="8" cols="98" autofocus></textarea>
<BR>
<INPUT type="button" onclick="SetRun()" class="bt btdoit" value="Set run">
</DIV>
<BR>
<BR>
</DIV>
</DIV>
</DIV>
</DIV>
<BR>
<DIV id="idServerBlock" style="width: 99.5%">
<HR>
Log from node:
<DIV id="idServerLog"></DIV><BR>
<BR>
<DIV id="idServerBlock"
style="width: 99.5%">
<HR>
Log from node:
<DIV id="idServerLog"></DIV><BR>
</DIV>
<FORM id="idBlockPasswordSet"
style="display: none">
<H3 align="center">Enter new password:
</H3>
<table class="password"
id="idTablePassword1">
<tr style="display: none">
<td>
<DIV>Login:</DIV>
</td>
<td><INPUT type="string" id="Login1" value=""></td>
</tr>
<tr>
<td>
<DIV>Password:</DIV>
</td>
<td><INPUT type="password" autocomplete="WalletPassword" id="idPassword1" value=""></td>
</tr>
<tr>
<td>
<DIV>Repeat:</DIV>
</td>
<td><INPUT type="password" autocomplete="WalletPassword" id="idPassword2" onkeyup="" value=""></td>
</tr>
<FORM id="idBlockPasswordSet"
style="display: none">
<H3 align="center">Enter new
password:
</H3>
<table class="password"
id="idTablePassword1">
<tr style="display: none">
<td>
<DIV>Login:</DIV>
</td>
<td><INPUT type="string" id="Login1" value=""></td>
</tr>
<tr>
<td>
<DIV>Password:</DIV>
</td>
<td><INPUT type="password" autocomplete="WalletPassword" id="idPassword1" value=""></td>
</tr>
<tr>
<td>
<DIV>Repeat:</DIV>
</td>
<td><INPUT type="password" autocomplete="WalletPassword" id="idPassword2" onkeyup="" value=""></td>
</tr>
<tr>
<td></td>
<td><INPUT type="button" onclick="SetPassword()" class="bt" value="Set">
<INPUT type="button" onclick="CancelSetPassword()" class="bt" value="Cancel"></td>
</tr>
<tr>
<td></td>
<td><INPUT type="button" onclick="SetPassword()" class="bt" value="Set">
<INPUT type="button" onclick="CancelSetPassword()" class="bt" value="Cancel"></td>
</tr>
</table>
</FORM>
<FORM id="idBlockPasswordGet"
style="display: none">
<H3 align="center">Enter your password:
</H3>
<table class="password"
id="idTablePassword2">
<tr style="display: none">
<td>
<DIV>Login:</DIV>
</td>
<td><INPUT type="string" id="Login2" value=""></td>
</tr>
<tr>
<td>
<DIV>Password:</DIV>
</td>
<td><INPUT type="password" autocomplete="WalletPassword" id="idPasswordGet" value=""></td>
</tr>
<tr>
<td></td>
<td><INPUT type="button" onclick="SetPassword()" class="bt" value="Set">
<INPUT type="button" onclick="CancelSetPassword()" class="bt" value="Cancel"></td>
</tr>
</table>
</FORM>
</table>
</FORM>
<FORM id="idBlockPasswordGet"
style="display: none">
<H3 align="center">Enter your
password:
</H3>
<table class="password"
id="idTablePassword2">
<tr style="display: none">
<td>
<DIV>Login:</DIV>
</td>
<td><INPUT type="string" id="Login2" value=""></td>
</tr>
<tr>
<td>
<DIV>Password:</DIV>
</td>
<td><INPUT type="password" autocomplete="WalletPassword" id="idPasswordGet" value=""></td>
</tr>
<tr>
<td></td>
<td><INPUT type="button" onclick="SetPassword()" class="bt" value="Set">
<INPUT type="button" onclick="CancelSetPassword()" class="bt" value="Cancel"></td>
</tr>
</table>
</FORM>
<DIV id="idBlockOnSend"
style="display: none">
<DIV align="center">
Send <B id="idOnSendText"></B><BR>
<button onclick="SendMoney2()" id="idBtOnSend" class="radius">Send</button>
<button onclick='SetVisibleBlock("idBlockOnSend",0);' class="radius">Cancel</button>
<DIV id="idBlockOnSend"
style="display: none">
<DIV align="center">
Send
<B id="idOnSendText"></B><BR>
<button onclick="SendMoney2()" id="idBtOnSend" class="radius">Send</button>
<button onclick='SetVisibleBlock("idBlockOnSend",0);' class="radius">Cancel</button>
<DIV align="left">
<DIV id="idCheckOnSend">
<input type="checkbox" id="idWhiteOnSend"/> Add this account to white list</DIV>
<DIV align="left">
<DIV id="idCheckOnSend">
<input type="checkbox" id="idWhiteOnSend"/> Add this account to white list</DIV>
</DIV>
</DIV>
</DIV>
<audio style="visibility: hidden;"
controls="controls"
id="sound_coin">
<source src="coin.mp3"
type="audio/mpeg" />
</audio>
<audio style="visibility: hidden;"
controls="controls"
id="sound_err">
<source src="click.mp3"
type="audio/mpeg" />
</audio>
</DIV>
<audio style="visibility: hidden;"
controls="controls" id="sound_coin">
<source src="coin.mp3"
type="audio/mpeg" />
</audio>
<audio style="visibility: hidden;"
controls="controls" id="sound_err">
<source src="click.mp3"
type="audio/mpeg" />
</audio>
</DIV>
</DIV>
</body>
</html>

7
src/constant/account.ts Normal file
View File

@ -0,0 +1,7 @@
export enum TYPE_TRANSACTION {
TYPE_TRANSACTION_CREATE = 100,
TYPE_DEPRECATED_TRANSFER1 = 105,
TYPE_DEPRECATED_TRANSFER2 = 110,
TYPE_TRANSACTION_TRANSFER = 111,
TYPE_TRANSACTION_ACC_HASH = 119
}

View File

@ -1,42 +0,0 @@
/*
* @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
*/
import * as crypto from 'crypto'
global.HTTPCaller.CreateAccount = function(Params, response) {
if (typeof Params === "object" && Params.Name && Params.PubKey) {
var TYPE_TRANSACTION_CREATE = 100;
var TR = {
Type: global.TYPE_TRANSACTION_CREATE,
Currency: Params.Currency,
PubKey: global.GetArrFromHex(Params.PubKey), Description: Params.Name,
Smart: Params.Smart, Adviser: 0,
};
global.BufLib.GetBufferFromObject(TR, global.FORMAT_CREATE, 1000, {});
return { result: 1 };
}
return { result: 0 };
};
var MaxCountViewRows = global.HTTP_MAX_COUNT_ROWS;
global.HTTPCaller.GetBalance = function(Params) {
if (typeof Params === "object") {
var arr = global.DApps.Accounts.GetRowsAccounts(global.ParseNum(Params.AccountID), 1);
if (arr.length) {
arr[0].result = 1;
return arr[0];
}
}
return { result: 0 };
};
global.HTTPCaller.GenerateKeys = function(Params) {
var KeyPair = crypto.createECDH('secp256k1');
var PrivKey = global.sha3(crypto.randomBytes(32));
KeyPair.setPrivateKey(Buffer.from(PrivKey));
var PubKey = KeyPair.getPublicKey('' as any, 'compressed');
return { result: 1, PrivKey: global.GetHexFromArr(PrivKey), PubKey: global.GetHexFromArr(PubKey) };
};

View File

@ -1,10 +0,0 @@
/*
* @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
*/

View File

@ -279,7 +279,7 @@ class SMemBuffer {
this.MetaMap1 = {}
}
};
class STreeBuffer {
export class STreeBuffer {
KeyType
MetaTree1
MetaTree2

View File

@ -10,6 +10,8 @@
"use strict";
import CBlock from './block-loader'
import { RBTree } from './library'
import { STreeBuffer } from './base';
require('./library');
require('./crypto-library');
const TX_PROCESS_TIME = 100;
@ -52,7 +54,7 @@ export default class CConsensus extends CBlock {
this.CurrentBlockNum = 0
this.SendBlockID = 0
this.RelayMode = false
this.TreeSendPacket = new global.RBTree(global.CompareItemHash)
this.TreeSendPacket = new RBTree(global.CompareItemHash)
if (!global.ADDRLIST_MODE && !this.VirtualMode) {
this.idBlockChainTimer = setInterval(this.StartBlockChain.bind(this), global.CONSENSUS_PERIOD_TIME - 5)
setInterval(this.DoTransfer.bind(this), global.CONSENSUS_CHECK_TIME)
@ -86,8 +88,8 @@ export default class CConsensus extends CBlock {
Context.TransferFromAddr = {}
Context.LevelsTransfer = []
Context.ErrRun = ""
Context.PowTxTree = new global.RBTree(global.CompareItemTimePow)
Context.PowTicketTree = new global.RBTree(global.CompareItemTimePow)
Context.PowTxTree = new RBTree(global.CompareItemTimePow)
Context.PowTicketTree = new RBTree(global.CompareItemTimePow)
Context.bSave = false
Context.PrevHash = undefined
Context.TreeHash = undefined
@ -127,7 +129,7 @@ export default class CConsensus extends CBlock {
return Context;
}
StartConsensus() {
if (!global.global.CAN_START)
if (!global.CAN_START)
return;
var StartBlockNum = global.GetCurrentBlockNumByTime();
if (StartBlockNum < global.BLOCK_PROCESSING_LENGTH2)
@ -137,8 +139,7 @@ export default class CConsensus extends CBlock {
if (!Block0.Active) {
global.AddInfoBlock(Block0, "Activate")
this.StartBlock(Block0)
}
else {
} else {
global.AddInfoBlock(Block0, "Was Active")
}
}
@ -368,12 +369,10 @@ export default class CConsensus extends CBlock {
this.AddTrToBlockQuote(Block, Data.Array[i], 1)
}
}
static
TRANSFERTX_F() {
static TRANSFERTX_F() {
return "{BlockNum:uint, Array:[{body:tr}]}";
}
static
GETTRANSFERTX_F() {
static GETTRANSFERTX_F() {
return "{BlockNum:uint, TicketArray:[{HashTicket:arr10}]}";
}
GETTRANSFERTX(Info, CurTime) {
@ -696,7 +695,7 @@ export default class CConsensus extends CBlock {
}
AddPOWToMaxTree(POW, item) {
if (!POW.MaxTree) {
POW.MaxTree = new global.RBTree(function(a, b) {
POW.MaxTree = new RBTree(function(a: any, b: any) {
return global.CompareArr(a.PowHash, b.PowHash);
})
}
@ -1396,7 +1395,7 @@ export default class CConsensus extends CBlock {
}
}
};
global.TreeBlockBuf = new global.STreeBuffer(50 * 1000, global.CompareItemHashSimple, "string");
global.TreeBlockBuf = new STreeBuffer(50 * 1000, global.CompareItemHashSimple, "string");
var PrevTimeIdle = 0;
OnTimeIdle();

View File

@ -11,6 +11,8 @@
"use strict";
import * as fs from 'fs'
import CRest from './rest-loader'
import { TYPE_TRANSACTION } from '../constant/account';
import { STreeBuffer } from './base';
//import * as crypto from 'crypto';
require('./block-loader-const');
const STAT_BLOCK_LOAD_PERIOD = global.CONSENSUS_PERIOD_TIME / 5;
@ -356,7 +358,7 @@ export default class CBlock extends CRest {
Node = arr[this.TaskNodeIndex % arr.length]
}
if (Node.Active) {
if (!Node.INFO || !Node.INFO.WasPing || Node.StopGetBlock || (Node.INFO.CheckPointHashDB && global.global.CHECK_POINT.BlockNum && global.CompareArr(global.global.CHECK_POINT.Hash,
if (!Node.INFO || !Node.INFO.WasPing || Node.StopGetBlock || (Node.INFO.CheckPointHashDB && global.CHECK_POINT.BlockNum && global.CompareArr(global.CHECK_POINT.Hash,
Node.INFO.CheckPointHashDB) !== 0)) {
timewait = true
continue;
@ -415,8 +417,7 @@ export default class CBlock extends CRest {
}
return false;
}
static
GETBLOCKHEADER_F() {
static GETBLOCKHEADER_F() {
return "{\
Foward:byte,\
BlockNum:uint,\
@ -425,8 +426,7 @@ export default class CBlock extends CRest {
IsSum:byte\
}";
}
static
GETBLOCKHEADER100_F() {
static GETBLOCKHEADER100_F() {
return "{\
BlockNum:uint,\
Hash:hash,\
@ -773,8 +773,7 @@ export default class CBlock extends CRest {
else {
if (global.IsZeroArr(Block.TreeHash)) {
Res = this.WriteBlockDB(Block)
}
else {
} else {
global.ToLogTrace("global.IsZeroArr(Block.TreeHash)")
throw "global.IsZeroArr(Block.TreeHash)";
}
@ -987,7 +986,7 @@ export default class CBlock extends CRest {
}
if (arrContent.length > 0 && Data.BlockNum % global.PERIOD_ACCOUNT_HASH === 0) {
var TR = arrContent[0];
if (TR[0] === global.TYPE_TRANSACTION_ACC_HASH) {
if (TR[0] === TYPE_TRANSACTION.TYPE_TRANSACTION_ACC_HASH) {
if (!global.DApps.Accounts.TRCheckAccountHash(TR, Data.BlockNum)) {
global.ToLog(`global.DApps.Accounts.TRCheckAccountHash(TR, Data.BlockNum) ${JSON.stringify(TR)}, ${Data.BlockNum}`)
if (!this.BADHashCount)
@ -1295,8 +1294,7 @@ global.LoadBlockFromNetwork = function(Params, F) {
var ResError;
if (!Block.arrContent || Block.arrContent.length === 0) {
ResError = 1;
}
else {
} else {
ResError = 0;
global.SERVER.WriteBlockDB(Block);
}
@ -1310,4 +1308,4 @@ global.LoadBlockFromNetwork = function(Params, F) {
F(1);
}
};
global.HistoryBlockBuf = new global.STreeBuffer(global.HISTORY_BLOCK_COUNT * 1000, global.CompareItemHashSimple, "string");
global.HistoryBlockBuf = new STreeBuffer(global.HISTORY_BLOCK_COUNT * 1000, global.CompareItemHashSimple, "string");

View File

@ -28,6 +28,7 @@ const MAX_PERIOD_GETNODES = 120 * 1000;
global.MIN_PERIOD_PING = 4 * 1000;
const MAX_PERIOD_PING = 120 * 1000;
global.MAX_PING_FOR_CONNECT = 400;
const CAN_START_TIME_AVG = 200;
var MAX_TIME_CORRECT = 3 * 3600 * 1000;
global.MAX_WAIT_PERIOD_FOR_HOT = 4 * global.CONSENSUS_PERIOD_TIME;
const PERIOD_FOR_START_CHECK_TIME = 300;
@ -347,7 +348,7 @@ export default class CConnect extends CMessages {
}
global.ADD_TO_STAT("MAX:PING_TIME", DeltaTime)
if (!global.CAN_START)
if (Times && Times.Count >= 1 && Times.AvgDelta <= 200) {
if (Times && Times.Count >= 1 && Times.AvgDelta <= CAN_START_TIME_AVG) {
global.ToLog("****************************************** CAN_START")
global.CAN_START = true
}
@ -369,8 +370,7 @@ export default class CConnect extends CMessages {
this.TruncateBlockDB(this.BlockNumDB)
this.StartSyncBlockchain(Node, 0, 1)
}
}
else {
} else {
Node.NextConnectDelta = 60 * 1000
global.ToLog("Error Sign CheckPoint=" + Data.CheckPoint.BlockNum + " from " + global.NodeInfo(Node))
this.AddCheckErrCount(Node, 10, "Error Sign CheckPoint")
@ -1280,8 +1280,7 @@ export default class CConnect extends CMessages {
global.AddNodeInfo(Node, "DeleteFromActive")
this.DeleteNodeFromActive(Node)
}
}
else {
} else {
this.DetectGrayMode()
for (var Level = 0; Level < ArrTree.length; Level++) {
var arr = ArrTree[Level];

View File

@ -72,8 +72,8 @@ global.GetPublicKeyFromAddres = function(Arr) {
};
global.CheckDevelopSign = function(SignArr, Sign) {
var hash = global.SHA3BUF(SignArr);
for (var i = 0; i < DEVELOP_PUB_KEY_ARR.length; i++) {
var Result = secp256k1.verify(hash, Buffer.from(Sign), DEVELOP_PUB_KEY_ARR[i]);
for (var i = 0; i < global.DEVELOP_PUB_KEY_ARR.length; i++) {
var Result = secp256k1.verify(hash, Buffer.from(Sign), global.DEVELOP_PUB_KEY_ARR[i]);
if (Result)
return 1;
}
@ -963,13 +963,12 @@ global.IsDeveloperAccount = function(Key) {
global.DEVELOP_PUB_KEY_ARR = ["0222263942b11f7a78e11c43903094f870a2bf728bc8be085023b4eaf4e6228cd9", "02250c8c8f7f7e1468cdc5e9b9203841ba14250e2f480f77ebcd502f3e691506d8",
"027c0caec4e6f8f08d220f6dab24bb6f53d3f1d7b95231216805d9fac85d34a95f", "025defd5b884cc02f6948cd0d62b03d7b7445bf942206ab935158b6be8f0f7a2ce",
"024a97d69cd81c965f162b4b8b7b506263bc8aec8dbcea9eec59f73b5b470a0be1",];
let DEVELOP_PUB_KEY_ARR: any = global.DEVELOP_PUB_KEY_ARR;
for (var i = 0; i < DEVELOP_PUB_KEY_ARR.length; i++)
DEVELOP_PUB_KEY_ARR[i] = Buffer.from(global.GetArrFromHex(DEVELOP_PUB_KEY_ARR[i]));
global.DEVELOP_PUB_KEY = DEVELOP_PUB_KEY_ARR[0];
for (var i = 0; i < global.DEVELOP_PUB_KEY_ARR.length; i++)
global.DEVELOP_PUB_KEY_ARR[i] = Buffer.from(global.GetArrFromHex(global.DEVELOP_PUB_KEY_ARR[i]));
global.DEVELOP_PUB_KEY = global.DEVELOP_PUB_KEY_ARR[0];
global.DEVELOP_PUB_KEY0 = Buffer.from(global.GetArrFromHex("022e80aa78bc07c72781fac12488096f0bfa7b4f48fbab0f2a92e208d1ee3654df"));
if (global.LOCAL_RUN) {
global.DEVELOP_PUB_KEY0 = Buffer.from(global.GetArrFromHex("026A04AB98D9E4774AD806E302DDDEB63BEA16B5CB5F223EE77478E861BB583EB3"));
global.DEVELOP_PUB_KEY0 = Buffer.from(global.GetArrFromHex("03047E3BB0F0C1C46F478BDFA7DDAF908F5AEA0B303F33EB53ACC4F0FD14475A90"));
global.DEVELOP_PUB_KEY = global.DEVELOP_PUB_KEY0;
}
global.ARR_PUB_KEY = ["027ae0dce92d8be1f893525b226695ddf0fe6ad756349a76777ff51f3b59067d70", "02769165a6f9950d023a415ee668b80bb96b5c9ae2035d97bdfb44f356175a44ff",
@ -977,12 +976,11 @@ global.ARR_PUB_KEY = ["027ae0dce92d8be1f893525b226695ddf0fe6ad756349a76777ff51f3
"0270e0c5acb8eefe7faddac45503da4885e02fb554975d12907f6c33ac6c6bdba5", "0202f2aad628f46d433faf70ba6bf12ab9ed96a46923b592a72508dc43af36cb80",
"0254f373fc44ac4a3e80ec8cb8cc3693a856caa82e0493067bdead78ce8ec354b8", "027617f9511b0b0cdbda8f3e17907732731296321846f3fd6fd19460f7227d9482",
];
// let GetHexFromArr = global.GetHexFromArr;
if (global.TEST_NETWORK || global.LOCAL_RUN) {
for (var i = 0; i < 100; i++)
global.ARR_PUB_KEY[i] = global.GetHexFromArr(global.DEVELOP_PUB_KEY0);
global.DEVELOP_PUB_KEY_ARR = [global.DEVELOP_PUB_KEY0];
global.DEVELOP_PUB_KEY = DEVELOP_PUB_KEY_ARR[0];
global.DEVELOP_PUB_KEY = global.DEVELOP_PUB_KEY_ARR[0];
}
declare global {
namespace NodeJS {
@ -1030,7 +1028,7 @@ declare global {
Utf8ArrayToStr: Function;
GetArrFromStr: Function;
IsDeveloperAccount: Function;
DEVELOP_PUB_KEY_ARR: Buffer[] | string[];
DEVELOP_PUB_KEY_ARR: any[];
DEVELOP_PUB_KEY: any;
DEVELOP_PUB_KEY0: Buffer;
ARR_PUB_KEY: any;

View File

@ -668,11 +668,12 @@ export default class CDB extends CCode {
if (Block.BlockNum < 16 || Block.Miner > MaxAccount)
Block.Miner = 0
if (bMinerName && Block.Miner) {
var Item = global.DApps.Accounts.ReadState(Block.Miner);
if (Item && Item.Name)
Block.MinerName = Item.Name.substr(0, 8)
else
Block.MinerName = ""
Block.MinerName = ""
if (Block.Miner) {
var Item = global.DApps.Accounts.ReadState(Block.Miner);
if (Item && Item.Name)
Block.MinerName = Item.Name.substr(0, 8)
}
}
var Value = global.GetHashFromSeqAddr(Block.SeqHash, Block.AddrHash, Block.BlockNum, Block.PrevHash);
Block.Hash1 = Value.Hash1
@ -687,8 +688,7 @@ export default class CDB extends CCode {
try {
if (!eval(Filter))
continue;
}
catch (e) {
} catch (e) {
if (!WasError)
global.ToLog(e)
WasError = 1
@ -844,7 +844,7 @@ export default class CDB extends CCode {
var StartNumStat = this.StatMap.StartBlockNum;
var FinishNumStat = this.StatMap.StartBlockNum + this.StatMap.Length - 1;
var CountReadDB = 0;
var arr = new Array(MinLength);
let arr = new Array(MinLength);
var arrmy = new Array(MinLength);
for (var num = start; num < finish; num++) {
var i = num - start;
@ -884,7 +884,7 @@ export default class CDB extends CCode {
this.StatMap["POWER_BLOCKCHAIN"] = arr
this.StatMap["POWER_MY_WIN"] = arrmy
}
arr = this.StatMap[name];
var arr = this.StatMap[name];
if (!arr)
arr = []
var arrT = this.StatMap["POWER_BLOCKCHAIN"];
@ -940,11 +940,9 @@ export default class CDB extends CCode {
var Block = arr0[arr0.length - 1];
if (Block.BlockNum >= StartNum && Block.BlockNum <= EndBlockNum) {
var BlockDB = this.ReadBlockHeaderDB(Block.BlockNum);
if (!BlockDB || global.CompareArr(Block.SumHash, global.BlockDB.SumHash) !== 0) {
if (!BlockDB || global.CompareArr(Block.SumHash, BlockDB.SumHash) !== 0) {
arr0 = undefined
}
else {
}
}
}
var i0 = 0;

View File

@ -12,7 +12,7 @@
import * as fs from 'fs'
import Db from './db'
class DBRow extends Db {
export default class DBRow extends Db {
FileName;
DataSize;
Format;
@ -227,5 +227,3 @@ class DBRow extends Db {
this.CloseDBFile(this.FileName)
}
};
export default DBRow

View File

@ -11,7 +11,7 @@
"use strict";
import * as fs from 'fs'
class Db {
export default class Db {
DBMap;
LastHash;
WasUpdate;
@ -112,5 +112,3 @@ declare global {
}
}
}
export default Db;

View File

@ -12,10 +12,10 @@
import './crypto-library'
import './log'
import { secp256k1 } from '../core/library'
import http = require('http');
import url = require('url');
import fs = require('fs');
import querystring = require('querystring');
import * as http from 'http'
import * as url from 'url'
import * as fs from 'fs'
import * as querystring from 'querystring'
import * as crypto from 'crypto';
var BlockTree = new global.STreeBuffer(300 * 1000, global.CompareItemHashSimple, "number");
@ -529,7 +529,7 @@ HTTPCaller.GetWalletInfo = function(Params) {
CurTime: Date.now(),
IsDevelopAccount: global.IsDeveloperAccount(global.WALLET.PubKeyArr),
AccountMap: global.WALLET.AccountMap,
ArrLog: global.global.ArrLogClient,
ArrLog: global.ArrLogClient,
MaxAccID: global.DApps.Accounts.GetMaxAccount(),
MaxActNum: global.DApps.Accounts.GetActsMaxNum(),
MaxDappsID: global.DApps.Smart.GetMaxNum(),

View File

@ -10,6 +10,7 @@
"use strict";
import CDB from './db/block-db'
import { TYPE_TRANSACTION } from '../constant/account';
export default class CRest extends CDB {
LoadRestContext
BlockNumDB
@ -164,7 +165,7 @@ export default class CRest extends CDB {
var FindTx = undefined;
for (var n = 0; n < Data.arrContent.length; n++) {
var Body = Data.arrContent[n];
if (Body[0] === global.TYPE_TRANSACTION_ACC_HASH) {
if (Body[0] === TYPE_TRANSACTION.TYPE_TRANSACTION_ACC_HASH) {
try {
FindTx = global.BufLib.GetObjectFromBuffer(Body, global.FORMAT_ACCOUNT_HASH3, {})
}
@ -371,7 +372,7 @@ export default class CRest extends CDB {
}
}
GetBlockArrFromBuffer_Load(BufRead, Info?): any {
//defiend in block-loader.ts(CBlock)
}
RETBLOCKHEADER_REST(Info, CurTime) {
if (Info.Node.SendRestGetHeader === 2)

View File

@ -9,7 +9,7 @@
*/
"use strict";
import net = require("net");
import * as net from 'net'
// import dgram = require("dgram");
import * as crypto from 'crypto';
import "./library"

View File

@ -10,6 +10,7 @@
"use strict";
import CConsensus from './block-exchange'
import { TYPE_TRANSACTION } from '../constant/account';
require("../system/dapp");
require("../system/accounts");
require("../system/smart");
@ -175,7 +176,7 @@ export default class CSmartContract extends CConsensus {
return - 2;
if (Tr.num !== BlockNum)
return - 3;
if (Tr.body[0] === global.TYPE_TRANSACTION_ACC_HASH)
if (Tr.body[0] === TYPE_TRANSACTION.TYPE_TRANSACTION_ACC_HASH)
return - 4;
return 1;
}
@ -205,7 +206,7 @@ export default class CSmartContract extends CConsensus {
return;
var Item = global.DApps.Accounts.GetAccountHashItem(BlockNumHash);
if (Item) {
var Body = [global.TYPE_TRANSACTION_ACC_HASH];
var Body = [TYPE_TRANSACTION.TYPE_TRANSACTION_ACC_HASH];
global.WriteUintToArr(Body, BlockNumHash)
global.WriteArrToArr(Body, Item.AccHash, 32)
if (BlockNumHash >= global.START_BLOCK_ACCOUNT_HASH3) {

View File

@ -132,7 +132,7 @@ export default class CMessages extends CSmartContract {
}
this.SendF(Info.Node, { "Method": "MESSAGE", "Context": Info.Context, "Data": { Arr: arr } }, BufLength)
}
AddTransaction(Tr, ToAll) {
AddTransaction(Tr, ToAll?) {
Tr.ToAll = ToAll
var Res = this.IsValidTransaction(Tr, this.CurrentBlockNum);
if (Res <= 0 && Res !== - 3)

19
src/global.d.ts vendored
View File

@ -1,5 +1,9 @@
export { };
import CSmartContract from './core/transaction-validator'
import CConsensus from './core/block-exchange'
import CTransport from './core/server'
declare global {
var nw: any;
interface TeraError {
@ -46,7 +50,10 @@ declare global {
BLOCKNUM_TICKET_ALGO: number;
WATCHDOG_BADACCOUNT: number;
WATCHDOG_DEV: number;
RESYNC_CONDITION: any;
RESYNC_CONDITION: {
OWN_BLOCKS: number;
K_POW: number;
};
REST_BLOCK_SCALE: number;
REST_START_COUNT: number;
LOAD_TO_BEGIN: number;
@ -190,7 +197,7 @@ declare global {
ArrConnect: any[];
//#region main-process.ts:51
SERVER: any;
SERVER: CSmartContract | CConsensus | CTransport | any;
NeedRestart: number;
WEB_PROCESS: TeraProcess;
CountAllNode: number;
@ -241,12 +248,12 @@ declare global {
CompareItemBufFD: Function;
CompareArr33: Function;
CompareItemHashSimple: Function;
CompareItemHash: Function;
CompareItemHash: any;
CompareItemHash32: Function;
CompareItemHASH32: Function;
CompareItemHash33: Function;
CompareItemHashPow: Function;
CompareItemTimePow: Function;
CompareItemTimePow: any;
LOAD_CONST: Function;
SAVE_CONST: Function;
CheckGlobalTime: Function;
@ -368,7 +375,7 @@ declare global {
//#endregion
//#region web-process.ts
LoadBlockFromNetwork: Function;
LoadBlockFromNetwork: (Params, F?) => any;
GlobalRunID: number;
//#endregion
@ -525,7 +532,7 @@ declare global {
CopyObjValue: Function;
CopyArr: Function;
ParseNum: Function;
CompareArr: Function;
CompareArr: (a: any[], b: any[]) => number;
CompareArrL: Function;
shaarr2: Function;
sha3arr2: Function;

View File

@ -9,6 +9,7 @@
*/
let WebApi2: any = {};
import * as crypto from 'crypto';
import { TYPE_TRANSACTION } from '../constant/account';
WebApi2.GenerateKeys = function(Params) {
var KeyPair = crypto.createECDH('secp256k1');
var PrivKey = global.sha3(crypto.randomBytes(32));
@ -21,7 +22,7 @@ WebApi2.CreateAccount = function(Params, response) {
var KeyPair = crypto.createECDH('secp256k1');
KeyPair.setPrivateKey(Buffer.from(global.GetArrFromHex(Params.PrivKey)));
var PubKey = KeyPair.getPublicKey('' as any, 'compressed');
var TR: any = { Type: global.TYPE_TRANSACTION_CREATE, Currency: Params.Currency, PubKey: PubKey, Name: Params.Name, Smart: Params.Smart, };
var TR: any = { Type: TYPE_TRANSACTION.TYPE_TRANSACTION_CREATE, Currency: Params.Currency, PubKey: PubKey, Name: Params.Name, Smart: Params.Smart, };
var Body = global.BufLib.GetBufferFromObject(TR, global.FORMAT_CREATE, 1000, {}, 1);
Body = Body.slice(0, Body.len + 12);
SendTransaction(Body, TR as any, Params.Wait, function(result, text) {
@ -270,7 +271,7 @@ function CreateTxID(body, BlockNum, Nonce) {
function GetBlockNumTr(arr) {
var BlockNum = DELTA_FOR_TIME_TX + global.GetCurrentBlockNumByTime();
if (arr[0] === global.TYPE_TRANSACTION_CREATE) {
if (arr[0] === TYPE_TRANSACTION.TYPE_TRANSACTION_CREATE) {
var BlockNum2 = Math.floor(BlockNum / 10) * 10;
if (BlockNum2 < BlockNum)
BlockNum2 = BlockNum2 + 10;

View File

@ -10,8 +10,8 @@
import '../core/constant'
global.PROCESS_NAME = "MAIN";
import fs = require('fs');
import os = require('os');
import * as fs from 'fs'
import * as os from 'os'
// import path = require('path')
import * as crypto from 'crypto';
import { secp256k1 } from '../core/library'
@ -236,9 +236,8 @@ function StartChildProcess(Item) {
global.ToLog("KILL PROCESS " + ITEM.Name + ": " + ITEM.Worker.pid);
try {
process.kill(ITEM.Worker.pid, 'SIGKILL');
}
catch (e) {
global.ToLog("ERR KILL");
} catch (e) {
global.ToLog("ERR KILL" + e);
}
ITEM.Worker = undefined;
}

View File

@ -71,8 +71,7 @@ function StartHashPump(e) {
(!global.BlockPump || global.BlockPump.BlockNum < e.BlockNum || global.BlockPump.MinerID !== e.MinerID || global.BlockPump.Percent !== e.Percent) && (global.BlockPump = {
BlockNum: e.BlockNum,
RunCount: e.RunCount, MinerID: e.MinerID, Percent: e.Percent, LastNonce: 0
}), idIntervalPump = idIntervalPump || setInterval(PumpHash,
global.POWRunPeriod);
}), idIntervalPump = idIntervalPump || setInterval(PumpHash, global.POWRunPeriod);
};
var StartTime = 1, EndTime = 0;

View File

@ -14,6 +14,7 @@ import DApp from './dapp'
import DBRow from '../core/db/db-row'
import DBLib from "../core/db/db"
import { secp256k1 } from '../core/library'
import { TYPE_TRANSACTION } from '../constant/account'
require('../core/rest_tables');
const MAX_SUM_TER = 1e9;
const MAX_SUM_CENT = 1e9;
@ -76,7 +77,7 @@ global.FORMAT_ACCOUNT_HASH = "{\
BlockNum:uint,\
AccHash:buffer32,\
}";
global.global.FORMAT_ACCOUNT_HASH3 = "{\
global.FORMAT_ACCOUNT_HASH3 = "{\
Type:byte,\
BlockNum:uint,\
AccHash:buffer32,\
@ -317,7 +318,7 @@ class AccountApp extends DApp {
var Type = Body[0];
if (Type && Body.length > 90) {
switch (Type) {
case global.TYPE_TRANSACTION_CREATE:
case TYPE_TRANSACTION.TYPE_TRANSACTION_CREATE:
{
if (BlockNum % BLOCK_CREATE_INTERVAL !== 0)
return 0;
@ -371,7 +372,7 @@ class AccountApp extends DApp {
var Type = Body[0];
var Result;
switch (Type) {
case global.TYPE_TRANSACTION_CREATE:
case TYPE_TRANSACTION.TYPE_TRANSACTION_CREATE:
{
Result = this.TRCreateAccount(Body, BlockNum, TrNum, ContextFrom)
break;
@ -391,13 +392,13 @@ class AccountApp extends DApp {
Result = this.TRTransferMoney(Block, Body, BlockNum, TrNum, global.FORMAT_MONEY_TRANSFER3, WorkStructTransfer3)
break;
}
case global.TYPE_TRANSACTION_ACC_HASH:
case TYPE_TRANSACTION.TYPE_TRANSACTION_ACC_HASH:
{
Result = 1
if (global.LOCAL_RUN || global.TEST_NETWORK) {
} else {
if (BlockNum < global.global.START_BLOCK_ACCOUNT_HASH + 200000)
if (BlockNum < global.START_BLOCK_ACCOUNT_HASH + 200000)
break;
}
var BlockNumHash = BlockNum - global.DELTA_BLOCK_ACCOUNT_HASH;
@ -481,7 +482,7 @@ class AccountApp extends DApp {
var Type = Body[0];
var format;
switch (Type) {
case global.TYPE_TRANSACTION_CREATE:
case TYPE_TRANSACTION.TYPE_TRANSACTION_CREATE:
{
format = global.FORMAT_CREATE
break;
@ -501,9 +502,9 @@ class AccountApp extends DApp {
format = global.FORMAT_MONEY_TRANSFER3
break;
}
case global.TYPE_TRANSACTION_ACC_HASH:
case TYPE_TRANSACTION.TYPE_TRANSACTION_ACC_HASH:
{
format = global.global.FORMAT_ACCOUNT_HASH3
format = global.FORMAT_ACCOUNT_HASH3
break;
}
default:
@ -1393,11 +1394,11 @@ class AccountApp extends DApp {
};
var App = new AccountApp;
global.DApps["Accounts"] = App;
global.DAppByType[global.TYPE_TRANSACTION_CREATE] = App;
global.DAppByType[TYPE_TRANSACTION.TYPE_TRANSACTION_CREATE] = App;
global.DAppByType[TYPE_DEPRECATED_TRANSFER1] = App;
global.DAppByType[TYPE_DEPRECATED_TRANSFER2] = App;
global.DAppByType[TYPE_TRANSACTION_TRANSFER] = App;
global.DAppByType[global.TYPE_TRANSACTION_ACC_HASH] = App;
global.DAppByType[TYPE_TRANSACTION.TYPE_TRANSACTION_ACC_HASH] = App;
export default AccountApp;
// function TestStateFiles(Size, Format) {

View File

@ -370,7 +370,7 @@ class SmartApp extends DApp {
Filter = Filter.toUpperCase()
}
if (Category)
Category = global.global.ParseNum(Category)
Category = global.ParseNum(Category)
var WasError = 0;
var arr = [];
var Data;
@ -436,7 +436,7 @@ class SmartApp extends DApp {
this.DBSmart.Write(Item)
}
ReadSmart(Num) {
Num = global.global.ParseNum(Num)
Num = global.ParseNum(Num)
var Smart = this.DBSmart.GetMap("ITEM" + Num);
if (!Smart) {
Smart = this.DBSmart.Read(Num)

View File

@ -2,7 +2,6 @@
"compilerOptions": {
"outDir": "dist",
"allowJs": true,
"sourceMap": true,
"target": "es5"
},
"include": [