Previously, we have posted two blog posts about DAC. First one to announce that we, Marigold and TriliTech, have successfully deployed the Community DAC on Tezos Ghostnet.
The second one is a tutorial to give you all the details to configure and deploy your own DAC for your Smart Rollups!
In this blog post, we are going to integrate the DAC inside Tzwitter. Without the DAC, Tzwitter was limited to text tzweets. With the DAC, we can now post large text tzweet (>4KB) and images!
Please note that this is not a Smart Rollup tutorial, or a front web app tutorial. Hence, we are going to focus only on the useful functions to push data to Ghostnet Community DAC and reveal them on Smart Rollup side.
- Introducing DAC,
- Ghostnet Community DAC is alive,
- Originating a Smart Rollup,
- Deploy your own DAC to run your DAC Observer.
As explained in the introduction, we are going to enable Tzwitter user to post images.
- Post an image (> 4KB) to Ghostnet Community DAC using Tzwitter front web-app,
- Send received DAC Certificate from front to Smart Rollup,
- Process received DAC Certificate on Smart Rollup and reveal corresponding data.
As you have read in our previous blog posts, a DAC message is composed of three fields, this is a DAC Certificate from the Kernel-SDK point of view:
Order of this list is important, it must be the same that the configuration of DAC Coordinator for the Community DAC.
I provided them in the correct order.
You can copy/paste the provided public keys, they are the actual ones of the TriliTech and Marigold DAC Members who sign the data.
In our case, we do:
On our Smart Rollup, we have:
- received the DAC Certificate,
- validate its signature against the known public keys.
You guess the next and last step: reveal the corresponding data! This will be done in two different steps.
Your Smart Rollup is now using DAC! Let’s move to the other part needed by the Smart Rollup: your DAC Observer.
Configure and run your DAC Observer
Then now we can run it
Your DAC Observer is ready and receiving all the data pushed to Ghostnet Community DAC Coordinator, which means that your Smart Rollup is able to reveal the corresponding data!
Push data from front web app
Last step, on which one I will not spend to much time because you already had seen it with the previous blog posts, we have to push the data.
This will be done by calling two different endpoints:
Push data to Ghostnet Community DAC
We have to transfom the image posted by the user to a valid hexadecimal value needed by the Ghostnet Community DAC Coordinator. These transformation are not really interesting so I won’t develop them.
Please note that getting the DAC Certificate is not instantaneous. With the current DAC resources (which are very low) you need to wait around 30 seconds per megabyte of data.
Retrieve corresponding DAC Certificate
Send DAC Certificate to Smart Rollup
Thank you so much for reading us! Any feedback is welcome, as long as it is constructive 😉.