Skip to content
Oeiuwq Faith Blog OpenSource Porfolio

lasp-lang/lasp

Prototype implementation of Lasp in Erlang.

lasp-lang/lasp.json
{
"createdAt": "2014-06-10T11:12:41Z",
"defaultBranch": "master",
"description": "Prototype implementation of Lasp in Erlang.",
"fullName": "lasp-lang/lasp",
"homepage": "http://lasp-lang.org",
"language": "Erlang",
"name": "lasp",
"pushedAt": "2021-03-02T15:30:15Z",
"stargazersCount": 890,
"topics": [
"crdt",
"distributed-systems",
"erlang",
"lasp"
],
"updatedAt": "2025-10-17T16:22:02Z",
"url": "https://github.com/lasp-lang/lasp"
}

Build Status

Lasp is a programming model for synchronization-free computations.

Lasp requires Erlang 19 or greater. Once you have Erlang installed, do the following to install and build Lasp.

$ git clone git@github.com:lasp-lang/lasp.git
$ cd lasp
$ make

Clone Lasp:

$ git clone https://github.com/lasp-lang/lasp.git

Run two shells

$ rebar3 shell --name a@127.0.0.1
$ rebar3 shell --name b@127.0.0.1

Exceute to node a:

1> lasp_peer_service:join('a@127.0.0.1').
ok
2> lasp_peer_service:members().
{ok,['a@127.0.0.1','b@127.0.0.1']}

Execute node b:

1> lasp_peer_service:members().
{ok,['a@127.0.0.1','b@127.0.0.1']}

Go back to node a and run:

3> Content = #{what => i_am_an_awmap_value}.
% create a lasp CRDT
AwMapVarName = <<"awmap">>.
Key1 = <<"key1">>.
AwMapType = {state_awmap, [state_mvregister]}.
{ok, {AwMap, _, _, _}} = lasp:declare({AwMapVarName, AwMapType}, AwMapType).
% Update the CRDT with the content
{ok, _} = lasp:update(AwMap, {apply, Key1, {set, nil, Content}}, term_to_binary(self())).

Go to node b and retrieve the content of the CRDT:

2> {ok,[{_, AwMapSet}]} = lasp:query({<<"awmap">>,{state_awmap,[state_mvregister]}}).
3> sets:to_list(AwMapSet).
% [#{what => i_am_an_awmap_value}]

You can run a Erlang shell where you can interact with a Lasp node by doing the following:

$ make shell

To run the test suite, which will execute all of the Lasp scenarios, use the following command.

Terminal window
$ make check

If using the Distributed Erlang backend, make sure that all nodes are configured to use the same cookie.

This blog post by @marianoguerra contains concise sample code.