繁体   English   中英

在恒星专用网络中为帐户注资时出现tx_bad_seq错误

[英]tx_bad_seq error when funding the account in stellar private network

我正在尝试使用自己的网络密码创建一个Stellar Standalone网络。 我可以在我的专用网络中设置恒星核心和地平线,并且可以正常工作,并且可以通过我的nodejs代码获得root帐户余额。 但是,当我尝试创建帐户并为帐户注资时,会收到tx_bad_seq。 这是我的代码

let kp = Stellar.Keypair.random();
let destinationId = kp.publicKey();
let sourceId = "GAZDSYG5HWIKHR76LUP5SGQBPYXYCFUIR45Z2WMOGITGY7JILDC6JAAF";
let sourceKeys = Stellar.Keypair.fromSecret("SDJ5AQWLIAYT22TCYSKOQALI3SNUMPAR63SEL73ASALDP6PYDN54FARM");

try{
    var sourceAccount = await server.loadAccount(sourceId);
    var transaction = new Stellar.TransactionBuilder(sourceAccount)
                        .addOperation( 
                            Stellar.Operation.createAccount({
                                destination: destinationId,
                                startingBalance: "100",
                                asset: Stellar.Asset.native()
                            }))
                            .setTimeout(30)
                            .addMemo(Stellar.Memo.text('Creating account'))
                            .build();
    transaction.sign(sourceKeys);
    var result = await server.submitTransaction(transaction);

    console.log(result);
    res.send(result);

}catch(error){
    console.log(error);
    res.send({'Msg': 'error'});
    return;
}
res.send({'Msg': 'Success'});

这是我得到的错误

Error: Request failed with status code 400
app.js:221
config:Object {adapter: , transformRequest: Object, transformResponse: Object, …}
message:"Request failed with status code 400"
request:ClientRequest {domain: null, _events: Object, _eventsCount: 6, …}
response:Object {status: 400, statusText: "Bad Request", headers: Object, …}
config:Object {adapter: , transformRequest: Object, transformResponse: Object, …}
data:Object {type: "https://stellar.org/horizon-errors/transaction_fai…", title: "Transaction Failed", status: 400, …}
detail:"The transaction failed when submitted to the stellar network. The `extras.result_codes` field on this response contains further details.  Descriptions of each code can be found at: https://www.stellar.org/developers/learn/concepts/list-of-operations.html"
extras:Object {envelope_xdr: "AAAAADI5YN09kKPH/l0f2RoBfi+BFoiPO51ZjjImbH0oWMXkAA…", result_codes: Object, result_xdr: "AAAAAAAAAGT////7AAAAAA=="}
envelope_xdr:"AAAAADI5YN09kKPH/l0f2RoBfi+BFoiPO51ZjjImbH0oWMXkAAAAZAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAFx/mhAAAAABAAAAEENyZWF0aW5nIGFjY291bnQAAAABAAAAAAAAAAAAAAAAXsWc73Eg9YwKLtLg5HwSSx8mVxMgQzcBZwByeMRBIicAAAAAO5rKAAAAAAAAAAABKFjF5AAAAEBQMa0S5PH5zt9AMXqkX3b7cNuRo8KgybYc+1hUNaJNuU7T6G0FZyNq0/AalONixMRMyyUuMBQCF9SZSEVRDxkM"
result_codes:Object {transaction: "tx_bad_seq"}
transaction:"tx_bad_seq"
__proto__:Object {constructor: , __defineGetter__: , __defineSetter__: , …}
result_xdr:"AAAAAAAAAGT////7AAAAAA=="
__proto__:Object {constructor: , __defineGetter__: , __defineSetter__: , …}
instance:"linux/0t8XxOn9u2-000004"
status:400
title:"Transaction Failed"
type:"https://stellar.org/horizon-errors/transaction_failed"
__proto__:Object {constructor: , __defineGetter__: , __defineSetter__: , …}
headers:Object {content-type: "application/problem+json; charset=utf-8", x-ratelimit-limit: "3600", x-ratelimit-remaining: "3596", …}
request:ClientRequest {domain: null, _events: Object, _eventsCount: 6, …}
status:400
statusText:"Bad Request"
__proto__:Object {constructor: , __defineGetter__: , __defineSetter__: , …}
stack:"Error: Request failed with status code 400\n    at createError (/home/vijin/workspace/stellar/node_modules/axios/lib/core/createError.js:16:15)\n    at settle (/home/vijin/workspace/stellar/node_modules/axios/lib/core/settle.js:18:12)\n    at IncomingMessage.handleStreamEnd (/home/vijin/workspace/stellar/node_modules/axios/lib/adapters/http.js:201:11)\n    at emitNone (events.js:111:20)\n    at IncomingMessage.emit (events.js:208:7)\n    at endReadableNT (_stream_readable.js:1064:12)\n    at _combinedTickCallback (internal/process/next_tick.js:139:11)\n    at process._tickCallback (internal/process/next_tick.js:181:9)"
__proto__:Object {constructor: , name: "Error", message: "", …}

请让我知道为什么我要面对这个问题。 我按照此链接设置了恒星核心和地平线服务器

https://labs.imaginea.com/post/stellar-bc-wallet/

这是来自http:// $ HORIZON的回复

{
  "_links": {
    "account": {
      "href": "http://localhost:8000/accounts/{account_id}",
      "templated": true
    },
    "account_transactions": {
      "href": "http://localhost:8000/accounts/{account_id}/transactions{?cursor,limit,order}",
      "templated": true
    },
    "friendbot": {
      "href": "http://localhost:8000/friendbot{?addr}",
      "templated": true
    },
    "metrics": {
      "href": "http://localhost:8000/metrics"
    },
    "order_book": {
      "href": "http://localhost:8000/order_book{?selling_asset_type,selling_asset_code,selling_issuer,buying_asset_type,buying_asset_code,buying_issuer}",
      "templated": true
    },
    "self": {
      "href": "http://localhost:8000/"
    },
    "transaction": {
      "href": "http://localhost:8000/transactions/{hash}",
      "templated": true
    },
    "transactions": {
      "href": "http://localhost:8000/transactions{?cursor,limit,order}",
      "templated": true
    }
  },
  "horizon_version": "v0.11.1-dirty",
  "core_version": "v10.2.0",
  "history_latest_ledger": 3138,
  "history_elder_ledger": 1,
  "core_latest_ledger": 1,
  "core_elder_ledger": 0,
  "network_passphrase": "Standalone Pramati Network ; Oct 2018",
  "protocol_version": 10
}

您正在运行软件的旧版本。 (它报告v0.11.1-dirty ,所以它既旧又不是发行版)。

最好的入门方法是使用quickstart docker image

使用最新软件重试,看看是否有相同的问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM