首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >bn.inherits不是snarkjs中的一个函数。

bn.inherits不是snarkjs中的一个函数。
EN

Ethereum用户
提问于 2023-02-18 21:30:26
回答 1查看 26关注 0票数 0

我正在通过这个https://github.com/iden3/snarkjs通过.circom和snarkJS进行zk汇总,当我试图运行index.html代码时,它并没有按照它应该运行的方式工作。并给出了误差bn.inherits is not a function。HTML代码:-

代码语言:javascript
复制
<!doctype html>
<html>
<head>
  <title>Snarkjs client example</title>
</head>
<body>

  <h1>Snarkjs client example</h1>
  <button id="bGenProof"> Create proof </button>

  <!-- JS-generated output will be added here. -->
  <pre class="proof"> Proof: <code id="proof"></code></pre>

  <pre class="proof"> Result: <code id="result"></code></pre>

  <script src="snarkjs.min.js"></script>


  <!-- This is the bundle generated by rollup.js -->
  <script>

const proofComponent = document.getElementById('proof');
const resultComponent = document.getElementById('result');
const bGenProof = document.getElementById("bGenProof");

bGenProof.addEventListener("click", calculateProof);

async function calculateProof() {

    const { proof, publicSignals } =
      await snarkjs.groth16.fullProve({"a":"123","b":"234"}, "product.wasm", "product_0000.zkey");

    proofComponent.innerHTML = JSON.stringify(proof, null, 1);


    const vkey = await fetch("verification_key.json").then( function(res) {
        return res.json();
    });

    const res = await snarkjs.groth16.verify(vkey, publicSignals, proof);

    resultComponent.innerHTML = res;
}

  </script>

</body>
</html>
EN

回答 1

Ethereum用户

发布于 2023-03-07 16:52:20

我刚刚从github/ got 3中获得了使用最新snarkjs.min.js的错误

我有一个早在2023年的文件,它的工作没有错误的发现。我建议从git历史上下载一个文件。

票数 1
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/145187

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档