Skip to content

multi: Add Kusama Asset Hub (KSM, dUSD) - #3634

Draft
monsieurbulb wants to merge 1 commit into
decred:masterfrom
monsieurbulb:kusama-asset-hub
Draft

monsieurbulb wants to merge 1 commit into
decred:masterfrom
monsieurbulb:kusama-asset-hub

Conversation

@monsieurbulb

Copy link
Copy Markdown

This is a draft, to ask whether you would take a new EVM chain shaped like this one before anyone spends review time on it.

We are building a members' exchange for Birdbrain, a small collective on Kusama, on dcrdex. Its members hold KSM and dUSD on Kusama Asset Hub, so this adds that chain.

What it is. Kusama Asset Hub runs pallet-revive, which executes ordinary EVM bytecode and serves a standard Ethereum RPC. Assets registered with its assets pallet appear as ERC-20 precompiles. So to dcrdex it is one more EVM chain. The client wallet and server backend here are the eth ones with Asset Hub's parameters, the way Base and Polygon are: three new files and four registration lines. KSM takes its SLIP-0044 ID, 434. The one token is dUSD, a dollar stablecoin (Asset Hub asset 50000002), in a reserved range 434000-434999.

What has been tested, on Polkadot Hub TestNet (Paseo).

  • The unmodified v1 swap contract deploys from the plain EVM bytecode (deployment). Native redeem, token redeem and refund all work.
  • KSM/dUSD trades settle end to end between two bisonw clients through a dcrdex server built from this branch. Five trades so far, 33 to 63 seconds each. One of them: KSM initiate, dUSD initiate, dUSD redeem, KSM redeem.
  • A public test market runs this branch at dex.birdbrain.wtf:7232. Testnet money only, access by prepaid bond.

What we learnt that you may want to know.

  • The wallet predicts the next base fee with go-ethereum's EIP-1559 formula, which returns 1 gwei unless London is active. Revive's base fee is flat (1,000 gwei on the testnet, 10,000 gwei on Kusama Asset Hub), so every transaction was refused as "Invalid Transaction" until ChainConfig set LondonBlock: 0.
  • Revive's gas is not Ethereum's. It reports about a tenth: initiate 5,428, redeem about 2,950, token redeem as low as 747. The gas tables keep Ethereum's limits, so swaps never run short but reserve far more than they spend. At the mainnet base fee that is about 0.7 KSM reserved per swap. Tightening it needs mainnet measurements.
  • Bonds are UTXO-only on the server, so a market with only EVM assets grants access through prepaid bonds. That suits a members' market well.
  • We hit the token backend bug that server/asset/eth: Fix unset contractVer in TokenBackend #3617 fixes. The server logged wrong contract version for dusd.ksm. wanted 0, got 1 whenever a dUSD redeem lagged the RPC node. With server/asset/eth: Fix unset contractVer in TokenBackend #3617 applied the same path resolves. It would be good to see that merged whatever happens here.

Not done.

  • No mainnet swap contract. ContractAddresses[1][Mainnet] is empty.
  • No simnet harness and no live tests like Base's multirpc_live_test.go.
  • No coin logo, explorer links or doc.ts entry in the web UI.
  • Batch swaps and gasless (relayed) redeems are untested on revive.

Two questions.

  1. Would you accept Asset Hub as an asset once the gaps above are filled?
  2. Is 434000-434999 the right token range, or would you rather we used another?

🤖 Generated with Claude Code

Adds KSM and dUSD on Kusama Asset Hub, reached through pallet-revive's
Ethereum RPC. The client wallet and server backend are the eth ones
with Asset Hub's parameters, the way Base and Polygon are. KSM takes
its SLIP-0044 ID, 434, and Asset Hub tokens get the range
434000-434999.

ChainConfig sets LondonBlock so the wallet's base fee prediction reads
revive's flat base fee instead of returning 1 gwei. The unmodified v1
swap contract is deployed on Polkadot Hub TestNet. Mainnet has no
contract yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant