Examples
As inspiration, we provide several simple examples in different programming languages to interact with Walrus through the various interfaces. They are located at https://github.com/MystenLabs/walrus-docs/tree/main/examples and described below.
In addition, we have built actual applications on top of Walrus. The prime example is Walrus Sites, with code available in the https://github.com/MystenLabs/walrus-sites repository.
And for an example of how to build a static website and store it as a Walrus Site with GitHub actions, just look at the CI workflow we use to publish this very site.
Python
The Python examples folder contains a number of examples:
- How to use the HTTP API to store and read a blob.
- How to use the JSON API to store, read, and check the availability of a blob. Checking the certification of a blob illustrates reading the Blob Sui object that certifies (see the Walrus Sui reference).
- How to read information from the Walrus system object.
- How to track Walrus related Events.
JavaScript
A JavaScript example is provided showing how to upload and download a blob through a web form using the HTTP API.
Move
For more complex applications, you may want to interact with Walrus on-chain objects. For that purpose, the currently deployed Walrus contracts are included in our GitHub repository.
Furthermore, we provide a simple example contract that imports and uses the Walrus objects.