All Projects → datopia → Abci Host

datopia / Abci Host

Licence: mit
Clojure host/server for Tendermint's ABCI protocol.

Programming Languages

clojure
4091 projects

Projects that are alternatives of or similar to Abci Host

Library
Collection of papers in the field of distributed systems, game theory, cryptography, cryptoeconomics, zero knowledge
Stars: ✭ 100 (+455.56%)
Mutual labels:  blockchain, consensus, distributed-systems
Tendermint
⟁ Tendermint Core (BFT Consensus) in Go
Stars: ✭ 4,491 (+24850%)
Mutual labels:  blockchain, consensus, distributed-systems
Ethermint Archive
Ethereum on Tendermint using Cosmos-SDK!
Stars: ✭ 667 (+3605.56%)
Mutual labels:  blockchain, tendermint, consensus
Awesome Substrate
A curated list of awesome projects and resources related to the Substrate blockchain development framework.
Stars: ✭ 228 (+1166.67%)
Mutual labels:  blockchain, consensus, distributed-systems
Raft
Raft Consensus Algorithm
Stars: ✭ 370 (+1955.56%)
Mutual labels:  consensus, distributed-systems
Dragonboat
Dragonboat is a high performance multi-group Raft consensus library in pure Go.
Stars: ✭ 3,983 (+22027.78%)
Mutual labels:  consensus, distributed-systems
Blockchain Reading List
Blockchain Manchester Meetups, Talks and Reading List
Stars: ✭ 17 (-5.56%)
Mutual labels:  blockchain, distributed-systems
Nuraft
C++ implementation of Raft core logic as a replication library
Stars: ✭ 428 (+2277.78%)
Mutual labels:  consensus, distributed-systems
Go Cyber
Your 🔵 Superintelligence
Stars: ✭ 270 (+1400%)
Mutual labels:  blockchain, tendermint
Quorum
A permissioned implementation of Ethereum supporting data privacy
Stars: ✭ 4,054 (+22422.22%)
Mutual labels:  blockchain, consensus
Iotex Core
Official implementation of IoTeX blockchain protocol in Go.
Stars: ✭ 505 (+2705.56%)
Mutual labels:  blockchain, distributed-systems
Harmony
The core protocol of harmony
Stars: ✭ 351 (+1850%)
Mutual labels:  blockchain, consensus
Js
Gryadka is a minimalistic master-master replicated consistent key-value storage based on the CASPaxos protocol
Stars: ✭ 304 (+1588.89%)
Mutual labels:  consensus, distributed-systems
Go Spacemesh
Go Implementation of the Spacemesh protocol full node. 💾⏰💪
Stars: ✭ 389 (+2061.11%)
Mutual labels:  blockchain, consensus
Nkn
Official Go implementation of NKN full node.
Stars: ✭ 287 (+1494.44%)
Mutual labels:  blockchain, distributed-systems
Translations
🐼 Chinese translations for classic IT resources
Stars: ✭ 6,074 (+33644.44%)
Mutual labels:  consensus, distributed-systems
Node
Mysterium Network Node - official implementation of distributed VPN network (dVPN) protocol
Stars: ✭ 681 (+3683.33%)
Mutual labels:  blockchain, distributed-systems
Awesome Distributed Systems
A curated list to learn about distributed systems
Stars: ✭ 7,263 (+40250%)
Mutual labels:  consensus, distributed-systems
lightchain
Fast proof-of-authority blockchain based on go-ethereum and tendermint
Stars: ✭ 52 (+188.89%)
Mutual labels:  consensus, tendermint
epaxos
A pluggable implementation of the Egalitarian Paxos Consensus Protocol
Stars: ✭ 39 (+116.67%)
Mutual labels:  distributed-systems, consensus

io.datopia/abci

Clojars Project

A Clojure library which acts as an application host for Tendermint's ABCI --- allowing the exposure of plain functions as replicable state machines.

io.datopia/abci uses io.datopia/stickler to provide pure-data representations of the protobuf-encoded messages received from the Tendermint node process --- maps in, maps out.

Documentation

Change Log.

Supported Tendermint Versions

io.datopia/abci Tendermint
0.1.* 0.26.0

Toy Example / Walkthrough

The simplest possible service looks something like:

(ns my.abci
  (:require [abci.host            :as host]
            [abci.host.middleware :as mw]))

(def service
  (-> (constantly ::mw/default)
      ;; Wrap handler invocations w/ (manifold.deferred/future).
      mw/wrap-synchronous
      ;; Substitute ::mw/default for a default success response,
      ;; appropriate to the incoming request.
      mw/wrap-default
      ;; Return a Closeable, per aleph.tcp/start-server.
      host/start))

While this isn't a particularly dynamic application, we can successfully point a Tendermint node process at it and indefinitely operate a no-op blockchain.

Requests & Responses

Let's transform our handler from (constantly ::mw/default) to something slightly different:

(fn [req]
  (pprint req)
  ::mw/default)

Once the Tendermint node connects, our first message:

{:stickler/msg          :abci/Request
 :info                  {:stickler/msg  :abci/RequestInfo
                         :version       "0.26.0-c086d0a3"
                         :block-version 7
                         :p2p-version   4}
 :stickler.one-of/value :info
 ;; The node initiates 3 distinct connections: :info, :query, :consensus
 :abci.host/conn        :info}

The minimal success response to the above:

{:stickler/msg :abci/Response
 :info         {:stickler/msg :abci/ResponseInfo
                :data         "NO_INFO"}}

Let's update our service to construct this response explictly, while using middleware to strip incoming :abci/Request envelopes - and wrap responses in :abci/Response envelopes. While this won't alter how our service functions, it may make it a little clearer.

(defn handler [{msg-type :stickler/msg :as req}]
  (pprint req)
  (case msg-type
    :abci/RequestInfo {:stickler/msg :abci/ResponseInfo
                       :data         "NO_INFO"}
    ::mw/default))

(def service
  (-> handler
      mw/wrap-synchronous
      mw/wrap-default
      ;; Combines mw/wrap-request-envelope and mw/wrap-response-envelope
      mw/wrap-envelope
      host/start))

Without the envelopes, our incoming request sequence:

{:stickler/msg   :abci/RequestInfo
 :version        "0.26.0-c086d0a3"
 :block-version  7
 :p2p-version    4
 :abci.host/conn :info}

{:stickler/msg   :abci/RequestFlush
 :abci.host/conn :info}

{:stickler/msg   :abci/RequestInitChain
 :time           {:stickler/msg :google.protobuf/Timestamp
                  :seconds      1544530118
                  :nanos        776243100}
 :chain-id       "test-chain-anZqUW"
 :validators
 [{:stickler/msg :abci/ValidatorUpdate
   :pub-key      {:stickler/msg :abci/PubKey
                  :type         "ed25519"
                  :data         <bytes>}
   :power        10}]
 ...
 :abci.host/conn :consensus}

...

The project's abci.edn resource describes the full complement of messages. As Tendermint uses Go-specific extensions in its protobuf files, abci.edn is generated by io.datopia/stickler from the types.proto maintained by jabci.

Contributors

  • Moe Aboulkheir

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].