Skip to main content
The JavaScript SDK for Lumera Protocol works in both browsers and Node.js. This guide covers the Node.js setup for server-side applications, CLI tools, and backend services. In this environment a programmatic DirectSecp256k1HdWallet signer replaces browser wallet extensions. You build two small scripts. One uploads a file to Cascade and prints its action ID, the permanent on-chain reference for the file. The other downloads the file again.

What you need

  • Node.js 18 or later
  • A testnet account mnemonic with LUME for fees. Request tokens from the faucet.

Build the scripts

1

Install dependencies

The scripts below use top-level await, so set "type": "module" in your package.json.
2

Create a programmatic signer

In Node.js there is no Keplr or Leap wallet. Use DirectSecp256k1HdWallet for transaction signing and build a custom signer that adds signArbitrary (ADR-036) for Cascade’s off-chain signatures.
signer.ts
3

Set your mnemonic

The scripts read the account mnemonic from the LUMERA_MNEMONIC environment variable.
Treat the mnemonic like a private key. Load it from an environment variable or a secrets manager and keep it out of source control.
4

Upload a file

The upload registers an action on chain, escrows the storage fee, and transfers the file to a SuperNode. The optional expirationTime sets a deadline for the upload. If the upload fails or expires, the escrowed fee is refunded.
upload.ts
5

Download a file

Downloads arrive as a stream of chunks. Reassemble them and write the result to disk.
download.ts

Server-side alternatives

If you prefer Go on the server, the Go SDK covers the same Cascade upload and download operations.

Next steps

Build a browser app

Run the same flows in the browser with Keplr.

JavaScript SDK reference

Look up every client method and option.

Error handling

Handle failed uploads, timeouts, and retries.