Create new asset 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.
First of all, we need to create the project
chinaski@XPS:~/Desktop$ mkdir Medium-CreateNewAsset
chinaski@XPS:~/Desktop$ cd Medium-CreateNewAsset/
chinaski@XPS:~/Desktop/Medium-CreateNewAsset$ touch index.js
chinaski@XPS:~/Desktop/Medium-CreateNewAsset$ npm init
Then install stellarburrito package from npm
chinaski@XPS:~/Desktop/Medium-CreateNewAsset$ 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 already have a testnet account just skip this step
One account is enough, it will be your “master” account for creating both issuer and distributor account.
First of all, require stellarburrito package
Now we need to create 2 new accounts, an Issuer for our asset and a Distributor which actually will own tokens.
Just iterate createAccount function of StellarBurrito.
Perfect! We have 2 accounts and now we have all we need!
Now call createAsset function and pass required parameters as shown in the next screen
And that’s it, our code should look like this
Let’s see if it works properly running node index.js in terminal
chinaski@XPS:~/Desktop/Medium-CreateNewAsset$ node index
It seems legit, for being sure is always better check on an explorer what happens on stellar
And that’s it!
Thanks for reading, you can find more doc about stellar burrito HERE
And HERE you can find the repo of this project