I'm trying to create a QR code generator that would generate transaction data for some of the common blockchains and wallets.
There is some confusion about the format for different blockchains, but at least for main blockchains - it seems to be defined as:
ethereum:0xb794f5ea0ba39494ce839613fffba74279579268?amount=1.123
for ETH
(or BTC) and
ethereum:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/transfer?address=0xb794f5ea0ba39494ce839613fffba74279579268&uint256=111.123e6
for EVM-compatible coins (like USDC
here).
source: https://eips.ethereum.org/EIPS/eip-681
however... BNB doesn't seem to follow that format. I tried the following:
binance:0xba5830175b16e5e48d94c6fa11041ff9ed3bae5a?amount=1.123
bnb:0xba5830175b16e5e48d94c6fa11041ff9ed3bae5a?amount=1.123
binance:0xba5830175b16e5e48d94c6fa11041ff9ed3bae5a?amount=1.123&memo=1234
and:
both Binance and Exodus apps don't understand any of the above (not even eth or btc) - I'd appreciate links to their qr code requirements specs
Trust Wallet doesn't accept a BNB address written like that (funnily enough - amount and memo work flawlessly - same here, docs links would be amazing
metamask (which is Binance smart chain compatible) doesn't understand any of the BNB options - same here
I have honestly spent hours researching this topic and I am simply astonished by the lack of documentation in that regard.
as a bonus, just for the sake of informing others - XRP has its own super complex QR code format and it's available as a package here: https://www.npmjs.com/package/ripple-address-codec
anyway. any help will be greatly appreciated! cheers
For EVM blockchains, like BinanceSmartChain, the answer is in the documentation you provided. You need to use the chainId (56 for the BinanceSmartChain mainnet) you can check it on https://chainlist.org/
So, an exemple string could be
ethereum:0xb794f5ea0ba39494ce839613fffba74279579268@56?amount=1
(the name, that may bring some confusion, is still ethereum)
this url is asking for 10^-18 BNB for the address 0xb794f5ea0ba39494ce839613fffba74279579268
Something to note, the amount in this kind of string is supossed to be an integer, because is a multiple of the smallest unit, your example
is wrong, it could be ethereum:0xb794f5ea0ba39494ce839613fffba74279579268?amount=1123, asking for 1123 wei, iguals to 1.123e-15 ETH
If I can help with anything more feel free to ask