Error when creating account using horizon_testnet "{'transaction': 'tx_bad_auth'}"
See original GitHub issueI am using horizon testnet to perform transaction i have used following code to generate key value pair:
kp = Keypair.random()
publickey = kp.address().decode()
seed = kp.seed().decode()
return json.dumps({'publickey': publickey, 'seed': seed})
I have funded the account i,e public key generated from above code using friendbot of stellar and now I am trying to create new account from already funded account it gives me below error
{
"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": {
"envelope_xdr": "AAAAAPXdExUVI1FPqyMYimxWeqFopHnAWwhDN14ebnviK9ZSAAAAZAAEFaIAAAACAAAAAAAAAAEAAAAPQnV5ZXIgLSBKb24gRG9lAAAAAAEAAAAAAAAAAQAAAABtHx+VBWTM+ifFJRtBh9p2mKukNkZ157vH+NuLb0nD5AAAAAAAAAAABfXhAAAAAAAAAAAB4ivWUgAAAEBOzQQgMolKmYTvaN22I6lwEbOT+HpguaFoHKBH/TpMQ+hFRUqyhsNE4fsBniQ4ClUHP5a2aRh25YFcDaEGu/gD",
"result_xdr": "AAAAAAAAAGT/////AAAAAQAAAAAAAAAB////+wAAAAA=",
"result_codes": {
"transaction": "tx_failed",
"operations": [
"op_no_destination"
]
}
},
"title": "Transaction Failed",
"type": "https://stellar.org/horizon-errors/transaction_failed",
"status": 400
}
I have used below code for creating new account
from stellar_base.keypair import Keypair
from stellar_base.operation import CreateAccount, Payment
from stellar_base.transaction import Transaction
from stellar_base.transaction_envelope import TransactionEnvelope as Te
from stellar_base.memo import TextMemo
from stellar_base.builder import Builder
from stellar_base.horizon import horizon_testnet
#
horizon = horizon_testnet()
# This is the seed (the StrKey representation of the secret seed that
# generates your private key from your original account that is funding the
# new account in the create account operation. You'll need the seed in order
# to sign off on the transaction. This is the source account.
old_account_seed = "SXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
old_account_keypair = Keypair.from_seed(old_account_seed)
# This is the new account ID (the StrKey representation of your newly
# created public key). This is the destination account.
new_account_addr = "GXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
amount = '1' # Your new account minimum balance (in XLM) to transfer over
# create the CreateAccount operation
op = CreateAccount(
destination=new_account_addr,
starting_balance=amount,
)
# create a memo
memo = TextMemo('Hello, StellarCN!')
item = 'Buyer - Jon Doe'
# Get the current sequence of the source account by contacting Horizon. You
# should also check the response for errors!
# Python 3
sequence = horizon.account(old_account_keypair.address().decode()).get('sequence')
# Python 2
# sequence = horizon.account(old_account_keypair.address()).get('sequence')
# Create a transaction with our single create account operation, with the
# default fee of 100 stroops as of this writing (0.00001 XLM)
tx = Transaction(
source=old_account_keypair.address().decode(),
sequence=sequence,
memo=memo,
operations=[
op,
],
)
# Build a transaction envelope, ready to be signed.
envelope = Te(tx=tx, network_id="TESTNET")
# Sign the transaction envelope with the source keypair
envelope.sign(old_account_keypair)
# Submit the transaction to Horizon
te_xdr = envelope.xdr()
response = horizon.submit(te_xdr)
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
tx_bad_auth error not listed in List of Operations page #179
I am getting tx_bad_auth on a new account creation that is being funded by another wallet on the same network. The correct network...
Read more >stellar core - `tx_bad_auth` when submit transaction to TestNet
After I create another account using my account, I can submit a payment transaction with my account. It's strange.
Read more >tx_bad_seq error when funding the account in stellar private ...
I m able to set up stellar-core and horizon in my private network and it is working fine, I m able to get...
Read more >Stellar API Reference - Stellar Documentation
This API serves the bridge between apps and Stellar Core. Projects like wallets, decentralized exchanges, and asset issuers use Horizon to submit transactions, ......
Read more >Account - Go SDK | Stellar Developers
In the Stellar network, users interact using accounts which can be controlled by a corresponding keypair that can authorize transactions. One can create...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
the XDR viewer said you were using the payment operation instead of the create account operation.
This looks good to me. the next step is sign & submit to horizon.
In this same way I can also perform transaction using method