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
Private Key of generated Account

That’s it!

Thanks for the attention!

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