Create and fund new account on Stellar using StellarBurrito

What is StellarBurrito?

StellarBurrito is a package available on npm.

This package’s aim is to simplify the use of stellar-sdk thanks simplified calls to the core library.

This project is open source and opens to PR so if you want to help take a look at github project!

This tutorial works on test-net, for the moment this library isn’t suitable for production use.


Let’s start

First of all, we need to create the project

chinaski@XPS:~/Desktop$ mkdir Medium-CreateNewAccount
chinaski@XPS:~/Desktop$ cd Medium-CreateNewAccount/
chinaski@XPS:~/Desktop/Medium-CreateNewAccount$ touch index.js
chinaski@XPS:~/Desktop/Medium-CreateNewAccount$ npm init

Then install stellarburrito package from npm

chinaski@XPS:~/Desktop/Medium-CreateNewAccount$ npm i stellarburrito --save

Now our project should be initialized properly, let’s create an account!

Create a new keypair and funds it using stellar laboratory if you don’t have it yet

Now open index.js and import stellarburrito

Then just call the createAccount passing the privateKey of generated account as a parameter and handle resolve and reject.

Here is how it should look like

Then run it using node

chinaski@XPS:~/Desktop/Medium-CreateNewAccount$ node index.js
Public Key of generated Account
GB67NZK5XNS6DFH7N4KHLKO3IOBV7VFA3CF5STTZXSC5ODNLOLY6VC44
Private Key of generated Account
SBGSBUQGSXN3JAIXQNYDM4ART5MSUW3LSXFDGPOWDBSHA7RUCUTDYDUP

That’s it!

Thanks for the attention!

If you want to collaborate for writing this library just contact me on Keybase @andreaborio !