Using Ceramic CURL requests to update / delete state on a stream with pre-payment for storage

Currently looking at a use case for the benefit of the ERC4337 ecosystem. The project has a few specs required that I’m trying to clarify if ceramic is the right fit.

The actions I’d like to perform using CURL are as follow:

  • create a stream
  • append to the end of the stream
  • retrieve contents of a stream
  • delete elements at a specific index

Additionally, ideally I’d like to only pay once to setup a stream with a certain amount of storage, and allow updates to be performed freely in an access controlled way. Right now, just calling these CURL requests with Nodejs, but in the future I’d like to use Fluence network services (in rust, but don’t worry about this for now).

I have looked at these docs, but I really don’t find them intuitive, and they don’t include anything about deleting from a stream, and the update is also not clear.

For example, some questions I have from these docs are:
What is the controller for in the following request, and how do I create it?

"genesis": {
      "header": {
        "family": "test",
        "controllers": ["did:key:z6MkfZ6S4NVVTEuts8o5xFzRMR8eC6Y1bngoBQNnXiCvhH8H"]
      }
    }

Thanks for the help

1 Like

You can certainly do all of those actions over the http api, but in order to create or modify a stream you need to provide a signature from the controller DID of that stream, which would require some additional logic besides Curl.
Maybe you could have a look at the python ceramic client for some inspiration on how to do it.

1 Like

Thanks for the response. I’ll see if I’m able to recreate the spec (in js), maybe use chatgpt. btw before I try, is there a javascript implementation that uses the curl requests?

Also, after a first glance, I see that in the py client there is a delete request but no payload supplied. Is this incomplete? https://github.com/valory-xyz/ceramic-py/blob/main/ceramic/client.py#L33C44-L33C44 how might that work

Also, how does it work in terms of paying for an explicit amount of storage, that question wasn’t addressed.

Finally where can I learn more about what access control and how to generate and use a did controller for access request

:pray:

1 Like

Hey @morgan. The Ceramic py cli might not be 100% complete. As you can see in the http api docs, no payload is specified. Anyway, keep in mind that for nodes in gateway mode this endpoint is disabled.

I can’t speak to the specifics of the python client, but in general you need to provide a signed JWS in the correct format to update content. In order to remove content you simply make an update that set the content to null. See also this post about improving data deletion in Ceramic in general.

Currently there is no payments in Ceramic. You simply have to run your own node.