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

feat(etc): add non-bitgo recovery and unsigned sweep support for etc #483

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

bhupendra11
Copy link
Contributor

@bhupendra11 bhupendra11 commented Aug 20, 2024

Testing :

  • Used this change as a beta dependency in WRW and verified the creation of unsigned sweep for Mainnet
  • Used this change using yarn link in OVC to create half and then full signed transaction
  • Published the full signed transaction on mainnet

Note:

  • Both recoveries are only tested on mainnet as testnet funds were not available

Transaction
https://etc.blockscout.com/tx/0x1a5ea

Non-Bitgo Recovery

{
  "id": "0xa7fd7b6544b29ecf3251b5c192dae989f2d70924a8fa2b23e39cebf56535b0ea",
  "tx": "0xf901cc038504a817c8008307a1209403eba8977ca853e6453934b122ffd54adfa05dcd80b90164391252150000000000000000000000003625a917202b3ba08fce11e8f577540f95aa45e600000000000000000000000000000000000000000000000000ce0eb154f9000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000066dad7b7000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004128bd84037202e5a23e3d5cefb8f47792aaa2b8a041c9a64aa19469408164229227fe6669438880e0148e6fdac43baf2501f4a14f5e5a472e7deec057079da7c71b00000000000000000000000000000000000000000000000000000000000000819da001dd67e18f56cefb762ac68827bc11b64dbe1a42a8229cb8cdfc37b09fe332d5a007afda31d864e69d1b9ec5387f061bfc7862bb09895110f859e07c4497ba31a2"
}

Broadcasted Transaction on blockchain :

link

Screenshot 2024-08-28 at 14 21 40

Unsigned sweep recovery

Unsigned sweep generated using WRW for mainnet ETC from etcColdWallet to etcWallet1

{
  "txHex": "0xf9012c038504a817c8008307a12094af3fb10ea8f244924418fa0aa083308a474f411b80b90104391252150000000000000000000000004e0bfe6896c219328f90ba4254e373d28a7ed7bc00000000000000000000000000000000000000000000000000b1a2bc2ec5000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000066dada7e000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000819d8080",
  "userKey": "xpub661MyMwAqRbcFcH8j6vygQXU3czWH2GnXYLKTXFXrhCLeEsGdR961awYjr3yC8eUj9rqhgFWHVbQJWqZS7kXpLBDzvoCKDLaBujsCH12Zfj",
  "backupKey": "xpub661MyMwAqRbcFzpji9PVJCKCdbPwo5iSiy4sP7gaNe5gBLDpL5nacXLRxAVBUd8qfxd9h6BdCeNBH3Z6beTYN58AZDxGFdQEjCAFASAroXx",
  "coin": "etc",
  "gasPrice": "20000000000",
  "gasLimit": "500000",
  "recipients": [
    {
      "address": "0x4e0bfe6896c219328f90ba4254e373d28a7ed7bc",
      "amount": "50000000000000000"
    }
  ],
  "walletContractAddress": "0xaf3fb10ea8f244924418fa0aa083308a474f411b",
  "amount": "50000000000000000",
  "backupKeyNonce": 3,
  "recipient": {
    "address": "0x4e0bfe6896c219328f90ba4254e373d28a7ed7bc",
    "amount": "50000000000000000"
  },
  "expireTime": 1725618814,
  "contractSequenceId": 11,
  "nextContractSequenceId": 11
}

Successful Half sign tx hash using user priv key in OVC

{
    "halfSigned": {
        "txHex": "0xf9018c038504a817c8008307a12094af3fb10ea8f244924418fa0aa083308a474f411b80b90164391252150000000000000000000000004e0bfe6896c219328f90ba4254e373d28a7ed7bc00000000000000000000000000000000000000000000000000b1a2bc2ec5000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000066dada7e000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041f4c051fea645c2e352156a9b98a60d40283737980f73b65a4da0da431d4dd4ef71fd1cecb4097104f11d549c4227179d7d0374c8b9ede7f4874122b8a86292611c00000000000000000000000000000000000000000000000000000000000000819d8080",
        "recipients": [
            {
                "address": "0x4e0bfe6896c219328f90ba4254e373d28a7ed7bc",
                "amount": "50000000000000000"
            }
        ],
        "expiration": 1725618814,
        "contractSequenceId": 11
    },
    "coin": "etc",
    "gasPrice": "20000000000",
    "gasLimit": "500000",
    "feesUsed": {
        "gasPrice": "20000000000",
        "gasLimit": "500000"
    },
    "amount": "50000000000000000",
    "isHalfSigned": true,
    "backupKeyNonce": 3,
    "walletContractAddress": "0xaf3fb10ea8f244924418fa0aa083308a474f411b"
}

Successful full sign tx hash backup priv key in OVC

{
    "txHex": "0xf901cc038504a817c8008307a12094af3fb10ea8f244924418fa0aa083308a474f411b80b90164391252150000000000000000000000004e0bfe6896c219328f90ba4254e373d28a7ed7bc00000000000000000000000000000000000000000000000000b1a2bc2ec5000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000066dada7e000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041f4c051fea645c2e352156a9b98a60d40283737980f73b65a4da0da431d4dd4ef71fd1cecb4097104f11d549c4227179d7d0374c8b9ede7f4874122b8a86292611c00000000000000000000000000000000000000000000000000000000000000819ea01d89d3ab0e6cdd0e7c52e99a20dc461925ec0c5cb3e0ae3253138dd6e3b59692a0593a7f443b7dd29d506f018f0ae8de4657adce98aca4d4e9562da4b5f72c8ba5",
    "coin": "etc",
    "gasPrice": "20000000000",
    "gasLimit": "500000",
    "feesUsed": {
        "gasPrice": "20000000000",
        "gasLimit": "500000"
    },
    "amount": "50000000000000000"
}

Resulted txHash received as response

{
  "apiVersion": "2023-04-25",
  "requestId": "66d1a112e99879dc78a4bbef",
  "context": "",
  "data": {
    "item": {
      "transactionId": "0x08bdd39689bfc46a6a424237a72ff555b99b258b7679f7b5ff3cccd272677a5c"
    }
  }
}
Screenshot 2024-08-28 at 14 22 00 efc7e8782e86b21c8ebc2b6dd8ee24f85

Broadcasted Transaction on blockchain :

link

@dpkjnr
Copy link
Contributor

dpkjnr commented Aug 26, 2024

Changes look fine to me, @bhupendra11 please add details of testing, like screenshot or the confirmed txn

@bhupendra11 bhupendra11 force-pushed the COIN-1418-etc-wrw-support branch from e95f171 to 23f716b Compare August 30, 2024 10:47
@bhupendra11 bhupendra11 force-pushed the COIN-1418-etc-wrw-support branch from 23f716b to 8961b05 Compare August 30, 2024 10:48
@bhupendra11 bhupendra11 merged commit 18a0fac into master Aug 30, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants