Coins
coins
is a cryptocurrency middleware for Lotion.
It gives you a fully-functional token out-of-the-box, but can also act as a framework for more complex functionality (e.g. smart contracts). ERC20 tokens are so 2017!
Installation
coins
requires node v7.6.0 or higher.
$ npm install coins
Usage
Basic coin usage
First, generate an address for yourself:
$ npx coinsYour Address:338sjLktF4XzRfz25oyH11jVYhZMokbsr Your wallet seed is stored at "~/.coins",make sure to keep it secret!
Add the middleware to your lotion app, and be sure to give yourself some coins!
app.js
let lotion = let coins = let app = app app
Then build a client:
wallet.js
:
let lotion = let coins = let client = await lotionlet wallet = coins // wallet methods:let address = walletconsole // 'OGccsuLV2xuoDau1XRc6hc7uO24' let balance = await walletconsole // 20 let result = await walletconsole // { height: 42 }
Writing your own advanced coin handler
chain.js
:
let coins = let lotion = let app = app app
run node chain.js
, then write
client.js
:
let lotion = let client = await lotion let result = await client console// { ok: true, height: 42 }
License
MIT