Skip to content

rollkit/local-da

Repository files navigation

Local DA

Local DA implements the go-da interface over a Local Data Availability service.

It is intended to be used for testing DA layers without having to set up the actual services.

Usage

local-da binary

To build and run the local-da binary:

make build
./build/local-da

should output

2024/04/11 12:23:34 Listening on: localhost:7980

Which exposes the go-da interface over JSONRPC and can be accessed with an HTTP client like xh:

You can also run local-da with a -listen-all flag which will make the process listen on 0.0.0.0 so that it can be accessed from other machines.

$ ./build/local-da -listen-all
2024/04/11 12:23:34 Listening on: 0.0.0.0:7980

Docker

You can also run the local-da service using docker:

make docker-build
docker run --rm -p 7980:7980 local-da

MaxBlobSize

xh http://127.0.0.1:7980 id=1 method=da.MaxBlobSize | jq

output:

{
  "jsonrpc": "2.0",
  "result": 1974272,
  "id": "1"
}

Submit

xh http://127.0.0.1:7980 id=1 method=da.Submit 'params[][]=SGVsbG8gd28ybGQh' 'params[]:=-2'  'params[]=AAAAAAAAAAAAAAAAAAAAAAAAAAECAwQFBgcICRA=' | jq

output:

{
    "jsonrpc": "2.0",
    "result": [
        "AQAAAAAAAADfgz5/IP20UeF81iRRzDBu/qC8eXr9DUyplrfXod3VOA=="
    ],
    "id": "1"
}

Get

xh http://127.0.0.1:7980 id=1 method=da.Get 'params[][]=AQAAAAAAAADfgz5/IP20UeF81iRRzDBu/qC8eXr9DUyplrfXod3VOA==' 'params[]=AAAAAAAAAAAAAAAAAAAAAAAAAAECAwQFBgcICRA='

output:

{
    "jsonrpc": "2.0",
    "result": [
        "SGVsbG8gd28ybGQh"
    ],
    "id": "1"
}

References

[1] go-da

[2] xh