Getting Started with Walrus & TypeScript
First, you’ll need to get set up with Walrus. I recommend installing via the CLI commands, especially if you’re on a Mac, because I ran into an issue trying to install it on my Mac. You will likely deploy your Walrus site on Mainnet, so execute this command to install the Walrus CLI tool and then the website builder for mainnet. Execute this command to install the latest Walrus mainnet version:[Terminal]
walrus
binary to your PATH. Also, you need to download the latest Walrus configurations with this command:
[Terminal]
[Terminal]
--amount
option, and a specific SUI/WAL exchange object with the --exchange-id
option.
For more options, run:
[Terminal]
[Terminal]
[Terminal]
get-wal
command is only available on Walrus testnet. On mainnet you’ll need to visit an exchange or use Slush Wallet to swap for some.
Writing Data to Walrus
First, add these imports to the top of your file from the Sui and Walrus SDKs.[index.ts]
[index.ts]
[index.ts]
writeBlob
command. It takes in the blob and other configurations including if you want it deletable, the number of epochs you want to perisist the data for, and the signer.
[index.ts]
package.json
file in my project, and I’m logging the blob ID and object ID to the console. If your upload is complete, you should get the ID like this.

Reading Data From Walrus
You’ll need the blob ID to read the file from Walrus network. Here’s how you can read it and save it to a path.[index.ts]
readBlob
function fetches the binary content from Walrus nodes. Then, TextDecoder().decode(...)
converts the binary blob to a string, before writeFileSync
saves it to a file.
If a network or sync issue occurs (e.g., during epoch transition), the retry logic ensures you don’t crash on transient errors.

Deleting Data from Walrus
Provided that you set thedeletable
option to true when you uploaded your blob to Walrus, you should be able to delete it from the network with the executeDeleteBlobTransaction
function like this:
[index.ts]
[index.ts]
