simple lotion chat demo
Switch branches/tags
Nothing to show
Clone or download
Latest commit fa86585 Aug 23, 2017
Permalink
Failed to load latest commit information.
bin haiku stuff Aug 22, 2017
.gitignore init Aug 21, 2017
package-lock.json haiku stuff Aug 22, 2017
package.json haiku stuff Aug 22, 2017
readme.md update readme Aug 23, 2017

readme.md

lotion-haiku

collaborative haiku-writing app on a blockchain. built on Lotion.

npm install -g lotion-haiku

# to join an existing chat:
haiku -j <chat id> -p <initial peers>

look how simple the blockchain logic is:

let syllables = require('syllables')

let haikuHandler = (state, tx) => {
  if (
    typeof tx.sender === 'string' &&
    typeof tx.message === 'string' &&
    tx.message.length <= 50
  ) {
    let requiredSyllables = state.messages.length % 3 === 1 ? 7 : 5
    if (syllables(tx.message) === requiredSyllables) {
      state.messages.push({
        sender: tx.sender,
        message: tx.message
      })
    }
  }
}

lotion(haikuHandler)