A transaction can upload data onto Arweave. To upload data using Liteseed Network
you need to sign data into a special format called a Data-Item.
These data-items are batched together into a single transaction called a bundle and posted to Arweave.
Learn more about data-items & bundles here: ANS-104: Bundled Data v2.0 - Binary Serialization.
Installing the required packages
This tutorial requires some packages to make uploading data easier.
arweave is the official js library for interacting with the Arweave library.
arbundles is the recommended library for converting data into data-item.
Uploading the Data
Uploading has 4 steps:
Signing Data
Posting the signed data to Liteseed
Paying the upload transaction fee
Notifying the network of the payment
1. Signing Data
Use an arweave wallet jwk to sign the data.
2. Posting the signed data to the API
The signed data is sent to the API using a post request.
The request expects a header "application/octet-stream" and the size of the data-item.
The response would look something like this
Store the id in a database, so you can query your data later easily.
3. Paying the Upload Transaction Fee
Check the price of the upload and create a transaction to pay for the upload.
4. Notify network of the payment
Next, you need let the network know of the payment.
Once the payment is confirmed (approximately >20 blocks on Arweave are mined),
the data is posted to Arweave in a bundle.