$0.08464 5.92%
XLM · 1w

[Beginner Tutorial] - Manage flags using StellarBurrito

Let’s start

First of all, we need to create the project

[email protected]:~/Desktop$ mkdir [email protected]:~/Desktop$ cd Medium-ManageFlags/[email protected]:~/Desktop/Medium-ManageFlags$ touch [email protected]:~/Desktop/Medium-ManageFlags$ npm init

Then install stellar burrito package from npm

[email protected]:~/Desktop/Medium-ManageFlags$ npm i stellarburrito --save

Now our project should be initialized properly!

Why we need flags?

Flags are used to set particular authorization level on an account.

According to Stellar’s official doc currently, there are three flags, used by issuers of assets.

Authorization required (0x1): Requires the issuing account to give other accounts permission before they can hold the issuing account’s credit. Authorization revocable (0x2): Allows the issuing account to revoke its credit held by other accounts. Authorization immutable (0x4): If this is set then none of the authorization flags can be set and the account can never be deleted.

Pretty cool right?

Actually, it’s also pretty simple!


In this tutorial, we will use accountOptions and accountStatus of stellarburrito. accountOptions.SetFlag allows you to set all of the 3 types of flag on an account given as input.  Just pass account’s secretKey and the flag that you want to set (1 for Authorization required 2 for Authorization revocable 4 for Authorization Immutable). accountStatus.getFlags return a json containing info about flags of the given account. Here an example :

{ auth_required: true, auth_revocable: false, auth_immutable: false } Let’s start coding!

first of all, include stellar burrito in your project

Set authorization_required flag

This flag can be set passing 1 as a parameter to the setFlag function, as shown in the picture.

flags should contain

{ auth_required: true, auth_revocable: false, auth_immutable: false } It works!

Now let’s c...

Continue on
Recent news
XLM +5.92% · · 13h

Jesse Lund will be doing a talk at SXSW - Mar 15th

SXSW 2019 Schedule | Today, it takes one click to buy a concert ticket or a new pair of shoes, but if you want to buy stocks, get a mortgage, or pay someone in another country, the transactions are mo...