Blockchain 从仲裁区块链检索交易详细信息时出现性能问题
我在检索事务详细信息(如事务发起人和事务接收人)时遇到性能问题 来自仲裁区块链 loop和Web3.eth.contract(abi.at)(address2.totalTransactions)的Javascript用于检索事务细节和 然后附加到HTML表 我的性能问题是,从仲裁区块链检索几行事务数据需要大约30秒 此外,我正在使用web3-quorum@0.1.1及法定人数-js@0.3.0.Blockchain 从仲裁区块链检索交易详细信息时出现性能问题,blockchain,quorum,Blockchain,Quorum,我在检索事务详细信息(如事务发起人和事务接收人)时遇到性能问题 来自仲裁区块链 loop和Web3.eth.contract(abi.at)(address2.totalTransactions)的Javascript用于检索事务细节和 然后附加到HTML表 我的性能问题是,从仲裁区块链检索几行事务数据需要大约30秒 此外,我正在使用web3-quorum@0.1.1及法定人数-js@0.3.0. $('#get-tran').click(() => { // Get Tran
$('#get-tran').click(() => {
// Get Tran History
var tranId = 0;
let w2Contract=web3w2.eth.contract(abi).at(address2);
let tottr = w2Contract.totalTransactions();
//Clear the old table content first
$("#t02 tr").remove();
var i=0;
for (i = 0; i <= w2Contract.totalTransactions()-1; i++) {
tranId = i;
let tranHash = w2Contract.transactionIDs(i);
let trDetails1 = w2Contract.transactions(tranHash);
console.log(`Tran details ${trDetails1}`);
console.log(`Tran Detail 1: ${trDetails1[1]}`);
console.log(`Tran Detail 2: ${trDetails1[2]}`);
console.log(`Tran Detail 0: ${trDetails1[0]}`);
var tableRef = document.getElementById('t02').getElementsByTagName('tbody')[0];
// Insert a row at the end of the table
let newRow = tableRef.insertRow(-1);
// Insert a cell in the row at index 0
let newCell = newRow.insertCell(0);
// Append a text node to the cell
let newText = document.createTextNode(`${tranId}`);
newCell.appendChild(newText);
// Insert a cell in the row at index 1
let newCell1 = newRow.insertCell(1);
// Append a text node to the cell
let newText1 = document.createTextNode(`${trDetails1[1]}`);
console.log(`newText1 at index 1 ${newText1}`);
// w2 > w1
if ((trDetails1[1] == '0xf9a2cb34b6b5fd7a2ac0c2e9b2b9406d6daffbd4') &&
(trDetails1[2] == '0x180893a0ec847fa8c92786791348d7d65916acbb')) {
newText1.textContent = 'Stock In'
} else if
(trDetails1[1] == '0x180893a0ec847fa8c92786791348d7d65916acbb') {
newText1.textContent = 'Pier Company'
} else if (trDetails1[1] == '0xf9a2cb34b6b5fd7a2ac0c2e9b2b9406d6daffbd4') {
newText1.textContent = 'Warehouse Company'
}
newCell1.appendChild(newText1);
// Insert a cell in the row at index 2
let newCell2 = newRow.insertCell(2);
// Append a text node to the cell
let newText2 = document.createTextNode(`${trDetails1[2]}`);
console.log(`newText1 at index 2 ${newText1}`);
if (trDetails1[2] == '0xf9a2cb34b6b5fd7a2ac0c2e9b2b9406d6daffbd4') {
newText2.textContent = 'Warehouse Company'
}
if (trDetails1[2] == '0x180893a0ec847fa8c92786791348d7d65916acbb') {
newText2.textContent = 'Pier Company'
}
if (trDetails1[2] == '0xc8f717ba9593dc9d45c4518cf444d2cbd08af24d') {
newText2.textContent = 'Removal'
}
newCell2.appendChild(newText2);
// Insert a cell in the row at index 3
let newCell3 = newRow.insertCell(3);
// Append a text node to the cell
let newText3 = document.createTextNode(`${trDetails1[0]}`);
console.log(`newText3 at index 3 ${newText3}`);
newCell3.appendChild(newText3);
// Insert a cell in the row at index 4
let newCell4 = newRow.insertCell(4);
// Append a text node to the cell
let newText4 = document.createTextNode(`${trDetails1[3]}`);
console.log(`newText1 at index 4 ${newText4}`);
if (trDetails1[3] ) {
newText4.textContent = 'Confirmed'
} else {
newText4.textContent = 'Pending'
}
newCell4.appendChild(newText4);
}
});
$('get-tran')。单击(()=>{
//获取Tran历史记录
var-tranId=0;
设w2Contract=web3w2.eth.合同(abi).at(地址2);
让tottr=w2Contract.totalTransactions();
//首先清除旧表内容
$(“#t02 tr”).remove();
var i=0;
对于(i=0;i w1
如果((trDetails1[1]=“0xF9A2CB34B6B5FD7A2AC0C2E9B2B9406D6DAFFD4”)&&
(trDetails1[2]=“0x180893a0ec847fa8c92786791348d7d65916acbb”)){
newText1.textContent='Stock-In'
}否则如果
(trDetails1[1]=“0x180893a0ec847fa8c92786791348d7d65916acbb”){
newText1.textContent='Pier Company'
}否则如果(trDetails1[1]=“0xF9A2CB34B6B5FD7A2AC0C2E9B2B9406D6DAFFD4”){
newText1.textContent='仓库公司'
}
newCell1.appendChild(newText1);
//在索引2处的行中插入一个单元格
设newCell2=newRow.insertCell(2);
//将文本节点附加到单元格
让newText2=document.createTextNode(`${trDetails1[2]}`);
log(`newText1位于索引2${newText1}`);
如果(trDetails1[2]='0xF9A2CB34B6B5FD7A2AC0C2E9B2B9406D6DAFFD4'){
newText2.textContent='仓库公司'
}
如果(trDetails1[2]='0x180893a0ec847fa8c92786791348d7d65916acbb'){
newText2.textContent='码头公司'
}
如果(trDetails1[2]='0xC8F717BA9593DC9D45C518CF444D2CBD08AF24D'){
newText2.textContent='删除'
}
newCell2.appendChild(newText2);
//在索引3处的行中插入一个单元格
设newCell3=newRow.insertCell(3);
//将文本节点附加到单元格
让newText3=document.createTextNode(`${trDetails1[0]}`);
log(`newText3位于索引3${newText3}`);
newCell3.appendChild(newText3);
//在索引4处的行中插入一个单元格
设newCell4=newRow.insertCell(4);
//将文本节点附加到单元格
让newText4=document.createTextNode(`${trDetails1[3]}`);
log(`newText1位于索引4${newText4}`);
if(trDetails1[3]){
newText4.textContent='已确认'
}否则{
newText4.textContent='Pending'
}
newCell4.appendChild(newText4);
}
});