大妞和小妞 1 Posted August 30, 2018 学习不认真,兑换FO 一路碰到各种坑! 一:创建用户时: { "code": 4000007, "message": "pubkey is error,please head with FO" } 原因: 生成的fibos 公钥是老版的! 更新 fibos.js 生成 FO*** 开头的公钥就对了! 二:兑换 FO 时 异常: assert(publicKey != null, 'Invalid public key'); 原因: EOS 私钥给错了 注意公钥填写正确,并且是 你的EOS active私钥 其他同学碰到不同的问题,欢迎后面跟帖! Share this post Link to post Share on other sites
大妞和小妞 1 Posted August 30, 2018 三:兑换 FO 时 异常 "details":[{"message":"assertion failure with message: no balance object found" 原因: 转出账户没有 余额 Share this post Link to post Share on other sites
Daniel Larimer 0 Posted August 30, 2018 throw new TypeError('Unknown struct \'' + object.name + '\' for contract \'' + object.account + '\', locate this struct or provide serialized action.data'); ^ TypeError: Unknown struct 'exchange' for contract 'eosio.token', locate this struct or provide serialized action.data action.data = {"owner":"zzzzzzzzzzzz","quantity":"1.0000 [email protected]","tosym":"0.0000 [email protected]","memo":"exchange EOS to FO"} transaction.actions = [{"account":"eosio.token","name":"exchange","authorization":[{"actor":"zzzzzzzzzzzz","permission":"active"}],"data":{"owner":"zzzzzzzzzzzz","quantity":"1.0000 [email protected]","tosym":"0.0000 [email protected]","memo":"exchange EOS to FO"}}] at actionDataAppendByteBuffer (/home/fibosLearn/fibos_client/node_modules/eosjs/lib/structs.js:736:17) at Object.appendByteBuffer (/home/fibosLearn/fibos_client/node_modules/fcbuffer/lib/struct.js:108:15) at Object.appendByteBuffer (/home/fibosLearn/fibos_client/node_modules/fcbuffer/lib/types.js:353:16) at Object.appendByteBuffer (/home/fibosLearn/fibos_client/node_modules/fcbuffer/lib/struct.js:110:20) at toByteBuffer (/home/fibosLearn/fibos_client/node_modules/fcbuffer/lib/fcbuffer.js:284:8) at Function.toBuffer (/home/fibosLearn/fibos_client/node_modules/fcbuffer/lib/fcbuffer.js:271:22) at _callee2$ (/home/fibosLearn/fibos_client/node_modules/eosjs/lib/write-api.js:658:30) at tryCatch (/home/fibosLearn/fibos_client/node_modules/regenerator-runtime/runtime.js:62:40) at Generator.invoke [as _invoke] (/home/fibosLearn/fibos_client/node_modules/regenerator-runtime/runtime.js:296:22) at Generator.prototype.(anonymous function) [as next] (/home/fibosLearn/fibos_client/node_modules/regenerator-runtime/runtime.js:114:21) 这个是什么错误 Share this post Link to post Share on other sites
大妞和小妞 1 Posted August 30, 2018 2 分钟前 , Daniel Larimer 说: throw new TypeError('Unknown struct \'' + object.name + '\' for contract \'' + object.account + '\', locate this struct or provide serialized action.data'); ^ TypeError: Unknown struct 'exchange' for contract 'eosio.token', locate this struct or provide serialized action.data action.data = {"owner":"zzzzzzzzzzzz","quantity":"1.0000 [email protected]","tosym":"0.0000 [email protected]","memo":"exchange EOS to FO"} transaction.actions = [{"account":"eosio.token","name":"exchange","authorization":[{"actor":"zzzzzzzzzzzz","permission":"active"}],"data":{"owner":"zzzzzzzzzzzz","quantity":"1.0000 [email protected]","tosym":"0.0000 [email protected]","memo":"exchange EOS to FO"}}] at actionDataAppendByteBuffer (/home/fibosLearn/fibos_client/node_modules/eosjs/lib/structs.js:736:17) at Object.appendByteBuffer (/home/fibosLearn/fibos_client/node_modules/fcbuffer/lib/struct.js:108:15) at Object.appendByteBuffer (/home/fibosLearn/fibos_client/node_modules/fcbuffer/lib/types.js:353:16) at Object.appendByteBuffer (/home/fibosLearn/fibos_client/node_modules/fcbuffer/lib/struct.js:110:20) at toByteBuffer (/home/fibosLearn/fibos_client/node_modules/fcbuffer/lib/fcbuffer.js:284:8) at Function.toBuffer (/home/fibosLearn/fibos_client/node_modules/fcbuffer/lib/fcbuffer.js:271:22) at _callee2$ (/home/fibosLearn/fibos_client/node_modules/eosjs/lib/write-api.js:658:30) at tryCatch (/home/fibosLearn/fibos_client/node_modules/regenerator-runtime/runtime.js:62:40) at Generator.invoke [as _invoke] (/home/fibosLearn/fibos_client/node_modules/regenerator-runtime/runtime.js:296:22) at Generator.prototype.(anonymous function) [as next] (/home/fibosLearn/fibos_client/node_modules/regenerator-runtime/runtime.js:114:21) 这个是什么错误 这是操作哪一步 ? Share this post Link to post Share on other sites
Daniel Larimer 0 Posted August 30, 2018 刚才 , 大妞和小妞 说: 这是操作哪一步 ? 兑换FO 按这个代码来的 var FIBOS = require("fibos.js"); var config = { chainId: "6aa7bd33b6b45192465afa3553dedb531acaaff8928cf64b70bd4c5e49b7ec6a", priKey: "你的 FIBOS 私钥", httpEndpoint: "http://ca-rpc.fibos.io:8870", verbose: false, } var fibos_client = FIBOS({ chainId: config.chainId, keyProvider: config.priKey, httpEndpoint: config.httpEndpoint, verbose: false, logger: { log: null, error: null } }) let ctx = fibos_client.contractSync("eosio.token"); var result = ctx.exchangeSync("你的 FIBOS 账户名", `10.0000 [email protected]`, `0.0000 [email protected]`, `exchange EOS to FO`, { authorization: "你的FIBOS账户名" }); console.log(result); Share this post Link to post Share on other sites
大妞和小妞 1 Posted August 30, 2018 四:兑换 FO 时 异常 "details":[{"message":"billed CPU time (1673 us) is greater than the maximum billable CPU time for the transaction (617 us)" 原因:转出账户 资源不足,不能支持转账操作! Share this post Link to post Share on other sites
大妞和小妞 1 Posted August 30, 2018 var FIBOS = require('fibos.js'); var http = require('http'); const foAccount = 'fiboscouncil'; //公开的兑换fo帐号 const fibosMainNetChainId = '6aa7bd33b6b45192465afa3553dedb531acaaff8928cf64b70bd4c5e49b7ec6a'; //FIBOS MainNet 主网chainId const fibosHttpEndpoint = 'http://se-rpc.fibos.io:8870'; //FIBOS MainNet 主网RPC地址 //const fibosHttpEndpoint = 'http://sl-rpc.fibos.io:8870'; //FIBOS MainNet 主网RPC地址 //const fibosHttpEndpoint = 'http://to-rpc.fibos.io:8870'; //FIBOS MainNet 主网RPC地址 //const fibosHttpEndpoint = 'http://ca-rpc.fibos.io:8870'; //FIBOS MainNet 主网RPC地址 //const fibosHttpEndpoint = 'http://ln-rpc.fibos.io:8870'; //FIBOS MainNet 主网RPC地址 //const fibosHttpEndpoint = 'http://va-rpc.fibos.io:8870'; //FIBOS MainNet 主网RPC地址 const eosMainNetChainId = 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906'; //EOS MainNet 主网chainId const eosHttpEndpoint = 'http://api-mainnet1.starteos.io'; //EOS MainNet 主网RPC地址 const fibosAccount = ""; //你的 FIBOS 账户名 const fibosPubKey = ""; //你的 FIBOS 公钥 const fibosPriKey = ""; //你的 FIBOS 私钥 const eosAccount = ""; //你的EOS账户名 const eosPriKey = ""; //你的EOS active私钥 const eosNum = '0.0100'; //购买数量 //创建帐号 // var httpClient = new http.Client(); // var rep = httpClient // .post('http://tunnel.fibos.io/1.0/app/token/create', { // json: { // account: fibosAccount, // pubkey: fibosPubKey, // }, // }) // .json(); // console.log(rep); //发起转账操作 var eos_client = FIBOS({ chainId: eosMainNetChainId, keyProvider: eosPriKey, httpEndpoint: eosHttpEndpoint, verbose: true, logger: { log: null, error: null, }, }); let ctx = eos_client.contractSync('eosio.token'); let result = ctx.transferSync(eosAccount, foAccount, eosNum+' EOS', fibosAccount); console.log(result); var fibos_client = FIBOS({ chainId: fibosMainNetChainId, keyProvider: fibosPriKey, httpEndpoint: fibosHttpEndpoint, verbose: true, logger: { log: null, error: null, }, }); //兑换通证 // let ctx = fibos_client.contractSync('eosio.token'); // result = ctx.exchangeSync(fibosAccount, eosNum+' [email protected]', '0.0000 [email protected]', 'exchange EOS to FO', // { // authorization: fibosAccount, // }, // ); // console.log(result); //查询 FIBOS 余额 var rs = fibos_client.getTableRowsSync( true, 'eosio.token', fibosAccount, 'accounts', ); console.log(rs); Share this post Link to post Share on other sites
大妞和小妞 1 Posted August 30, 2018 5 分钟前 , Daniel Larimer 说: 兑换FO 按这个代码来的 var FIBOS = require("fibos.js"); var config = { chainId: "6aa7bd33b6b45192465afa3553dedb531acaaff8928cf64b70bd4c5e49b7ec6a", priKey: "你的 FIBOS 私钥", httpEndpoint: "http://ca-rpc.fibos.io:8870", verbose: false, } var fibos_client = FIBOS({ chainId: config.chainId, keyProvider: config.priKey, httpEndpoint: config.httpEndpoint, verbose: false, logger: { log: null, error: null } }) let ctx = fibos_client.contractSync("eosio.token"); var result = ctx.exchangeSync("你的 FIBOS 账户名", `10.0000 [email protected]`, `0.0000 F[email protected]`, `exchange EOS to FO`, { authorization: "你的FIBOS账户名" }); console.log(result); 用我刚发的脚本 ,填上就可以用 Share this post Link to post Share on other sites
Daniel Larimer 0 Posted August 30, 2018 9 分钟前 , 大妞和小妞 说: 用我刚发的脚本 ,填上就可以用 也是报一样的错误。。是不是我的fibos有问题 Share this post Link to post Share on other sites
大妞和小妞 1 Posted August 31, 2018 16 小时前 , Daniel Larimer 说: 也是报一样的错误。。是不是我的fibos有问题 重新安装一下吧 fibos.js 要最新的 0.1.0 版 Share this post Link to post Share on other sites
Anleb 2 Posted September 4, 2018 FIBOS 文档已经上线更新,很详细的介绍了 EOS 到 FIBOS的操作过程,请前往 FIBOS 网站查看:https://fibos.io 1 Share this post Link to post Share on other sites