问题标签 [web3js]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
node.js - web3,松露,nodejs错误:UnhandledPromiseRejectionWarning
我将此代码设置为调用返回 5 的智能合约函数。我使用 truffle 控制台对其进行了测试,它可以正常工作。但是当尝试使用 nodejs 获得相同的结果时,它会崩溃并给出这两个错误:
关于这个问题的任何想法?
ethereum - 如何使用 web3.js 1.0 认证和发送合约方法
我对如何使用 web3 1.0 库执行合同方法感到困惑。
此代码有效(只要我先手动解锁帐户):
我收到此错误(如果我不先手动解锁):
返回错误:需要身份验证:密码或解锁
上面的代码是 node.js 中的一个 API 端点,所以我希望它以编程方式解锁或验证。
web3.js 1.0 中没有解锁账户的方法。
我也不认为这是必要的(至少我对此感到困惑)。因为我在管理账户,所以我知道私钥是什么。
我在想交易需要用私钥签名??这个对吗?这实际上与“解锁帐户”相同吗?
我试过这样做:
我收到此错误:
返回错误:方法net_version不存在/不可用
验证和提交交易的最简单方法是什么?
理想情况下,我想在我的代码示例中使用第一种方法,因为它是最干净的。
javascript - Error when using web3.js with Jest
When I run the following Jest test which uses the web3.js package
I get the following error
web3 appears to be installed correctly as the following correctly outputs Web3 version = 1.0.0-beta.23
I'm new to Jest (used it for the first time today) so I'm not sure if the problem is my Jest installation/setup or web3.js.
I've created a simple project on GitHub to replicate the problem https://github.com/naddison36/web3-jest
My machine is running Mac OS X 10.12.6
, node v6.10.3
and npm 3.10.10
.
The test project is using web3.js version 1.0.0-beta.23
and Jest 21.2.1
ethereum - 下面的以太坊合约函数调用数据是如何构造的?
0x5537f99e000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000072268656c6c6f2200000000000000000000000000000000000000000000000000
5537f99e 是函数名,即'setstring' 2268656c6c6f22 是函数的参数,即'hello',
请解释如何构建以太坊合约的原始数据。我对这些偏移感到困惑。
ethereum - web3.personal.ecRecover 不起作用
我正在尝试让 web3.personal.ecRecover 工作。这是我的设置:
使用 Remix IDE 的 Chrome
MetaMask 注入 web3.js
现在我在 Chrome Dev Console 中尝试以下命令:
这返回:
现在我设置:
并尝试:
并得到:
显然这不是我使用的公共地址(即web3.eth.accounts[0])
有什么建议可以改进此代码吗?谢谢!
小号
ethereum - 如何修复错误:处理事务时出现 VM 异常:在不修改代码的情况下用尽了 Truffle
嗨,我正在尝试为我的 truffle 项目创建图形界面,但由于这个烦人的错误,我无法执行某些功能,我该怎么办,我几乎尝试过 testrpc -l 4500000000 并添加到失败的交易中场地。请帮忙!!!
ethereum - 将合约结果标签存储在变量中
我有一个像这样的 web3 常量。
这会返回这样的结果。
现在,当我想通过console.log(test[0]); 控制单个标签时;这将返回undefined 我的方法是将每个结果标记存储在其单独的变量中。需要一些建议。
ethereum - 如何获取以太坊合约中委托调用的详细信息?
例如,考虑这个交易哈希“ https://etherscan.io/tx/0x9dbf0326a03a2a3719c27be4fa69aacc9857fd231a8d9dcaede4bb083def75ec ”,其中合约在区块链上调用合约“ https://etherscan.io/address/0x4f2875f631f4fc66b8e051defba0c9f ”。如何使用 web3 或任何其他方法获取此信息。