Skip to content

Commit

Permalink
Fix lints
Browse files Browse the repository at this point in the history
  • Loading branch information
jkilpatr committed Jan 3, 2023
1 parent 790c3b8 commit 0d86266
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 36 deletions.
56 changes: 22 additions & 34 deletions docs/canto-recovery.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Recovering tokens "bounced back" from Canto

When sending tokens from Ethereum to Canto via Gravity Bridge, it is possible to send to your Canto address before
generating a public key on Canto. When this happens, Canto will immediately send the tokens back to the address which
sent them. This becomes complicated when Gravity Bridge's IBC Auto Forwarding function is involved, as you likely have
never used the Gravity Bridge account the funds are "stuck" on.

### Understanding where the "missing" funds are
## Understanding where the "missing" funds are

Gravity Bridge's IBC Auto Forwarding functionality allows users to send tokens from Ethereum directly to Cosmos chains
without normally needing to interact with the Gravity Bridge Blockchain.

Expand All @@ -22,43 +24,29 @@ Canto sent them back to the `gravity1abcdefg4567...` address you probably have n
account in disguise, and currently there are no good user interfaces to control this account with.

## Recovery Process

1. Generate a public key on the [Canto Website](https://bridge.canto.io), otherwise you'll wind up with the tokens bouncing back again.
1. First you must install the Gravity Bridge command line interface (CLI) tool called `gbt` from the official Gravity Bridge GitHub.
To do this, follow only the "Download and Install CLI tools" instructions on [this page](/docs/cli-usage.md#download-and-install-cli-tools)
to install the `gbt` tool, it is not necessary to install the `gravity` tool.
Stop when you get to `Sending ERC20 tokens from Ethereum to Gravity Bridge` or any further instructions.
1. Double check that the tool you have installed is from the official Gravity Bridge source code GitHub:
https://github.com/Gravity-Bridge/Gravity-Bridge . If someone is trying to get you to install a tool from another website,
or using instructions not on the official Gravity Bridge documentation GitHub (https://github.com/Gravity-Bridge/Gravity-Docs/),
stop immediately and ask for help in the Discord (https://discord.gg/b3DtsNPu). Scammers are very persistent, be certain
you are working with only the official tools and instructions!
1. Obtain your Ethereum private key used for the `canto1abcdefg4567...` account. This is probably the private key for your
Ethereum account in MetaMask. **Be very careful during this process! Do NOT share your private key with ANYONE, and make
sure that you delete your private key after this process. If someone gains control of your private key, your entire
Ethereum AND Canto accounts are vulnerable! You have been warned!** You can use the [Metamask Instructions here](https://metamask.zendesk.com/hc/en-us/articles/360015289632-How-to-export-an-account-s-private-key)
to obtain the private key for use with `gbt`.
1. Figure out what your total amount to be transferred is. This must be provided without any decimal places, in the case
of WETH and other 18 decimal ERC20 tokens, 1 WETH would be 1 * 10^18 = 1000000000000000000. USDC is a 6 decimal token so
0.22 USDC would be 0.22 * 10^6 = 220000. We recommend checking out the token page on Etherscan for your ERC20 which lists
the token decimals, like [this page for USDC.](https://etherscan.io/token/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48)
1. Figure out the "denom" you will be transferring. For an ERC20 this is going to be the name of the gravity voucher for
that ERC20, which is "gravity" + the **properly capitalized** ERC20 contract address.
USDC is `gravity0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48` and WETH is `gravity0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`.

1. First you must install the Gravity Bridge command line interface (CLI) tool called `gbt` from the official Gravity Bridge GitHub. To do this, follow only the "Download and Install CLI tools" instructions on [this page](/docs/cli-usage.md#download-and-install-cli-tools) to install the `gbt` tool, it is not necessary to install the `gravity` tool. Stop when you get to `Sending ERC20 tokens from Ethereum to Gravity Bridge` or any further instructions.

1. Double check that the tool you have installed is from the official Gravity Bridge source code [GitHub](https://github.com/Gravity-Bridge/Gravity-Bridge). If someone is trying to get you to install a tool from another website, or using instructions not on the official Gravity Bridge documentation [GitHub](https://github.com/Gravity-Bridge/Gravity-Docs/), stop immediately and ask for help in the [Discord](https://discord.gg/b3DtsNPu). Scammers are very persistent, be certain you are working with only the official tools and instructions!

1. Obtain your Ethereum private key used for the `canto1abcdefg4567...` account. This is probably the private key for your Ethereum account in MetaMask. **Be very careful during this process! Do NOT share your private key with ANYONE, and make sure that you delete your private key after this process. If someone gains control of your private key, your entire Ethereum AND Canto accounts are vulnerable! You have been warned!** You can use the [Metamask Instructions here](https://metamask.zendesk.com/hc/en-us/articles/360015289632-How-to-export-an-account-s-private-key) to obtain the private key for use with `gbt`.

1. Figure out what your total amount to be transferred is. This must be provided without any decimal places, in the case of WETH and other 18 decimal ERC20 tokens, 1 WETH would be `1 * 10^18 = 1000000000000000000`. USDC is a 6 decimal token so 0.22 USDC would be `0.22 * 10^6 = 220000`. We recommend checking out the token page on Etherscan for your ERC20 which lists the token decimals, like [this page for USDC.](https://etherscan.io/token/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48)

1. Figure out the "denom" you will be transferring. For an ERC20 this is going to be the name of the gravity voucher for that ERC20, which is "gravity" + the **properly capitalized** ERC20 contract address. USDC is `gravity0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48` and WETH is `gravity0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2`.

1. Now that you have the `gbt` CLI tool installed you have two recovery options:

- **Send your tokens back to Ethereum** and try again (Best for getting back to a clean slate)
- **Send your tokens to a more easily controlled Gravity Bridge account** (Cheaper, best for continuing what you wanted to do)

### Send your tokens back to Ethereum
1. Choose a bridge fee amount. This will vary depending on the token you are trying to send to Ethereum, but you will need
to provide a reasonable fee to get a reasonable bridge time. The standard recommendation is $10USD worth of the token, but
if you would like the tokens to arrive faster you can pay more to make that happen. You might be able to check what
[Blockscape](https://bridge.blockscape.network) recommends for a Gravity Bridge -> Ethereum transfer and choose one of those values.
Your fee amount will also need to be provided in the same fashion as the amount in step 5 above.
1. Fill in your specific values in to the following command, and make sure there is no space between \<Transfer Amount\> and \<Denom\> or between
\<Bridge Fee Amount\> and \<Denom\>, e.g. `123456789gravity0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`.
**If you are trying to send all of the balance in your Gravity account, you must subtract the bridge fee amount from the
total amount you discovered in step 5 above to arrive at your transfer amount.**

1. Choose a bridge fee amount. This will vary depending on the token you are trying to send to Ethereum, but you will need to provide a reasonable fee to get a reasonable bridge time. The standard recommendation is $10USD worth of the token, but if you would like the tokens to arrive faster you can pay more to make that happen. You might be able to check what [Blockscape](https://bridge.blockscape.network) recommends for a Gravity Bridge -> Ethereum transfer and choose one of those values. Your fee amount will also need to be provided in the same fashion as the amount in step 5 above.

1. Fill in your specific values in to the following command, and make sure there is no space between \<Transfer Amount\> and \<Denom\> or between \<Bridge Fee Amount\> and \<Denom\>, e.g. `123456789gravity0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`. **If you are trying to send all of the balance in your Gravity account, you must subtract the bridge fee amount from the total amount you discovered in step 5 above to arrive at your transfer amount.**

`gbt keys recover-funds --cosmos-grpc http://gravitychain.io:9090 --send-to-eth --ethereum-key <Your Ethereum Private Key> --amount <Transfer Amount><Denom> --eth-bridge-fee <Bridge Fee Amount><Denom> --eth-destination <Your Ethereum Address>`

Expand All @@ -68,9 +56,9 @@ Finally, run your command and wait for it to appear in the Transaction Queue on
If you do not see your funds in a reasonable timeframe, ask for help on the [Discord](https://discord.gg/b3DtsNPu).

### Send your tokens to a more easily controlled Gravity Bridge account
1. Determine your Gravity account destination. Generate a new Gravity Bridge account, or use an existing one you already
control. We recommend using [Keplr](https://www.keplr.app/) to make this account since it will work with the Blockscape
website later.

1. Determine your Gravity account destination. Generate a new Gravity Bridge account, or use an existing one you already control. We recommend using [Keplr](https://www.keplr.app/) to make this account since it will work with the Blockscape website later.

1. Fill in your specific values in to the following command, and make sure there is no space between \<Transfer Amount\> and \<Denom\>, e.g. `123456789gravity0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`.

`gbt keys recover-funds --send-on-cosmos --ethereum-key <Your Ethereum Private Key> --amount <Transfer Amount><Denom> --cosmos-destination <Gravity account destination>`
Expand Down
4 changes: 2 additions & 2 deletions docs/frontend-creation.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const txHash = await ethereum.request({

Sending tokens to Ethereum does not have a predictable timeline like sending tokens to Cosmos. In exchange for dramatically lower fees [relayers](relaying.md) will choose when to request a batch containing your users tx and many other people's transactions to relay.

MsgSendToEth transactions have two fee fields, one is paid to the to the validators this is the CHAIN_FEE, the other is paid to the relayers on Ethereum, the BRIDGE_FEE.
MsgSendToEth transactions have two fee fields, one is paid to the to the validators this is the CHAIN_FEE, the other is paid to the relayers on Ethereum, the BRIDGE_FEE.

You can imagine the bridge fees as a metaphorical bus stop. Various people wishing to travel walk to the bus stop and put money into a jar. When enough money to pay for the bus driver (relayer) has been collected, the travelers board the bus and it departs for Ethereum. You can supply any fee you like, all the way down to zero, in which case the users tx will be picked up for free when other profitable transactions fill the metaphorical jar and make it worth the relayers time.

Expand Down Expand Up @@ -335,7 +335,7 @@ Depending on which is easier for you there are two methods to do this.
- Monitor `Gravity.sol` for a [TransactionBatchExecutedEvent](https://github.com/Gravity-Bridge/Gravity-Bridge/blob/main/solidity/contracts/Gravity.sol#L91)
- Use [QueryAttestationsRequest](https://github.com/Gravity-Bridge/Gravity-Bridge/blob/main/module/proto/gravity/v1/query.proto#L217) to monitor for a `BatchSendToEthClaim`

Or `https://info.gravitychain.io:9000/gravity_bridge_info` and `https://info.gravitychain.io:9000/eth_bridge_info` respectively.
Or `https://info.gravitychain.io:9000/gravity_bridge_info` and `https://info.gravitychain.io:9000/eth_bridge_info` respectively.

Either will allow you to monitor batch execution and confirm to the user that their funds are available on Ethereum, either by finding the batch in the recently executed events list on the ETH side or seeing it go away from the Gravity Bridge side.

Expand Down
2 changes: 2 additions & 0 deletions docs/setting-up-a-fullnode.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ seeds = "ade4d8bc8cbe014af6ebdf3cb7b1e9ad36f412c0@seeds.polkachu.com:14256,86bd5
```

Change the `persistent_peers` field in ~/.gravity/config/config.toml to contain the following:

```text
persistent_peers = "73e27e9b376d2f58d80e29e8175542cb01c3024d@135.181.73.170:26856, ef9748625b4739c5411e276cf2cb0d2742a037f9@54.36.63.85:26656, 39490daffac0c7847b0d2617e412b2942055a82b@95.214.53.46:26656, 906114620df87a270b89404fdc7f15b3760fa34e@95.214.53.27:42656"
Expand All @@ -52,6 +53,7 @@ persistent_peers = "73e27e9b376d2f58d80e29e8175542cb01c3024d@135.181.73.170:2685
## Download address book

Besides adding seeds and peers you could download latest address book:

```bash
wget -O "$HOME/addrbook.json" https://snapshots1.polkachu.com/addrbook/gravity/addrbook.json
mv "$HOME/addrbook.json" ~/.gravity/config
Expand Down
3 changes: 3 additions & 0 deletions docs/setting-up-a-validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ Change the `seeds` field in ~/.gravity/config/config.toml to contain the followi
seeds = "ade4d8bc8cbe014af6ebdf3cb7b1e9ad36f412c0@seeds.polkachu.com:14256,86bd5cb6e762f673f1706e5889e039d5406b4b90@gravity.seed.node75.org:10556"
```

Change the `persistent_peers` field in ~/.gravity/config/config.toml to contain the following:

```text
persistent_peers = "73e27e9b376d2f58d80e29e8175542cb01c3024d@135.181.73.170:26856, ef9748625b4739c5411e276cf2cb0d2742a037f9@54.36.63.85:26656, 39490daffac0c7847b0d2617e412b2942055a82b@95.214.53.46:26656, 906114620df87a270b89404fdc7f15b3760fa34e@95.214.53.27:42656"
Expand All @@ -85,6 +87,7 @@ persistent_peers = "73e27e9b376d2f58d80e29e8175542cb01c3024d@135.181.73.170:2685
## Download address book

Besides adding seeds and peers you could download latest address book:

```bash
wget -O "$HOME/addrbook.json" https://snapshots1.polkachu.com/addrbook/gravity/addrbook.json
mv "$HOME/addrbook.json" ~/.gravity/config
Expand Down

0 comments on commit 0d86266

Please sign in to comment.