

部署合约时遇到 invalid sender 错误时怎么办
source link: https://learnblockchain.cn/article/2514
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

部署合约时遇到 invalid sender 错误时怎么办
HDWalletProvider 升级到 1.3.x 之后,只能对以太坊网络进行比较好的支持,并且需要显式指定 chainId。对于非以太坊网络比如当下比较热门的 heco/bsc,在官方解决到相应问题之前,还是保持在 1.2.x 版本比较好。
最近在使用 truffle 往 heco 上部署合约时,突然就碰到了一个之前没碰到过的错误:
多方查证,原来是最新版的 HDWalletProvider (版本 1.3.1) 需要指定 chainId
于是乎将将原来的写法:
provider: () => new HDWalletProvider(mnemonic, `wss://ws-testnet.hecochain.com`)
改为了下面这种形式:
provider: () => new HDWalletProvider({
privateKeys: [mnemonic],
providerOrUrl: `wss://ws-testnet.hecochain.com`,
chainId: 256
}),
但还是报错 "Error: Chain with ID 256 not supported
", 原来这个版本只支持以太坊主网和测试网的 chainId,官方已经在这里记下了这个问题并在着手修复。
直接将HDWalletProvider版本调整到 1.2.6, 问题得以解决。
本文参与登链社区写作激励计划 ,好文好收益,欢迎正在阅读的你也加入。
- 发表于 2021-05-13 04:51
- 阅读 ( 142 )
- 学分 ( 10 )
- 分类:Solidity
Recommend
-
10
创建Emacs版的notify-sender Table of Contents 最近对EmacsScript颇有兴趣,刚好翻看Emacs Lisp Manual的时候看到"Desktop Notifications"这一章,于是突发奇想,尝试实现一个Emacs版的notify-send. 1 notify-s...
-
11
Ehsan Amiryousefi August 11, 2021 4 minute read ...
-
13
Sender domain policy and spoofing overview Overview When emails are sent, the email program or script can say the sender is "from" any address it wants. Email spoofing occurs when...
-
5
What is the sender domain policy? DreamHost’s sender domain policy exists to ensure email that is sent from your website is legitimate. This policy requires two things: You must use a FROM address that’s on the same...
-
6
用require(msg.sender == tx.origin)限制合约调用者 不能为合约 用require(msg.sender == tx.origin)限制合约调用者 不能为合约 ...
-
14
Some thoughts on the std::execution proposal and my understanding of the underlying theory. What’s proposed From the paper’s
-
21
_msgSender()和msg.sender的区别是什么? | 登链社区 | 技术问答 5 _msgSender()和msg...
-
210
-
7
tx.origin、msg.sender有什么不一样 tx.origin、msg.sender有什么不一样...
-
1
当招聘出现失误时,HR该怎么去处理? 2015-08-268209 新员工如果不对劲,通常你能在90天内感觉出来。例如,新员工的项目成果不能按时交付、不具备应有的技能、或看不出他将会对...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK