Overview
To make it easy for developers to get started, we’ve deployed web3infra.dev for developers to store data forever. This quick start will describe how to use arseeding-js to store data onto the Arweave network via web3infra.dev.
Prerequiste
In order to quickly have the data uploaded, you need to have prepared in advanced the following:
- node.js development environment
- have a MetaMask wallet.
- the wallet has any one of asset that listed on everPay.
If you’re not yet ready, please check the following: everPay recharge guide
Installation
Open your terminal and use the following command to install arseeding-js.
npm i arseeding-js
Upload Data
After the installation is complete, create demo.js
in the directory and copy the following code to demo.js
:
import { genNodeAPI } from 'arseeding-js'
const instance = await genNodeAPI('YOUR PRIVATE KEY')
const arseedUrl = 'https://arseed.web3infra.dev'
const data = Buffer.from('........')
const payCurrency = 'usdc' // everpay supported all tokens
const ops = {
tags: [{name: "Content-Type",value:'data type'}]
}
const res = await instance.sendAndPay(arseedUrl, data, payCurrency, ops)
console.log('res',res)
Configuration instructions:
- Populate your MetaMask key with
YOUR PRIVATE KEY
. Make sure that the wallet corresponding to the PRIVATE KEY has assets on everPay. - arseedUrl is the address of the Arseeding backend service that needs to be configured. Here we use the Arseed service provided by permadao at https://arseed.web3infra.dev.
- The data needs to be filled with the binary data you want to upload, the developer can use the file io to read the corresponding file from the local drive.
- payCurrency is the payment token you need to choose. If your MetaMask address is held on everPay with usdc, please fill in usdc here, if it is held in any other token, please fill in the symbol of the said token.
- In ops you can configure your Arweave Tags, Arweave Tags refer to: here.
- The Content-Type in tags needs to be configured based on the content you upload. For example, if you upload an image in png format, configure it as
image/png
. For details, refer to Content-Type.
When you’re ready to configure, call await instance.sendAndPay(arseedUrl, data, payCurrency, ops) to upload your data to the Arseeding node in web3infra.
Execute the following command in the terminal for upload files.
node demo.js
When executed correctly the terminal will output:
res {
status: 'ok',
everpayTx: {
tokenSymbol: 'USDC',
action: 'transfer',
from: '0xDc19464589c1cfdD10AEdcC1d09336622b282652',
to: 'uDA8ZblC-lyEFfsYXKewpwaX-kkNDDw8az3IW9bDL68',
amount: '685',
fee: '0',
feeRecipient: '0x6451eB7f668de69Fb4C943Db72bCF2A73DeeC6B1',
nonce: '1658805735973',
tokenID: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
chainType: 'ethereum',
chainID: '1',
data: '{"itemId":"iyosxBPXwPYXKYac31nEq3c5uDm4Wxsv0o-Yy8yaHvU","bundler":"uDA8ZblC-lyEFfsYXKewpwaX-kkNDDw8az3IW9bDL68","currency":"USDC","decimals":6,"fee":"685","paymentExpiredTime":1658809335,"expectedBlock":982245}',
version: 'v1',
sig: '0x12e9342863734b0c3d0bf09cf191a38e0266692a3a0114723904f5e3d5205310706d1d6eaff86bda2f19d8ee46becc4c9512b419ecae36be844bd43da52a6fa41b'
},
everHash: '0x2cd991fb67206ccc93976a20a892833fecce9ae5261d4570d6b6bb3eac3783e7',
order: {
itemId: 'iyosxBPXwPYXKYac31nEq3c5uDm4Wxsv0o-Yy8yaHvU',
bundler: 'uDA8ZblC-lyEFfsYXKewpwaX-kkNDDw8az3IW9bDL68',
currency: 'USDC',
decimals: 6,
fee: '685',
paymentExpiredTime: 1658809335,
expectedBlock: 982245
}
}
Eventually this data will be packaged into the Arweave network becoming permanent and immutable.
Download Data
In the returned result you can find res.order.itemId
, the above itemId is iyosxBPXwPYXKYac31nEq3c5uDm4Wxsv0o-Yy8yaHvU
.
The data can be downloaded using curl at:
curl --location --request GET 'https://arseed.web3infra.dev/iyosxBPXwPYXKYac31nEq3c5uDm4Wxsv0o-Yy8yaHvU'
For a more in-depth study of Arseeding and web3infra check out:
- Detailed Guide
- API documentation
- SDK documentation (golang, js, python)