1

How can I create a new account in testnet with just an HTTP call to the Horizon rest API something like this:

serverip:8000/friendbot?

The docs say to use an SDK, but I want to integrate from an enterprise app context where I can't really run js client lib, SDK or other languages.

It has to be a simple dynamic rest API call returning a new account id and details on successful creation.

0

2 Answers 2

1

You need to generate the private/ public key first. The SDKs provide simple methods to help you with this. Then you can pass the public key's address to the friendbot via curl.

curl "https://horizon-testnet.stellar.org/friendbot?addr=<your-address>"

From a security point of view you can not trust anybody or a service you don't own to generate the key pair for you. But if you can not generate keys in your environment, you may be able to generate them before and pass them into the system. Or have your own service.

3
  • then why stellar itself dont issue the key from server side like ripple or other networks? Lets say, both system owned by me the consuming application and the stellar node and now I have to write any script just to get the key then how is it supposed to integrate seamlessly with the consuming application?
    – kahmed
    Feb 19, 2018 at 18:50
  • You seem to have a very special use case. We are talking about the testnet, so you have to solve that problem for production anyway. The SDKs ship with code example so the whole process should be straight forward. As I mentioned above, you need to trust the key generation process and securely store the keys. That may be done better on the user side rather than a service. But it depends on your case...
    – alpe1
    Feb 19, 2018 at 20:47
  • I dont agree. You trust the server for many other and bigger stakes. That breaks the entire flow of my app architecture. Now, basically I have to have a dynamic js code execution feature built just to make request to stellar which is not needed for most other platforms
    – kahmed
    Feb 20, 2018 at 22:45
0

That's an interesting question and I'd like to know the answer why they don't implement a simple endpoint like

https://horizon.stellar.org/accounts/new

which returns a key pair in the form

{ publicKey: GA2345, secretKey: SA9876 }

Using https should be enough to encrypt the payload, right?

The SDKs are getting bigger by the day and they are heavy to download on slow mobile connections.

Your Answer

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

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