Skip to main content

Installation

Arseeding-go serves as a golang SDK for Arseeding nodes, facilitating developers to develop golang backend services.

Repository: https://github.com/permadao/arseeding.

go get github.com/permadao/arseeding

Usage

When using the Web3infra service, you will need to have an Ethereum wallet or Arweave wallet. The wallet will be used to sign your data and will also be used to pay for the fees consumed by the storage.

Ethereum wallet creation SDK

To use an Ethereum wallet you need to install goether, which is a nice and convenient golang backend Ethereum wallet tool. Installation is as follows.

go get github.com/everFinance/goether

Once installed, the SDK instance can be generated using the following code:

prvKey := "<your ecc private key>"
eccSigner, err := goether.NewSigner(prvKey)
payUrl := "<https://api.everpay.io>"
arseedUrl := "<https://arseed.web3infra.dev>"
sdk, err := sdk.NewSDK(arseedUrl, payUrl, eccSigner)

where prvKey is your ethereum wallet key. The eccSigner generated with the key will be used for data signing and payment signing.

payUrl is needed to configure the URL of everPay service, normally the URL is https://api.everpay.io.

arseedUrl is the address that needs to be configured to the Arseeding service, or https://arseeding.web3infra.dev if using the Web3infra service. If you are using your own deployed Arseeding node, please configure your own server address.

Next you can use the sdk instance for permanent file storage!

Arweave Wallet Creation SDK

Arweave wallets can be created using goar, the official Arweave SDK currently recommended by Arweave, which is installed as follows:

go get github.com/everFinance/goar

Use the following code to generate SDK instances:

rsaSigner, err := goar.NewSignerFromPath("./rsakey.json")
payUrl := "<https://api.everpay.io>"
arseedUrl := "<https://arseed.web3infra.dev>"
sdk, err := sdk.NewSDK(arseedUrl, payUrl, rsaSigner)

Unlike ethereum wallets, Arweave wallets usually use a keyfile. You need to put the keyfile into the specified directory and read it using goar. In the above code rsakey.json is read to generate rsaSigner.

See above for details on payUrl and arseedUrl.

More

See Bundle use case, Sync and Broadcast use case, Manifest use case for more details on how to use the SDK.