Skip to content

Commit

Permalink
feat: add polygon to wrw
Browse files Browse the repository at this point in the history
Ticket: BG-48024
  • Loading branch information
akhilbidhuriBitGo committed Sep 28, 2022
1 parent a8b65ca commit 0b88d1c
Show file tree
Hide file tree
Showing 12 changed files with 1,016 additions and 14 deletions.
14 changes: 9 additions & 5 deletions NON_BITGO_RECOVERY.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Build a transaction from a hot wallet using the KeyCard in order to recover fund

2. For Coins like Stellar, Ripple, and EOS, Root Address of the wallet needs to be provided.

3. For Ethereum, Ethereum Proof of Work, ERC20 Token, and Avalanche C-Chain, Wallet Contract Address needs to be provided. This is the ETH or AVAXC address of the wallet contract. This is also the wallet's base address.
3. For Ethereum, Ethereum Proof of Work, ERC20 Token, Avalanche C-Chain and Polygon, Wallet Contract Address needs to be provided. This is the ETH or AVAXC or Polygon address of the wallet contract. This is also the wallet's base address.
For ERC20 Token, Token Contract Address needs to be provided. This is the address of the smart contract of the token to recover. This is unique to each token and is NOT your wallet address

6. You are asked to provide Wallet Passphrase. This is the password that you had set at the time of wallet creation.
Expand All @@ -28,9 +28,9 @@ Build a transaction from a hot wallet using the KeyCard in order to recover fund

8. For UTXO based coins like Bitcoin, Litecoin, Dash, Zcash, Bitcoin Gold, Tron, and Bitcoin Cash, Address Scanning Factor needs to be provided. By default, it's value is 20 and can be changed if needed. The tool scans the addresses of the wallet to find the unspents. If it doesn't find unspents in 20 consecutive addresses, then it will stop scanning and generate a recovery transaction. For eg: If your funds are stuck in addresses with indices 10, 25 and 50 and you keep scanning factor as 20. Then the tool will stop after scanning till 46th index, because it didn't find unspents for 20 consecutive addresses from 26th address onwards. So in order to recover the funds in the address with 50th index, you will have to increase the scanning factor to a higher value.

9. For Ethereum, Ethereum Proof of Work, and ERC20 Token, Max Fee Per Gas Price and Max Priority Fee Per Gas in Gwei needs to be provided. The value should be between 1 Gwei and 2500 Gwei. The default is 20 Gwei for Max Fee Per Gas and 10 Gwei for Max Priority Fee Per Gas. If there is not enough Gwei in the backup key address gas tank, you will need to fund your backup key address. WRW will report the backup key address if there is not enough Gwei in it.
9. For Ethereum, Ethereum Proof of Work, Polygon, and ERC20 Token, Max Fee Per Gas Price and Max Priority Fee Per Gas in Gwei needs to be provided. The value should be between 1 Gwei and 2500 Gwei. The default is 20 Gwei for Max Fee Per Gas and 10 Gwei for Max Priority Fee Per Gas. If there is not enough Gwei in the backup key address gas tank, you will need to fund your backup key address. WRW will report the backup key address if there is not enough Gwei in it.

10. For Ethereum, Ethereum Proof of Work, ERC20 Token, and Avalanche C-Chain, Gas Limit needs to be provided. The value should be between 30,000 and 20,000,000. The default is 500,000 units of gas.
10. For Ethereum, Ethereum Proof of Work, ERC20 Token, Polygon and Avalanche C-Chain, Gas Limit needs to be provided. The value should be between 30,000 and 20,000,000. The default is 500,000 units of gas.

11. For Avalanche C-Chain, Gas Price needs to be provided. The value should be between 1 Gwei and 2500 Gwei. The default is 30 Gwei.

Expand All @@ -42,9 +42,11 @@ Build a transaction from a hot wallet using the KeyCard in order to recover fund

15. For Avalanche C-Chain, the key is from https://snowtrace.io/.

16. The SDK determines the amount of Coin that can be recovered, and builds a fully signed transaction to send that amount to the Destination Address.
16. For Polygon, the key is from https://polygonscan.com/.

17. This completed transaction can be broadcasted on the network using a blockchain explorer to finish the recovery.
17. The SDK determines the amount of Coin that can be recovered, and builds a fully signed transaction to send that amount to the Destination Address.

18. This completed transaction can be broadcasted on the network using a blockchain explorer to finish the recovery.
Some blockchain explorers to broadcast the transaction are as follows:

Avalanche C-Chain transactions: https://snowtrace.io/pushTx
Expand All @@ -59,6 +61,8 @@ Build a transaction from a hot wallet using the KeyCard in order to recover fund

Ethereum Proof of Work transactions: [ETHW.md](ETHW.md)

Polygon transactions: https://polygonscan.com/

Ripple transactions: https://bithomp.com/submit/

Stellar transactions: https://laboratory.stellar.org/#txsubmitter?network=public
Expand Down
18 changes: 11 additions & 7 deletions UNSIGNED_SWEEP.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ Build an unsigned transaction from a cold wallet using the user and backup publi

2. For Coins like Stellar, Ripple, and EOS, Root Address of the wallet needs to be provided.

3. For Ethereum, Ethereum Proof of Work, ERC20 Token, and Avalanche C-Chain, Wallet Contract Address needs to be provided. This is the ETH or AVAXC address of the wallet contract. This is also the wallet's base address.
3. For Ethereum, Ethereum Proof of Work, ERC20 Token, Avalanche C-Chain, Polygon, Wallet Contract Address needs to be provided. This is the ETH or AVAXC or Polygon address of the wallet contract. This is also the wallet's base address.
For ERC20 Token, Token Contract Address needs to be provided. This is the address of the smart contract of the token to recover. This is unique to each token and is NOT your wallet address

7. You are asked to provide the Destination Address (The address where you want to receive your recovered funds).

8. For UTXO based coins like Bitcoin, Litecoin, Dash, Zcash, Bitcoin Gold, Tron, and Bitcoin Cash, Address Scanning Factor needs to be provided. By default, it's value is 20 and can be changed if needed. The tool scans the addresses of the wallet to find the unspents. If it doesn't find unspents in 20 consecutive addresses, then it will stop scanning and generate a recovery transaction. For eg: If your funds are stuck in addresses with indices 10, 25 and 50 and you keep scanning factor as 20. Then the tool will stop after scanning till 46th index, because it didn't find unspents for 20 consecutive addresses from 26th address onwards. So in order to recover the funds in the address with 50th index, you will have to increase the scanning factor to a higher value.

9. For Ethereum, Ethereum Proof of Work, and ERC20 Token, Max Fee Per Gas Price and Max Priority Fee Per Gas in Gwei needs to be provided. The value should be between 1 Gwei and 2500 Gwei. The default is 20 Gwei for Max Fee Per Gas and 10 Gwei for Max Priority Fee Per Gas. If there is not enough Gwei in the backup key address gas tank, you will need to fund your backup key address. WRW will report the backup key address if there is not enough Gwei in it.
9. For Ethereum, Ethereum Proof of Work, Polygon, and ERC20 Token, Max Fee Per Gas Price and Max Priority Fee Per Gas in Gwei needs to be provided. The value should be between 1 Gwei and 2500 Gwei. The default is 20 Gwei for Max Fee Per Gas and 10 Gwei for Max Priority Fee Per Gas. If there is not enough Gwei in the backup key address gas tank, you will need to fund your backup key address. WRW will report the backup key address if there is not enough Gwei in it.

10. For Ethereum, Ethereum Proof of Work, ERC20 Token, and Avalanche C-Chain, Gas Limit needs to be provided. The value should be between 30,000 and 20,000,000. The default is 500,000 units of gas.
10. For Ethereum, Ethereum Proof of Work, ERC20 Token, Polygon, and Avalanche C-Chain, Gas Limit needs to be provided. The value should be between 30,000 and 20,000,000. The default is 500,000 units of gas.

11. For Avalanche C-Chain, Gas Price needs to be provided. The value should be between 1 Gwei and 2500 Gwei. The default is 30 Gwei.

Expand All @@ -41,13 +41,15 @@ Build an unsigned transaction from a cold wallet using the user and backup publi

15. For Avalanche C-Chain, the key is from https://snowtrace.io/.

16. The SDK determines the amount of Coin that can be recovered, and builds an unsigned transaction to send that amount to the Destination Address.
16. For Polygon, the key is from https://polygon.com/.

17. You need to half sign this unsigned transaction with your user private key using Offline Vault Console.
17. The SDK determines the amount of Coin that can be recovered, and builds an unsigned transaction to send that amount to the Destination Address.

18. You need to fully sign the half signed transaction with your backup private key using Offline Vault Console.
18. You need to half sign this unsigned transaction with your user private key using Offline Vault Console.

19. This completed transaction can be broadcasted on the network using a blockchain explorer to finish the recovery.
19. You need to fully sign the half signed transaction with your backup private key using Offline Vault Console.

20. This completed transaction can be broadcasted on the network using a blockchain explorer to finish the recovery.
Some blockchain explorers to broadcast the transaction are as follows:

Avalanche C-Chain transactions: https://snowtrace.io/pushTx
Expand All @@ -62,6 +64,8 @@ Build an unsigned transaction from a cold wallet using the user and backup publi

Ethereum Proof of Work transactions: [ETHW.md](ETHW.md)

Polygon transactions: https://polygonscan.com/

Ripple transactions: https://bithomp.com/submit/

Stellar transactions: https://laboratory.stellar.org/#txsubmitter?network=public
Expand Down
4 changes: 3 additions & 1 deletion electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Trx, Ttrx } from '@bitgo/sdk-coin-trx';
import { Txlm, Xlm } from '@bitgo/sdk-coin-xlm';
import { Txrp, Xrp } from '@bitgo/sdk-coin-xrp';
import { Zec } from '@bitgo/sdk-coin-zec';
import { IBaseCoin } from '@bitgo/sdk-core';
import { Polygon, Tpolygon } from '@bitgo/sdk-coin-polygon';
import { fromBase58 } from 'bip32';
import { app, BrowserWindow, dialog, ipcMain, shell } from 'electron';
import fs from 'node:fs/promises';
Expand Down Expand Up @@ -72,6 +72,8 @@ sdk.register('trx', Trx.createInstance);
sdk.register('ttrx', Ttrx.createInstance);
sdk.register('avaxc', AvaxC.createInstance);
sdk.register('tavaxc', TavaxC.createInstance);
sdk.register('polygon', Polygon.createInstance);
sdk.register('tpolygon', Tpolygon.createInstance);
Erc20Token.createTokenConstructors().forEach(({ name, coinConstructor }) => {
sdk.register(name, coinConstructor);
});
Expand Down
Loading

0 comments on commit 0b88d1c

Please sign in to comment.