In this tutorial, we will walkthrough the process of uploading data to Arweave using the @liteseed/sdk
.
Installing the required packages
This tutorial requires the installation of the @liteseed/sdk
.
@liteseed/sdk
is the official js library for interacting with the Liteseed for js/ts.
Uploading Data
The sdk makes it very easy to upload data.
Initializing the SDK
First, you must create a new instance of Liteseed with the private key (JWK) you will use to sign and upload the data.
Signing the data
You can convert any data into a special arweave transaction using signData
.
Store the id in a database, so you can query your data later easily.
Posting the signed data
Next, you must pay for the upload to complete the process. You can check for the price of upload as follows.
The receipt object looks something like the following
The response would look something like this
Make the payment
Finally, you need to simply make the payment.
The Complete Example
Here’s the complete code for uploading a data-item using the @liteseed/sdk
.