How to mint tokens on BSV

This post originally appeared on Medium and we republished with permission from its author, Connor Murray.

There is little to no barrier to entry for a person to mint tokens on BSV today.

Our talk at CoinGeek London 2020 was all about tokens, and how we can re-envision what a token is through the power of Bitcoin. We are doing this with True Reviews and Veritas, but we will illuminate why tokens are more complicated than they appear on the surface.

There are a number of tokenization platforms available and the one that we really like today is Run. We will show you how drop dead simple it is to issue a pointless ICO token on BSV today:

Step 1: Download Run.

Step 2: Download NodeJS.

Step 3: Open a new folder, put run.node.min.js in the current directory and run npm install bsv

Step 4: Write 5 lines of code:

const Run = require(‘./run.node.min’)// Run on mockchain for development
const run = new Run({ network: ‘mock’ })// Create my token class
class ICOCoin extends Token { }// Set some arbitrary fields on the token
ICOCoin.tokenIssuer = ‘Scam Artist’// Mint Tokens
const mintedCoins = new ICOCoin(100)// Log the token object
console.log(mintedCoins)

And just like we have minted ICOCoin! Minting tokens on BSV is simple.

But now what? Let’s try and use these tokens. Let’s assume we created a token that actually has some utility, like a concert ticket.

const Run = require(‘./run.node.min’)// Run on mainnet setting appropriate keys
const run = new Run({ network: ‘main’, owner: myOwner, purse: myPurse})// Create my token class
class ConcertTicket extends Token { }// Set some arbitrary fields on the token
ConcertTicket.issuer = ‘Murray Distributed Technologies’
ConcertTicket.venue = ‘Royal Albert Hall’
ConcertTicket.artist = ‘Bob Dylan’// Mint Tokens
const newTickets = new ConcertTicket(100)// Log the token object
console.log(newTickets)

Great! We have 100 concert tickets. So I guess we are now a concert ticket company. So let’s say I’ve created a way to sell these tickets to consumers, and Alice buys one ticket. We need to transfer ownership of one ticket from our company to Alice. Let’s send the ticket to Alice’s Bitcoin wallet. She gives us a public key (pubKey) to initiate the transfer:

//Send Ticket to Alice
const sendTicket = ConcertTicket.send(pubKey, 1)

Great! Alice’s Bitcoin wallet now has the ticket.

It’s now the night of the show, and Alice wants to redeem her ticket for entry into the concert.

Now what do we do?

There are probably 100 different ways we can solve this problem, but they all require a combination of a few things:

  1. A direct wallet integration for receiving and sending tokens
  2. A business that issues and manages these concert tickets
  3. An ecosystem of participants using the services

The problem on BSV isn’t how to issue tokens. It is creating the businesses and services that get real tokens into the hands of consumers. Creating the next ICO on BSV is possible today with a web wallet and a few lines of code, but what utility has an ICO brought to the world over the last 5 years?

Tokens are a tool that enable new business models and use-cases, and we can’t wait for them to be used across the BSV ecosystem.

New to Bitcoin? Check out CoinGeek’s Bitcoin for Beginners section, the ultimate resource guide to learn more about Bitcoin—as originally envisioned by Satoshi Nakamoto—and blockchain.

Source link

Leave a comment