Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid signature for BNB through Walletconnect 2.0 #3433

Closed
0x-General opened this issue Sep 18, 2023 · 3 comments · Fixed by #3632
Closed

Invalid signature for BNB through Walletconnect 2.0 #3433

0x-General opened this issue Sep 18, 2023 · 3 comments · Fixed by #3632
Labels
bug Something isn't working

Comments

@0x-General
Copy link

0x-General commented Sep 18, 2023

Description
When signing & broadcasting a send transaction for BNB through walletconnect, the BNB node responds with a message saying:

{
    "code": 401,
    "failed_tx_index": 0,
    "message": "signature verification failed",
    "success_tx_results": []
}

Looks like the signing process is incorrect.
To Reproduce

Expected behavior
The node should process the transaction with no error messages.

Additional context
This is the message that is being broadcasted:

{
    "sequence": 1,
    "accountNumber": 7446375,
    "chainId": "Binance-Chain-Tigris",
    "msg": {
        "inputs": [
            {
                "address": {
                    "type": "Buffer",
                    "data": [
                        92,
                        12,
                        151,
                        228,
                        69,
                        248,
                        21,
                        153,
                        106,
                        172,
                        199,
                        153,
                        138,
                        210,
                        170,
                        200,
                        64,
                        182,
                        172,
                        235
                    ]
                },
                "coins": [
                    {
                        "denom": "BNB",
                        "amount": 10000
                    }
                ]
            }
        ],
        "outputs": [
            {
                "address": {
                    "type": "Buffer",
                    "data": [
                        92,
                        12,
                        151,
                        228,
                        69,
                        248,
                        21,
                        153,
                        106,
                        172,
                        199,
                        153,
                        138,
                        210,
                        170,
                        200,
                        64,
                        182,
                        172,
                        235
                    ]
                },
                "coins": [
                    {
                        "denom": "BNB",
                        "amount": 10000
                    }
                ]
            }
        ],
        "aminoPrefix": "2A2C87FA"
    },
    "memo": "",
    "source": 0,
    "signatures": [
        {
            "pub_key": {
                "type": "Buffer",
                "data": [
                    235,
                    90,
                    233,
                    135,
                    33,
                    2,
                    201,
                    141,
                    200,
                    60,
                    209,
                    67,
                    70,
                    142,
                    117,
                    45,
                    158,
                    247,
                    52,
                    74,
                    209,
                    0,
                    202,
                    92,
                    120,
                    6,
                    25,
                    166,
                    147,
                    180,
                    191,
                    8,
                    54,
                    217,
                    80,
                    191,
                    242,
                    186
                ]
            },
            "signature": {
                "type": "Buffer",
                "data": [
                    235,
                    204,
                    17,
                    136,
                    181,
                    5,
                    97,
                    1,
                    70,
                    136,
                    113,
                    199,
                    209,
                    96,
                    82,
                    20,
                    82,
                    206,
                    217,
                    56,
                    77,
                    46,
                    254,
                    179,
                    110,
                    251,
                    214,
                    198,
                    59,
                    165,
                    192,
                    114,
                    13,
                    42,
                    85,
                    74,
                    254,
                    152,
                    208,
                    66,
                    32,
                    233,
                    118,
                    241,
                    203,
                    112,
                    40,
                    121,
                    16,
                    10,
                    0,
                    21,
                    117,
                    69,
                    3,
                    62,
                    59,
                    45,
                    95,
                    129,
                    173,
                    166,
                    221,
                    139,
                    1
                ]
            },
            "account_number": 7446375,
            "sequence": 1
        }
    ]
}
@0x-General 0x-General added the bug Something isn't working label Sep 18, 2023
@satoshiotomakan
Copy link
Collaborator

satoshiotomakan commented Dec 27, 2023

Hi @0x-General, could you please help to find out actual request and expected response payloads?
I used https://thorswap.github.io/SwapKit/ to generate a send or swap requests with BNB chain, here's what I got:

These requests do not match the documentation:

  1. There is no request.signDoc.fee - probably, it supposes to be optional?
  2. request.signDoc.msgs do not have type and value fields.

Can we expect cosmos_signDirect request instead?

Could you please also advice, did you get this response from the TrustWallet Android app?

@satoshiotomakan
Copy link
Collaborator

One note - https://thorswap.github.io/SwapKit/ generates an expected payload on cosmos_signAmino for THORChain: https://gist.github.com/satoshiotomakan/e72631f61cbee10cc81dc0469e1e270e

@satoshiotomakan
Copy link
Collaborator

Hi @0x-General, we adopted WalletCore API to be able to parse and handle BNB signing requests through WalletConnect 2.0. The new Android/iOS releases coming soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@0x-General @satoshiotomakan and others