Skip to main content

About Demo


Here we will introduce the steps on how to use the PADO AO SDK with examples.
Here is a link to a web demo: ao-demo, you can access and try it out.


  • Install an arweave wallet from ArConnect.
  • Export the wallet from ArConnect and store it to somewhere, such as the current folder.
  • (Optional) For local testing, you can run npx arlocal to start a local testnet, then refer to ArLocal, to mint some AR(TestToken) that will be used to interact with the local testnet.


npm install --save @padolabs/pado-ao-sdk


  • The minimum version of NodeJS required is 18+.


There are two roles, the Data Provider and the Data User, and whichever role you are in, you need to load the wallet and initialize the arweave.

load your arweave wallet

Referring to the previous preparation stage, export the wallet from ArConnect.

import { readFileSync } from "node:fs";

// load your arweave wallet
let walletpath = "/path/to/your/arweave/wallet";
const wallet = JSON.parse(readFileSync(walletpath).toString());

init arweave

By default, there is no need to set arweave, but for the Data Provider, some AR is required to upload data.

If you are going to test locally, make sure you have started arlocal and mint some AR(TestToken), as mentioned earlier in the preparation phase.

import Arweave from "arweave";

// init arweave (ArLocal)
const arweave = Arweave.init({
host: '',
port: 1984,
protocol: 'http'

Data Provider

prepare some data

let data = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);

In reality, you can load the data content from a file or the cloud and convert it to Uint8Array.

tag for the data

You can also set tags for your data for easier retrieval in the future!

let dataTag = { "testtagkey": "testtagvalue" };

price for the data

Importantly, you can set a price for your data, and the data users will pay you this defined price each time they use the data.

let priceInfo = {price: "200000000", symbol: "wAR"};

NOTE: Currently, only wAR(the Wrapped AR in AO) is supported. In the example above, 200000000 means 0.0002 wAR.

upload your data

import { uploadData } from "@padolabs/pado-ao-sdk";

// upload your data (If you want to do a local test, refer to the README to initialize arweave and then pass it to uploadData)
const dataId = await uploadData(data, dataTag, priceInfo, wallet);

Please be assured that your data is encrypted by the zk-LHE before it is uploaded to Arweave.

Congratulations! If everything is fine and there are no exceptions, you will get the DATAID, and you can subsequently query the data you uploaded based on that ID.

The complete code can be found in data_provider.ts.

Data Provider (with Arseeding)

By default, we use AR native transaction/data, as described in the previous section. However, the Arweave ecosystem itself has some issues. In order not to suffer from these issues, the PADO AO SDK supports using Arseeding.

For developers, it is very easy to use Arseeding in the SDK. The only difference from the previous section is upload your data.

Set extParam and pass it to uploadData.

const extParam = {
uploadParam: {
storageType: 'arseeding', symbolTag: 'arweave,ethereum-ar-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,0x4fadc7a98f2dc96510e42dd1a74141eeae0c1543'

// upload your data (If you want to do a local test, refer to the README to initialize arweave and then pass it to uploadData)
const dataId = await uploadData(data, dataTag, priceInfo, wallet, arweave, extParam);

NOTE: To use Arseeding, you need to first transfer some AR to everPay.

The complete code can be found in data_provider_arseeding.ts.

Data User

Important: Before you do the next step, make sure that the wallet you exported in the previous step has enough wAR in it. Refer to here to learn how to earn test token.

generate key pair

You should generates a pair of public and secret keys for encryption and decryption.

import { generateKey } from "@padolabs/pado-ao-sdk";
let key = await generateKey();

In practice, you SHOULD store the key to a file.

submit a task to AO process

Here, you need a dataId, which is returned by the Data Provider through the uploadData.

import { submitTask } from "@padolabs/pado-ao-sdk";
let dataId = "xxxxxxxxxxxxxxxx";
const taskId = await submitTask(dataId,, wallet);

This will return a task id which used for getting the result.

get the result

import { getResult } from "@padolabs/pado-ao-sdk";

// get the result (If you want to do a local test, refer to the README to initialize arweave and then pass it to getResult)
const [err, data] = await getResult(taskId, => [null, data]).catch(err => [err, null]);

If nothing goes wrong, you will get the data of the Data Provider.

If you follow the previous steps for the Data Provider, you will get the following output:


The complete code can be found in data_user.ts.


Q1: "Error: connect ENETUNREACH" appears while using default Arweave?

This is usually a network or proxy issue. There is a way to set up a proxy.

  • Copy the following code into a js file such as proxy.js.

    import { ProxyAgent } from 'undici';

    if (process.env.HTTPS_PROXY) {
    const proxyAgent = new ProxyAgent(process.env.HTTPS_PROXY);
    const nodeFetch = globalThis.fetch
    globalThis.fetch = function (url, options) {
    return nodeFetch(url, { ...options, dispatcher: proxyAgent })
  • Add import "./proxy.js" to your .ts script.

  • Export HTTPS_PROXY=your-proxy in your terminal.