mirror of
https://github.com/luxfi/bridge.git
synced 2026-09-24 00:26:46 +00:00
You were right that the crypto is already there. Cardano signs with the same Ed25519 key Solana does, through FROST, which luxfi/threshold and luxfi/mpc support natively. The key was never the problem. The address was. Solana's address IS the public key, base58. Cardano's is blake2b-224 of that key inside a typed, network-tagged bech32 envelope. NETWORK_ADDRESS_TYPE mapped CARDANO_MAINNET to 'sol' — the comment beside it said "placeholder" — so the bridge handed out a Solana-shaped string and told people to send ADA to it. That is offered on bridge-api.lux.network today. cardano-address.ts builds the CIP-19 enterprise address: payment credential only, no staking part, which is the right shape for custody — a base address would commit to a staking credential the committee does not hold. blake2b-224 is NOT blake2b-512 truncated. Blake2b takes its digest length into the parameter block, so they differ from the first byte, and Node's fixed-length blake2b512 cannot be used. There is a test asserting exactly that, so anyone substituting a truncating implementation finds out immediately rather than after the funds move. Also asserted: the address is not the public key (the bug this replaces), the network tag distinguishes mainnet from testnet, a key that is not 32 bytes is refused rather than hashed into a plausible address for a key that does not exist, and encode/decode agree. The type union gained 'ada' rather than the map being widened to string, so the next family added has to be handled in the switch instead of falling through to 'eth' — which is how Cardano would have got an Ethereum address if the default had caught it. 25 networks in the config now. Nineteen EVM, all assemblable; Bitcoin, Solana, TON, XRP, Polkadot and Cardano correctly excluded from the EVM assembler. NOT VERIFIED against a live Cardano node — the encoder is self-consistent and matches CIP-19 as written, but no address produced here has been used on chain. Worth one testnet deposit before mainnet funds move through it.