Ethers SDK

The @armchain-ethersv6/ethers library is Armchain's official JavaScript/TypeScript SDK. If you're familiar with ethers.js v6, this is essentially a drop-in replacement with the same API and same patterns, but with all cryptographic operations swapped to use ML-DSA44 post-quantum signatures.

Why This SDK?

Standard ethers.js uses ECDSA for signing, which Armchain nodes reject. Any application that signs transactions or messages needs this SDK. Read-only operations (querying balances, reading contract state) work fine with standard ethers.js.

Operation
Standard ethers.js
Armchain Ethers SDK

Read blockchain state

✅ Works

✅ Works

Query balances/blocks

✅ Works

✅ Works

Call view functions

✅ Works

✅ Works

Sign transactions

❌ Rejected

✅ ML-DSA44

Sign messages

❌ Incompatible

✅ ML-DSA44

Create wallets

❌ ECDSA keys

✅ ML-DSA44 keys

HD wallet derivation

❌ Wrong coin type

✅ Armchain coin type

Installation

npm install @armchain-ethersv6/ethers

Quick Start

Connect to Armchain

import { JsonRpcProvider } from "@armchain-ethersv6/ethers";

// Devnet
const provider = new JsonRpcProvider("https://www.armchain.org/devnet");

// Local (Fakenet)
const localProvider = new JsonRpcProvider("http://localhost:4000");

// Query blockchain
const blockNumber = await provider.getBlockNumber();
const balance = await provider.getBalance("0xADDRESS");
console.log("Block:", blockNumber, "Balance:", balance.toString());

Create a Wallet

Send a Transaction

Interact with a Smart Contract

Deploy a Contract

HD Wallet (Hierarchical Deterministic)

Armchain uses a custom HD wallet derivation path:

Component
Value
Description

Purpose

44'

BIP-44 standard

Coin Type

65536'

Armchain's registered coin type

Account

0', 1', ...

Account index (hardened)

Change

0

External addresses

Address Index

0', 1', ...

Address index (hardened)

All derivation is hardened (denoted by '). Non-hardened derivation is not supported with ML-DSA44.

Create from Mnemonic

Generate a New Mnemonic

Signing Messages

Transaction Types

The SDK automatically creates Type 3 (PQC) transactions:

Manual Transaction Construction

Key Sizes and Formats

Size Reference

Component
Size
Description

Private Key

2,560 bytes

ML-DSA44 secret key

Public Key

1,312 bytes

ML-DSA44 public key

Raw Signature

2,420 bytes

ML-DSA44 detached signature

Signature Blob

3,732 bytes

Raw signature (2,420) + public key (1,312), included in transactions

API Compatibility

The SDK maintains the same API as ethers.js v6 wherever possible:

Removed/Changed Methods

Method
Status
Reason

Signature.recoverPublicKey()

Removed

Public key is embedded in signature

SigningKey.computeSharedSecret()

Removed

ECDH not applicable to DSA

SigningKey.compressedPublicKey

Removed

No compression in ML-DSA44

Transaction.unsignedSerialized

Removed

All PQC txns must be signed

Legacy Compatibility Properties

For migration convenience, these properties still exist but return compatibility values:

Error Handling

Migration from Standard ethers.js

If you're porting an Ethereum dApp to Armchain:

Step 1: Replace the Package

Step 2: Update Imports

Step 3: Update RPC Endpoint

Step 4: Key Generation

Step 5: No Other Changes

Contract interactions, event listeners, and transaction building work identically to standard ethers.js.

Performance Notes

Operation
Time

Key Generation

~2.0 ms

Signature Creation

~3.5 ms

Signature Verification

~5.0 ms

HD Child Derivation

~4.1 ms

Address Computation

~0.3 ms

These are approximately 4x slower than ECDSA but negligible for typical dApp usage.

Further Reading

Last updated