1

I use the following demo to create a new account on testnet:

import requests

from stellar_sdk import Keypair, Server

# Generate random keypair
keypair = Keypair.random()

print("Public Key: " + keypair.public_key)
print("Secret Seed: " + keypair.secret)

# Call the Api to create a test account via Friendbot
response = requests.get(f"https://friendbot.stellar.org?addr={keypair.public_key}")
if response.status_code == 200:
    print(f"SUCCESS! You have a new account :)\n{response.text}")
else:
    print(f"ERROR! Response: \n{response.text}")

According to the official documentation I'd have expected that the account_id equals the public key used to create the account, but it does not.

What do I miss?

1 Answer 1

3

No idea where you got the idea that the secret should be shown as the account_id. The account_id is the public key that is cryptographically derived from the secret.

Also it wouldn't make sense if the secret would be shown publicly somewhere as the secret is like a password that gives you access to the account. So revealing it, would mean that anyone can make payments (and other operations) from the account.

That's also why you always need to keep secrets somehwere save, hence the name "secret".

2
  • Typo in my post, I of course mean the public key.
    – JSRB
    Commented Nov 2, 2021 at 18:08
  • @Jonas but the account_id matches the public key ... or you'd need to provide an example where you're able to show that the public key doesn't match the account_id ... or maybe post a public key and the horizon URL to it's account to show that they don't match ...
    – KanayeNet
    Commented Nov 2, 2021 at 18:32

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.