Skip to content

Commit

Permalink
Merge PR cosmos#2270: docs: lotion update
Browse files Browse the repository at this point in the history
  • Loading branch information
zramsay authored and cwgoes committed Sep 12, 2018
1 parent e5e7c4f commit f1ac53b
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 49 deletions.
4 changes: 3 additions & 1 deletion docs/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ module.exports = {
{
title: "Lotion JS",
collapsable: false,
children: [["/lotion/overview", "Overview"], "/lotion/building-an-app"]
children: [
["/lotion/overview", "Overview"]
]
},
{
title: "Validators",
Expand Down
46 changes: 0 additions & 46 deletions docs/lotion/building-an-app.md

This file was deleted.

53 changes: 51 additions & 2 deletions docs/lotion/overview.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,54 @@
# Lotion JS Overview
# Overview

Lotion is a new way to create blockchain apps in JavaScript, which aims to make writing new blockchains fast and fun. It builds on top of Tendermint using the ABCI protocol. Lotion lets you write secure, scalable applications that can easily interoperate with other blockchains on the Cosmos Network using IBC.
Lotion is an alternative to the Cosmos SDK and allows you to create blockchain apps in JavaScript. It aims to make writing new blockchain apps fast and easy by using the ABCI protocol to build on top of Tendermint. Lotion lets you write secure, scalable applications that can easily interoperate with other blockchains on the Cosmos Network using IBC.

Lotion itself is a tiny framework; its true power comes from the network of small, focused modules built upon it. Adding a fully-featured cryptocurrency to your blockchain, for example, takes only a few lines of code.

For more information see the [website](https://lotionjs.com) and [GitHub repo](https://github.com/keppel/lotion), for complete documentation which expands on the following example.

## Building an App

### Installation

::: tip
Lotion requires __node v7.6.0__ or higher, and a mac or linux machine.
:::

```
$ npm install lotion
```

### Simple App

`app.js`:

```js
let lotion = require('lotion')

let app = lotion({
initialState: {
count: 0
}
})

app.use(function (state, tx) {
if(state.count === tx.nonce) {
state.count++
}
})

app.listen(3000)
```

run `node app.js`, then:

```bash
$ curl http://localhost:3000/state
# { "count": 0 }

$ curl http://localhost:3000/txs -d '{ "nonce": 0 }'
# { "ok": true }

$ curl http://localhost:3000/state
# { "count": 1 }
```

0 comments on commit f1ac53b

Please sign in to comment.