OneKeyHQ / OneKeyHQ/hardware-js-sdk

Missing staking key witness for DRep delegations

Open
#475 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
35
Forks
39
Avg merge
21h 27m
Merged PRs (30d)
43

Description

Hi, looks like onekey (classic s1 at least) is not giving proper witnesses for Cardano transactions involving drep delegations. I got back only one - the spending key witness, whereas also the staking key witness is needed and the tx is then rejected by the network due to that. I'm using "@onekeyfe/hd-web-sdk@npm:^1.0.29" and the device is OneKey Classic S1, firmware 3.11.0

Here's the payload I'm sending to the device through the @onekeyfe/hd-web-sdk connection

{
    "signingMode": 0,
    "protocolMagic": 764824073,
    "networkId": 1,
    "includeNetworkId": false,
    "fee": "179229",
    "inputs": [
        {
            "prev_hash": "c5402e2e0315d53d13e610185d2db45d1fec188759515858fe0cfb18452de305",
            "prev_index": 1,
            "path": [
                2147485500,
                2147485463,
                2147483648,
                0,
                0
            ]
        }
    ],
    "outputs": [
        {
            "format": 0,
            "amount": "2051656",
            "tokenBundle": [
                {
                    "policyId": "8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd61",
                    "tokenAmounts": [
                        {
                            "assetNameBytes": "446a65644d6963726f555344",
                            "amount": "465465"
                        }
                    ]
                },
                {
                    "policyId": "9a9693a9a37912a5097918f97918d15240c92ab729a0b7c4aa144d77",
                    "tokenAmounts": [
                        {
                            "assetNameBytes": "53554e444145",
                            "amount": "11241953"
                        }
                    ]
                },
                {
                    "policyId": "c0ee29a85b13209423b10447d3c2e6a50641a15c57770e27cb9d5073",
                    "tokenAmounts": [
                        {
                            "assetNameBytes": "57696e67526964657273",
                            "amount": "31933607"
                        }
                    ]
                }
            ],
            "addressParameters": {
                "addressType": 0,
                "path": [
                    2147485500,
                    2147485463,
                    2147483648,
                    0,
                    0
                ],
                "stakingPath": [
                    2147485500,
                    2147485463,
                    2147483648,
                    2,
                    0
                ]
            }
        }
    ],
    "certificates": [
        {
            "type": 9,
            "path": [
                2147485500,
                2147485463,
                2147483648,
                2,
                0
            ],
            "dRep": {
                "type": 0,
                "keyHash": "959b9c624ee7271f6755ff84193b3af1b7036d0115b9702d6f04b03e"
            }
        }
    ],
    "tagCborSets": true
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the @onekeyfe/hd-web-sdk transaction-signing path for certificate type 9 and the stakingPath shown in the payload. Compare the witnesses returned by the OneKey Classic S1 with the transaction's spending and staking requirements; done means DRep delegation transactions include the required staking-key witness and are accepted by the network.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cryptography, embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
46/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.