- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我目前正在 Solidity 中开发一个 dApp,并且正在开发一个 web3 库来处理与它的通信。
我在 web3 中创建新帐户和交易签名的过程中挣扎。在继续之前,值得注意的是,我正在运行自己的本地私有(private)区块链(目前使用 Ganache)。
我的代码如下所示:
try{
let a = web3.eth.accounts.create()
let dataTx = someContract.methods.someMethod().encodeABI()
let rawTx = {
to: someContract._address,
from: account.address,
data: dataTx,
gas: 10000000000
}
const transaction = web3.eth.accounts.signTransaction(rawTx, util.toBuffer(account.privateKey))
web3.eth.sendTransaction(rawTx).then(console.log)
}
catch(e){
console.log(e)
}
web3.eth.sendTransaction()
方法引发以下异常:
Error: Returned error: sender account not recognized
.
web3.eth.accounts
用于管理本地帐户和
web3.eth.personal
用于与客户端(例如 Geth)通信。我希望保留我的应用程序在 web3 客户端的设备上本地创建的帐户的私钥,但它引发了此异常。
最佳答案
如果您想使用 Ganache 提供给您以外的帐户,您必须开始 Ganache 以 private_key,initial_balance
的形式提供您的帐户数据:
示例命令: ganache-cli --account 0xf38b5679751228eab7d9f3aa02bd0b0c0f7b44e448c0cfd410a1d7053efb6c56,123456789
它的输出:
Ganache CLI v6.1.8 (ganache-core: 2.2.1)
Available Accounts ================== (0) 0x44fa41e453654ccb365a358e994c764a37eea91f (~0 ETH)
Private Keys ================== (0) 0xf38b5679751228eab7d9f3aa02bd0b0c0f7b44e448c0cfd410a1d7053efb6c56
Gas Price ================== 20000000000
Gas Limit ================== 6721975
Listening on 127.0.0.1:8545
关于ethereum - 私有(private)以太坊网络无法识别发件人帐户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52813381/
当我点击 remix.ethereum.org 下的创建时,我不明白智能合约的实际去向。例如,如果我选择 Injected Web3,这应该会将合约发布到 ropsten 测试网上,对吧?但是我怎样才
我通过下面的推荐安装了ganache-cli npm install -g ganache-cli 我已经下载了文件 ganache-1.1.0-beta.0-x86_64.AppImage 当我点
如果我在 ETH 和 RSK 网络中导入相同的私钥,则帐户相同但大小写不同。为什么是这样?这个可以吗? 最佳答案 大写作为校验和,涉及以下标准 SLIP-0044 EIP-155 EIP-1191 有
我们落后于代理。代理已设置。 早些时候,我们运行以下命令并成功安装了以太坊。 sudo apt-get install software-properties-common sudo add-apt-
请找到我的 golang 规范 GOOS=linux GOARCH=amd64 go build github.com/ethereum/go-ethereum/crypto/secp256k1: b
我正在尝试使用 Puppeth(如 Péter Szilágyi demoed in Ethereum devcon three 2017)设置私有(private)以太坊测试网络。我在 macboo
我是一步一步做的: Git 克隆 go-ethereum 项目到我的本地 PC。它位于D:\GOPATH\src\github.com\ethereum\go-ethereum。这是源代码去以太坊 注
我正在尝试生成 personal_sign在 Golang 中就像在 ethers.js 中实现的那样。 Similar question但最终使用了常规 sign过个人sign_implementa
我正在尝试安装 Istanbul-tools 以运行 IBFT 以太坊网络,如本教程所示 https://medium.com/getamis/istanbul-bft-ibft-c2758b7fe6
我想降低我的 ERC-721A 合约的部署成本。 一般来说; 扁平化智能合约是否有助于降低其成本? 目前我正在使用 ethers.js's contractFactory.deploy method带
我有契约(Contract)要求输入 bytes32,所以我需要将地址转换为 bytes32,但在 web3 中没有看到这个方法。 最佳答案 以太坊地址为 20 个字节,因此您将十六进制地址转换为字节
我想与将在调用时部署其他契约(Contract)的功能签订契约(Contract)。可能吗?有什么想法吗? 最佳答案 这是部署合约的合约示例。 https://ethereum.stackexchan
由于与以太坊创建智能合约涉及以太币用户,因此重新填充所有用户的以太币对公司而言成本高昂。因此,假设一家公司决定通过以太坊网络发行一种代币,而该代币代表一种新货币。每次用户向其他人发送代币时,代币的原始
我想知道提交智能合约调用的确切效果。例如,如果我在 uniswap 上将 USDC 兑换成 ETH。 对于交易,我们有 eth_call,对于合约有类似的东西吗?这需要适用于任意复杂的交互,基本上是我
如果我有这样的功能: function sendToAuthor (uint tokenId) public payable{ //here I want to get some ether fr
我正在试验以太坊。我已经按照网站上的说明成功设置了一个私有(private)测试网。但是,我无法添加来自不同机器的对等点。在我创建的任何节点上,admin.nodeInfo.NodeUrl 参数都是未
我在 Remix 上做了一笔交易,花费了 199093 gas。在撰写本文时,天然气价格为 7.2 Gwei(0.031 美元)from here ethgas station 如果我想计算我应该为这
根据 web3.eth.sendTransaction 的文档和 eth_sendTransaction 的文档: 交易对象可以包含一个可选的data参数,它应该是一个String,包含: 要么是包含
是否有任何方法可以在 Solidity 中实现一个集合,以检查元素是否存在,平均 O(1)?我一直在考虑使用没有值的映射对象,这是否比使用数组并迭代以查找元素更快? 最佳答案 是的,就速度而言,您最好
在OpenZeppelin ERC20实现中,有一个_transfer方法: function _transfer( address sender, address recipient
我是一名优秀的程序员,十分优秀!