如何在仲裁[角度]中将数据从一个节点发送到另一个节点?

时间:2019-05-07 12:05:34

标签: javascript solidity truffle web3js quorum

我有问题。

我牢固地拥有这份合同:

pragma solidity >=0.4.21 <0.6.0;



contract SimpleStorage {
  string public storedData;
  uint public i;

   constructor(string memory initVal) public {
    storedData = initVal;
    i = 0;
  }

  function setDati(string memory x) public returns (uint) {
    storedData = x;
    i++;
    return i;
  }

  function getAll() public view returns (string memory) {
    return storedData;
  }
}

getAll函数使用以下代码工作:

import SimpleStorageContract from "./build/contracts/SimpleStorage.json";
import getWeb3 from "./utils/getWeb3"; 

/*inizialize web3 using   
const provider = new Web3.providers.HttpProvider(
          "http://localhost:22003" //quorum node 4
*/

  const contract = new web3.eth.Contract(
        SimpleStorageContract.abi,
        deployedNetwork && deployedNetwork.address,
      );

const response = await contract.methods.getAll().call();

但是当我使用setDati函数不能使用此错误时:

// ERROR: {error: Error: Number can only safely store up to 53 bits}

await contract.methods.setDati("ANSIA").send({from: accounts[0]});

/* where accounts[0] is:
 const accounts = await web3.eth.getAccounts();
*/

我们尝试进行各种测试: 1.没有错误,没有结果:

//without .send() like this: 
await contract.methods.setDati("ANSIA");

  1. 没有错误,没有结果:
await contract.methods.setDati("ANSIA", {privateFor:["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="]});

问题是: 如何在Angular dapp中使用setDati函数?

0 个答案:

没有答案