node icon indicating copy to clipboard operation
node copied to clipboard

Ensure consistency in `bytes receiver` when withdrawing to different (non-EVM) chains

Open fadeev opened this issue 8 months ago • 0 comments

Right now when withdrawing from ZetaChain to Solana the protocol expects the receiver address to be a string encoded as bytes.

const solanaAddress = "AS48jKNQsDGkEdDvfwu1QpqjtqbCadrAq9nGXjFmdX3Z";

ZetaChain expects:

ethers.hexlify(Buffer.from(solanaAddress))

// 0x415334386a4b4e517344476b45644476667775315170716a747162436164724171396e47586a466d6458335a

This is too long to fit into Bitcoin's OP_RETURN (alongside an additional address in our swap example). Ideally, even with OP_RETURN we can at least send destination token address and receiver address.

The alternative, is for the protocol to expect base58 bytes:

Buffer.from(bs58.decode(solanaAddress)).toString("hex")

// 8c243ed0142e4c5f24e266073271c20c21c1c385c4f4abc972fc3d7bd864d86c

I think the rule of thumb should be, whatever the protocol receives as bytes sender in MessageContext, is what it uses inside the withdraw function.

fadeev avatar Apr 21 '25 09:04 fadeev