Lotion coin is a simple, extensible cryptocurrency library written for Lotion.
With just a few lines of JavaScript, you can make your own new coin that behaves exactly how you want it to.
Out of the box, lotion-coin
supports addresses and send transactions, but you can arbitrarily extend your coin's functionality by using it from within a more complex Lotion state machine.
lotion-coin
can be used as a node module, or as a cli if it's installed globally.
If your coin is going to have real value, please use Cosmos SDK instead of lotion-coin
. The security of lotion-coin
has not yet been evaluated.
npm install lotion lotion-coin
let lotion = require('lotion')
let { handler, client } = require('lotion-coin')
let opts = {
port: 3000
}
let app = lotion(opts)((state, tx) => {
handler(state, tx)
})
To initialize and run as a validator for a new currency:
npm install -g lotion-coin
Lcoin init
Lcoin start
That'll log a genesis key and start a validator node.
Users can use that genesis key to connect with:
Lcoin start <genesis key>
To send some coins, open another terminal window and run:
Lcoin send --address <recipient address> --amount 123
You can always open http://localhost:3232 while Lcoin is running to see the full JSON representation of the blockchain state from Lotion.