$0.06873 2.81%
XLM · 27w

[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 +2.81% · · 9h

Stellar Dev Digest: Issue #11 - August 23, 2019

Hey y’all! It’s about that time of the week again. Welcome to another issue of the Stellar Dev Digest, a weekly recap of all things related to the development of the Stellar Network. What is…