Skip to content

Decentralized Storage with Arweave Pallet

We have integrated decentralized storage support into our Substrate-based blockchain using the pallet-arweave.
This allows metadata and media fingerprints to be permanently stored on Arweave while keeping on-chain references lightweight and verifiable.


Motivation

  • Ensure that important metadata (e.g., fingerprints, track metadata, etc) is immutably stored.
  • Use Arweave’s permaweb as a decentralized archive for music metadata.

Node

To enable Arweave signer in your node, start it with the following parameter:

--arweave-secret-key-path=path_to_test_arweave_wallet.json

Additionally, you must configure an offchain worker key for your node. This key is required for the offchain worker to sign and submit data

subkey generate --output-type json --scheme sr25519 > key.json

Make sure the inserted key is associated with the account that will perform the offchain worker tasks.

curl -s -H 'Content-Type: application/json' 
-d '{"jsonrpc":"2.0", "method": "author_insertKey", "params": ["ar_s","secret_phrase", "pub_key"]}'
 'https://node_url.example'


Example: Using Extrinsics

To submit metadata directly on-chain for Arweave storage:

const payload = {
    title: "example",
    bpm: 120,
    key: 1,
    scale: 0,
    instrument: 1,
    fingerprint: "https://example.com/fingerprint"
  }

const dataBytes = Buffer.from(JSON.stringify(payload));
const workerAddress = "5EUg77eNXXPhxsMktNjNdqC5W4TEaZ6aRWUpxED5QY4kfJCe";
const tx = api.tx.arweave.createTask(workerAddress, dataBytes);

After that, you can continue monitoring the task status in storage using the corresponding task_id key. Storage

The offchain worker will pick up the task and upload the data to Arweave storage.

Submitting a transaction to Arweave may take several minutes to complete, you can monitor arweave.TaskChanged event for your status.

You will initially receive the Arweave transaction hash in the Validation status, but it’s recommended to wait until the task is fully completed and then retrieve the result from the arweave -> taskResults storage.

Example: Using Mubert CLI

We also provide a convenient CLI tool to interact with the chain and Arweave in one step.

Upload a file ip and metadata to the blockchain (with Arweave offchain worker integration):

mubert-cli \
  --node-url wss://rpc-testnet.mubert.xyz \
  upload-ip \
  --api-auth='mubert-fingerprint-test-token' \
  --file=/Users/kirillkirianov/Downloads/output_3.wav \
  --data-file=./examples/create_entity.json \
  --arweave-worker-address='5EUg77eNXXPhxsMktNjNdqC5W4TEaZ6aRWUpxED5QY4kfJCe'