Writing the utility

Let's write a Nodejs utility in order to create new assets and extend trustlines to the receiving accounts, as follows:

  1. Create a new nodejs app called CreateTrustline.js.
  2. Start by importing the stellar-sdk from node-modules and creating a new server object pointed at localhost:8000 (Horizon instance), as follows:
const StellarSdk = require('stellar-sdk');const server = new StellarSdk.Server('http://127.0.0.1:8000', {allowHttp: true});
  1. Next, we'll use the accounts we generated in the previous section. Let the first account be our issuing account, which issues assets. The second and third accounts will be the receiving accounts, which trade the assets on the exchange. Use the secret key of the three accounts to extract ...

Get Blockchain Development for Finance Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.