I constructed the Stellar private network on my Mac following https://www.stellar.org/developers/stellar-core/software/admin.html#starting-a-new-network with postgres and horizon server. I know what the root account and its secret seed of my Stellar node is.

I tried creating a new account with Stellar go SDK. From the information of https://www.stellar.org/developers/go/reference/examples.html and https://github.com/stellar/go/blob/master/services/friendbot/internal/friendbot.go (Pay method), I made a simple client for account creation.

package main

import (
    b "github.com/stellar/go/build"

func main() {
    pair, err := keypair.Random()
    if err != nil {


    to := pair.Address()

    from := "SDHOAMBNLGCE2MV5ZKIVZAQD3VCLGP53P3OBSBI6UN5L5XZI5TKHFQL4" // root seed at --newdb time

    var PrivateNetClient = &horizon.Client{
        URL:  "http://localhost:8000",
        HTTP: http.DefaultClient,

    tx, err := b.Transaction(
        b.SourceAccount{AddressOrSeed: from},
        b.AutoSequence{SequenceProvider: PrivateNetClient},
        //b.Sequence{Sequence: 1},
            b.Destination{AddressOrSeed: to},
            b.NativeAmount{Amount: "1000.00"},
    if err != nil {

    txe, err := tx.Sign(from)
    if err != nil {

    txeB64, err := txe.Base64()
    if err != nil {
    fmt.Printf("tx base64: %s", txeB64)

    resp, err := PrivateNetClient.SubmitTransaction(txeB64)
    if err != nil {
        switch e := err.(type) {
        case *horizon.Error:
            fmt.Println("err type=" + e.Problem.Type)
            fmt.Println("err detailed=" + e.Problem.Detail)
            fmt.Println("err extras=" + string(e.Problem.Extras["result_codes"]))

    fmt.Println("transaction posted in ledger:", resp.Ledger)

Making the base64 string of CreateAccount operation XDR is so far so good, but the result of SubmitTransaction is always 400(Bad Request Error) with 'tx_bad_seq'.

stellar-core and horizon are running with debug log level but there's no noticeable log.

How can I resolve this? (The message below is my client log.)

tx base64: AAAAAGL8HQvQkbK2HA3WVjRrKmjX00fG8sLI7m0ERwJW/AX3AAAAZAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAA5j+HbRj/gg3vfpljTvpXR3NMZBUxIdizqFDGD+7sg0IAAAACVAvkAAAAAAAAAAABVvwF9wAAAEA8s/KhXtXz77Q5wu+lj/z/OgLE25CahIJWUB12+9LR6g5BiG/CBB9e143VTUoivu6yF8i8MXRuCyIF2TzCsxYLerr type=https://stellar.org/horizon-errors/transaction_failed
err detailed=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
err extras={
      "transaction": "tx_bad_seq"
panic: Horizon error: "Transaction Failed". Check horizon.Error.Problem for more information.

goroutine 1 [running]:
    /Users/eugene/project/ylabs/stellar_client/new_account_with_sdk.go:63 +0xb5e

2 Answers 2


The only thing that comes to my mind is that your node actually synced with the publicly available test network and applied the history. That's why the master account's (GBRPYHIL2CI3FNQ4BXLFMNDLFJUNPU2HY3ZMFSHONUCEOASW7QC7OX2H) sequence number is higher than 1 and you're getting tx_bad_seq.

If you want to create a fully isolated network change network_passphrase in stellar core configuration and create a new Network object in Go SDK with such passphrase.

  • It’s the sole node in the private network. Actually it wasn’t the sequence problem, but I think horizon has a problem that it processes other types of error as tx_bad_seq. Feb 13, 2018 at 0:02

I forgot to call ‘stellar-core --forcescp’ before running my core node. After the first CreateAccount request is timed out because the node doesn’t process anything, the next requests are failed with ‘tx_bad_seq’ error. So I misunderstood that it was the sequence problem.

I added the issue below. https://github.com/stellar/stellar-core/issues/1540


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.