2025年iost 私有链搭建与学习

iost 私有链搭建与学习iost 私有链搭建与学习 problem account not exist iwallet account create qyvlik server localhost 30002 a admin Connecting to server localhost 30002 ERROR account not exist 在指定 admin

大家好,我是讯享网,很高兴认识大家。

iost 私有链搭建与学习

problem

account not exist

iwallet account create qyvlik --server localhost:30002 -a admin 

讯享网
讯享网Connecting to server localhost:30002 ... ERROR: account not exist 

在指定 admin 创建账户时,提示 account not exist,一般是指 admin 不在 iwallet 中,请确保执行了如下命令:

iwallet account import admin 2yquS3ySrGWPEKywCPzX4RTJugqRh7kJSo5aehsLYPEWkUxBWA39oMrZ7ZxuM4fgyXYs2cPwh5n8aNNpH5x2VyK1 

expiration should be in (0, 90]

讯享网iwallet \ --expiration 10000 --gas_limit  --gas_ratio 1 \ --server localhost:30002 \ --account admin \ --amount_limit '*:unlimited' \ publish helloworld.js helloworld.abi 
ERROR: expiration should be in (0, 90] 

iost 官方的部署合约例子中,expiration10000,但是执行后报 expiration should be in (0, 90]expiration 的取值是从 190,指定为 --expiration 90 即可,修复的命令如下:

讯享网iwallet \ --expiration 90 --gas_limit  --gas_ratio 1 \ --server localhost:30002 \ --account admin \ --amount_limit '*:unlimited' \ publish helloworld.js helloworld.abi 

prepare contract: contract iost.gas not found

iost 官方文档给的质押合约是错误的,gas.iost 才是正确的合约

iwallet --server 127.0.0.1:30002 --account admin call 'gas.iost' 'pledge' '["admin","qyvlik","100"]' 

使用 iwallet compile 生成 abi 文件

讯享网iwallet compile example.js 

生成的 abi 文件是 example.js.abi

使用合约转账

使用合约进行资金操作时,需要在 abi 文件中,每个导出的函数都有一个 amountLimit,如果 函数涉及到了资金操作,需要在 amountLimit 字段添加 [{ "token":"iost", "val":"100" }],其中 token 是资金操作的币种,val 是最多可以操作的金额,可以设置成 unlimited,合约以及 abi 参考如下:

class TestTransfer { 
    init() { 
   } can_update(data) { 
    return blockchain.requireAuth(blockchain.contractOwner(), "active"); } send(amount, to) { 
    blockchain.transfer(tx.publisher, to, amount, ""); } }; module.exports = TestTransfer; 
讯享网{ 
    "lang": "javascript", "version": "1.0.0", "abi": [ { 
    "name": "can_update", "args": [ "string" ], "amountLimit": [], "description": "" }, { 
    "name": "send", "args": [ "string", "string" ], "amountLimit": [ { 
    "token": "iost", "val": "100" } ], "description": "" } ] } 

IOSTCrypto.sha3

IOSTCrypto.sha3 内部使用的是 sha256,返回的结果是 base58 编码

转账提示 VerifyError publisher error

转账的 memo 带有中文,提示 VerifyError publisher error,例如:


讯享网

{ 
   "code":2,"message":"VerifyError publisher error"} 

请更新官方 iost-official/java-sdk 到版本 3.0.6,或者使用非官方的 maven 依赖qyvlik/io.iost-java-sdk:

讯享网<dependency> <groupId>io.github.qyvlik</groupId> <artifactId>io.iost-java-sdk</artifactId> <version>broker-v3.0.6</version> </dependency> 

使用谷歌浏览器插件 iwallet 报 TimeError

error: { 
   "code":2,"message":"TimeError"} 

iost 对应的报错代码 tx_pool.go#L258。

解决方式是

  1. 备份好私钥后
  2. 退出谷歌浏览器
  3. 卸载谷歌浏览器的 iwallet 插件
  4. 然后重新安装 iwallet 插件
  5. 再重新导入私钥

invalid contract version

iost 测试链节点报 invalid contract version,具体报错如下:

讯享网Error 2019-04-09 01:56:27.855 abi.go:81 invalid contract version: token.iost 1.0.3, please check `Monitor.prepareContract` Warn 2019-04-09 01:56:27.855 isolator.go:246 isolator run action Action{Contract: system.iost, ActionName: updateNativeCode, Data: ["token.iost","1.0.3",""]} failed, status &{4 running action Action{Contract: system.iost, ActionName: updateNativeCode, Data: ["token.iost","1.0.3",""]} error: invalid contractID or version}, will rollback Error 2019-04-09 01:56:27.856 pob.go:358 verify block failed, blockNum:, blockHash:2oiwCLHGjfW8yTCBNz3WmHV6ZsaQiYkVZAHXZsEtd9iF. err=receipt not match, status not same: &{0 } != &{4 running action Action{Contract: system.iost, ActionName: updateNativeCode, Data: ["token.iost","1.0.3",""]} error: invalid contractID or version} txHash:"s\267\313&\245\007\224\003s\004\253l\022\364W2\".\327\026\254\335-vb\341w\"\332\004\256\204" gasUsage: status:<> returns:"[]" txHash:"s\267\313&\245\007\224\003s\004\253l\022\364W2\".\327\026\254\335-vb\341w\"\332\004\256\204" gasUsage: status:<code:4 message:"running action Action{Contract: system.iost, ActionName: updateNativeCode, Data: [\"token.iost\",\"1.0.3\",\"\"]}\n error: invalid contractID or version" > Warn 2019-04-09 01:56:27.856 pob.go:181 received sync block error, err:receipt not match, status not same: &{0 } != &{4 running action Action{Contract: system.iost, ActionName: updateNativeCode, Data: ["token.iost","1.0.3",""]} error: invalid contractID or version} txHash:"s\267\313&\245\007\224\003s\004\253l\022\364W2\".\327\026\254\335-vb\341w\"\332\004\256\204" gasUsage: status:<> returns:"[]" txHash:"s\267\313&\245\007\224\003s\004\253l\022\364W2\".\327\026\254\335-vb\341w\"\332\004\256\204" gasUsage: status:<code:4 message:"running action Action{Contract: system.iost, ActionName: updateNativeCode, Data: [\"token.iost\",\"1.0.3\",\"\"]}\n error: invalid contractID or version" > Info 2019-04-09 01:56:29.022 sync.go:158 Syncing block in [ ]... Info 2019-04-09 01:56:31.067 sync.go:158 Syncing block in [ ]... 

问题原因是 iost-node 版本比较低。解决方式是,升级 iost-node。

execution kill

iost-node 同步区块日志报 execution kill,可能原因是磁盘不是 SSD 或者 CPU 频率比较低,升级磁盘到 SSD 或者 CPU 规格。

参考

  • iWallet.html
  • install-golang
  • LocalServer.html
小讯
上一篇 2025-03-18 14:08
下一篇 2025-03-12 08:01

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/53861.html