create account

Elixir/Erlang Graphene client v0.4 released: now with new blocks streaming and subscriptions by ontofractal

View this thread on: hive.blogpeakd.comecency.com
· @ontofractal ·
$798.03
Elixir/Erlang Graphene client v0.4 released: now with new blocks streaming and subscriptions
![](http://i.imgur.com/C6zRpTP.png)
I've started building an analytical dashboard for Bitshares/Openledger (similar to [steempunks](http://steempunks.com) and will be open sourcing Elixir libraries along the way. This release adds a simple subscription interface by integrating GenStage, a specification for handling and exchanging events.

# Repo and package

* [Github Repo](https://github.com/cyberpunk-ventures/graphene_client_ex)
* [Hex package](https://hex.pm/packages/graphene_client_ex)

# Changelog

* Graphene.Stages.Supervisor module 
* Graphene.Stages.Blocks.Producer module
*  [example](https://github.com/cyberpunk-ventures/graphene_client_ex/blob/master/lib/stages/consumer_example.ex) of GenStage blocks consumer
* config option to start Stages.Supervisor process
* minor code style improvements and bugfixes

# GenStage client example 

```
defmodule Graphene.Stage.Blocks.ExampleConsumer do
  use GenStage
  require Logger
  alias Graphene.Block

  def start_link(args, options \\ []) do
    GenStage.start_link(__MODULE__, args, options)
  end

  def init(args) do
    {:consumer, args, subscribe_to: args[:subscribe_to]}
  end

  def handle_events(events, _from, state) do
    block = hd(events)
    for tx <- Block.unpack_txs(block) do
      Logger.info """
      New transaction:
      #{inspect tx}
      """
    end
    {:noreply, [], state}
  end

end

```
# About Elixir

Elixir is a functional programming language with superior concurrency primitives, distributed computation and fault tolerance capabilities based on Erlang/OTP.
Personally, I am really happy with my bet on Elixir to build cryptotokens related apps and strongly recommend every developer to try it.

Learning resources:

* [ElixirConf Jose Valim Keynote](http://confreaks.tv/videos/elixirconf2016-keynote)
* [ElixirConf 2016 Chris McCord Keynote](http://confreaks.tv/videos/elixirconf2016-keynote)
* [Elixir School](https://elixirschool.com/)
* [Elixir Crash Course](http://elixir-lang.org/crash-course.html)

# Roadmap

* **Next: assets and feeds**
* More utility functions
* ~~Implement subscriptions~~
* ~~Investigate PubSub implementations~~
* More tests and docs
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 103 others
properties (23)
authorontofractal
permlinkelixir-erlang-graphene-client-v0-4-released-now-with-new-blocks-streaming-and-subscriptions
categorybitshares
json_metadata{"tags":["bitshares","blockchain","cryptocurrency","steemdev"],"image":["http://i.imgur.com/C6zRpTP.png"],"links":["http://steempunks.com","https://github.com/cyberpunk-ventures/graphene_client_ex","https://hex.pm/packages/graphene_client_ex","https://github.com/cyberpunk-ventures/graphene_client_ex/blob/master/lib/stages/consumer_example.ex","http://confreaks.tv/videos/elixirconf2016-keynote","https://elixirschool.com/","http://elixir-lang.org/crash-course.html"],"app":"steemit/0.1","format":"markdown"}
created2017-06-04 13:42:12
last_update2017-06-04 13:42:12
depth0
children14
last_payout2017-06-11 13:42:12
cashout_time1969-12-31 23:59:59
total_payout_value682.258 HBD
curator_payout_value115.771 HBD
pending_payout_value0.000 HBD
promoted0.050 HBD
body_length2,163
author_reputation61,670,850,962,884
root_title"Elixir/Erlang Graphene client v0.4 released: now with new blocks streaming and subscriptions"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,158,533
net_rshares28,081,221,780,462
author_curate_reward""
vote details (167)
@ahmadhassan ·
interesting one man.. @ontofractal keep going
properties (22)
authorahmadhassan
permlinkre-ontofractal-elixir-erlang-graphene-client-v0-4-released-now-with-new-blocks-streaming-and-subscriptions-20170607t041736754z
categorybitshares
json_metadata{"tags":["bitshares"],"users":["ontofractal"],"app":"steemit/0.1"}
created2017-06-07 04:17:39
last_update2017-06-07 04:17:39
depth1
children0
last_payout2017-06-14 04:17:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length45
author_reputation871,251,759,940
root_title"Elixir/Erlang Graphene client v0.4 released: now with new blocks streaming and subscriptions"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,314,713
net_rshares0
@clixmoney ·
good,  i need programmer who will create for me a website with good idea, where I can find prgrammers that are ready to cooperate ?
👍  
properties (23)
authorclixmoney
permlinkre-ontofractal-elixir-erlang-graphene-client-v0-4-released-now-with-new-blocks-streaming-and-subscriptions-20170604t142441173z
categorybitshares
json_metadata{"tags":["bitshares"],"app":"steemit/0.1"}
created2017-06-04 14:24:42
last_update2017-06-04 14:24:42
depth1
children7
last_payout2017-06-11 14:24:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length131
author_reputation708,028,799,822,335
root_title"Elixir/Erlang Graphene client v0.4 released: now with new blocks streaming and subscriptions"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,160,107
net_rshares1,263,826,048
author_curate_reward""
vote details (1)
@cptnsolo ·
why website? let's make it native for iOS / android?
properties (22)
authorcptnsolo
permlinkre-clixmoney-re-ontofractal-elixir-erlang-graphene-client-v0-4-released-now-with-new-blocks-streaming-and-subscriptions-20170609t105538617z
categorybitshares
json_metadata{"tags":["bitshares"],"app":"steemit/0.1"}
created2017-06-09 10:55:39
last_update2017-06-09 10:55:39
depth2
children0
last_payout2017-06-16 10:55:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length52
author_reputation27,144,215,734
root_title"Elixir/Erlang Graphene client v0.4 released: now with new blocks streaming and subscriptions"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,462,513
net_rshares0
@maxse ·
I'm a web developer ;-)
👍  
properties (23)
authormaxse
permlinkre-clixmoney-re-ontofractal-elixir-erlang-graphene-client-v0-4-released-now-with-new-blocks-streaming-and-subscriptions-20170604t194558511z
categorybitshares
json_metadata{"tags":["bitshares"],"app":"steemit/0.1"}
created2017-06-04 19:45:54
last_update2017-06-04 19:45:54
depth2
children5
last_payout2017-06-11 19:45:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length23
author_reputation9,504,532,692,213
root_title"Elixir/Erlang Graphene client v0.4 released: now with new blocks streaming and subscriptions"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,174,379
net_rshares1,263,826,048
author_curate_reward""
vote details (1)
@clixmoney ·
amazing, contact me here please : https://www.facebook.com/snouci
👍  
properties (23)
authorclixmoney
permlinkre-maxse-re-clixmoney-re-ontofractal-elixir-erlang-graphene-client-v0-4-released-now-with-new-blocks-streaming-and-subscriptions-20170604t221925071z
categorybitshares
json_metadata{"tags":["bitshares"],"links":["https://www.facebook.com/snouci"],"app":"steemit/0.1"}
created2017-06-04 22:19:24
last_update2017-06-04 22:19:24
depth3
children4
last_payout2017-06-11 22:19:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length65
author_reputation708,028,799,822,335
root_title"Elixir/Erlang Graphene client v0.4 released: now with new blocks streaming and subscriptions"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,181,396
net_rshares1,263,826,048
author_curate_reward""
vote details (1)
@cm-steem ·
Very cool! So we'll be able to use this to create bitshares blockchain explorers? Looking forwards to future releases :)
👍  
properties (23)
authorcm-steem
permlinkre-ontofractal-elixir-erlang-graphene-client-v0-4-released-now-with-new-blocks-streaming-and-subscriptions-20170604t193928356z
categorybitshares
json_metadata{"tags":["bitshares"],"app":"steemit/0.1"}
created2017-06-04 19:39:27
last_update2017-06-04 19:39:27
depth1
children0
last_payout2017-06-11 19:39:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length120
author_reputation58,522,774,254,119
root_title"Elixir/Erlang Graphene client v0.4 released: now with new blocks streaming and subscriptions"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,174,129
net_rshares5,852,261,106
author_curate_reward""
vote details (1)
@cm-steem ·
How different is Elixir from Erlang? I have to learn Erlang for a project, will I be able to make the switch easily?
properties (22)
authorcm-steem
permlinkre-ontofractal-elixir-erlang-graphene-client-v0-4-released-now-with-new-blocks-streaming-and-subscriptions-20170606t143632754z
categorybitshares
json_metadata{"tags":["bitshares"],"app":"steemit/0.1"}
created2017-06-06 14:36:33
last_update2017-06-06 14:36:33
depth1
children1
last_payout2017-06-13 14:36:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length116
author_reputation58,522,774,254,119
root_title"Elixir/Erlang Graphene client v0.4 released: now with new blocks streaming and subscriptions"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,275,042
net_rshares0
@ontofractal ·
$0.42
Syntax is quite different, semantics are mostly the same. There are minor differences like order of arguments for some functions though.  Anyway, you will be able to make the switch with an adequate amount of effort. I also that learning two languages with different syntax but very similar semantics is a great learning exercise  :)
👍  
properties (23)
authorontofractal
permlinkre-cm-steem-re-ontofractal-elixir-erlang-graphene-client-v0-4-released-now-with-new-blocks-streaming-and-subscriptions-20170606t144225063z
categorybitshares
json_metadata{"tags":["bitshares"],"app":"steemit/0.1"}
created2017-06-06 14:42:24
last_update2017-06-06 14:42:24
depth2
children0
last_payout2017-06-13 14:42:24
cashout_time1969-12-31 23:59:59
total_payout_value0.400 HBD
curator_payout_value0.016 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length333
author_reputation61,670,850,962,884
root_title"Elixir/Erlang Graphene client v0.4 released: now with new blocks streaming and subscriptions"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,275,402
net_rshares117,227,976,910
author_curate_reward""
vote details (1)
@lautenglye ·
nice....your post deserve my upvote and resteem....
properties (22)
authorlautenglye
permlinkre-ontofractal-elixir-erlang-graphene-client-v0-4-released-now-with-new-blocks-streaming-and-subscriptions-20170604t234441229z
categorybitshares
json_metadata{"tags":["bitshares"],"app":"steemit/0.1"}
created2017-06-04 23:45:57
last_update2017-06-04 23:45:57
depth1
children0
last_payout2017-06-11 23:45:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length51
author_reputation1,745,262,632,168
root_title"Elixir/Erlang Graphene client v0.4 released: now with new blocks streaming and subscriptions"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,184,823
net_rshares0
@peterloron ·
Looks very cool! Always glad to see more useful Elixir projects.
properties (22)
authorpeterloron
permlinkre-ontofractal-elixir-erlang-graphene-client-v0-4-released-now-with-new-blocks-streaming-and-subscriptions-20170606t231038408z
categorybitshares
json_metadata{"tags":["bitshares"],"app":"steemit/0.1"}
created2017-06-06 23:10:39
last_update2017-06-06 23:10:39
depth1
children0
last_payout2017-06-13 23:10:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length64
author_reputation41,185,557,232
root_title"Elixir/Erlang Graphene client v0.4 released: now with new blocks streaming and subscriptions"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id4,302,030
net_rshares0