From f738bce1a36dfb154b88cb76c4a78d632f5d1783 Mon Sep 17 00:00:00 2001 From: ele Date: Wed, 12 Apr 2023 13:50:14 +0200 Subject: [PATCH 1/3] Update with Gnosis Chain info --- .../developers/tutorials/estimate-gas-cost.md | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/docs/developers/tutorials/estimate-gas-cost.md b/docs/developers/tutorials/estimate-gas-cost.md index 7547ffe..4dc95dd 100644 --- a/docs/developers/tutorials/estimate-gas-cost.md +++ b/docs/developers/tutorials/estimate-gas-cost.md @@ -13,12 +13,14 @@ This tutorial is made for finding the transfer steps that the circles api would - The checksummed* address of another account you want to transfer to ### To estimate the gas cost you will also need: -- A metamask account connected to the first circles account +- A Metamask account connected to the first circles account - You can follow [this guide](gnosis-safe-as-wallet.mdx) - - Switch from Ethereum mainnet to the xDai network. To add xDai chose custom RCP under Networks and specify the following: - - name: xdai - - URL: https://xdai.poanetwork.dev + - [Switch from Ethereum mainnet to the Gnosis Chain network](https://docs.gnosischain.com/tools/wallets/metamask/). To add Gnosis Chain chose "Add Network" under "Networks" and specify the following: + - name: Gnosis + - URL: https://rpc.gnosischain.com - Chain ID: 100 + - Symbol: xDai + - Block Explorer URL: https://gnosisscan.io *A checksummed address will contain some capital letters unlike the non-checksummed address. @@ -84,18 +86,17 @@ transfers.data.transferSteps.forEach(transfer =>{ amounts.push(transfer.value); }); -console.log({ - tokenOwnerAddresses, - srcs, - dests, - amounts -}); +console.log(JSON.stringify(tokenOwnerAddresses)); +console.log(tokenOwnerAddressestoString()); +console.log(JSON.stringify(srcs)); +console.log(JSON.stringify(dests)); +console.log(JSON.stringify(amounts)); ``` -Then remove white spaces and make sure quotations are double quotations. +Then make sure there are no quotations in the elements list. 4. **Get the hex data for the transaction** -Now that you have the lists of `tokenOwnerAddresses`, `srcs`, `dests` and `amounts`, go to [the circles Hub on blockscout](https://blockscout.com/xdai/mainnet/address/0x29b9a7fBb8995b2423a71cC17cf9810798F6C543/transactions). +Now that you have the lists of `tokenOwnerAddresses`, `srcs`, `dests` and `amounts`, go to [the circles Hub on blockscout](https://gnosisscan.io/address/0x29b9a7fBb8995b2423a71cC17cf9810798F6C543#writeContract). In the "Write Contract" tab: - connect to your metamask account - use "3.transferThrough" and paste the value arrays from above @@ -107,9 +108,7 @@ In the "Write Contract" tab: Running this curl command (it needs the checksummed safe address, which you can find it in your circles wallet and the hex data) ```shell=fish -curl -X POST " -https://relay.circles.garden/api/v2/safes/ -/transactions/estimate/" -H "Content-Type: application/json" -H "accept: application/json" -d '{ "safe": "", "data": "", "to": "0x29b9a7fBb8995b2423a71cC17cf9810798F6C543", "value": 0, "operation": 0, "gasToken": "0x0000000000000000000000000000000000000000" }' +curl -X POST "https://relay.circles.garden/api/v2/safes//transactions/estimate/" -H "Content-Type: application/json" -H "accept: application/json" -d '{ "safe": "", "data": "", "to": "0x29b9a7fBb8995b2423a71cC17cf9810798F6C543", "value": 0, "operation": 0, "gasToken": "0x0000000000000000000000000000000000000000" }' ``` returns the gas information like this: ```json @@ -125,6 +124,6 @@ returns the gas information like this: } ``` -The total gas is `safeTxGas + baseGas`. In the example above, the total gas is then `4.159.332` (which under the `12.500.000` gas per block limit). +The total gas is `safeTxGas + baseGas`. In the example above, the total gas is then `4.159.332` (which is under the gas per block limit). -The gas price is specified in Wei and is constant on the xDai network. +The [gas limit per block changes over time](https://gnosisscan.io/chart/gaslimit) and currently it's `30.000.000`. The [gas price](https://gnosisscan.io/chart/gasprice) is specified in Gwei and it fluctuates over time in Gnosis Chain (average is around 7 Gwei). From 765c8fd9a1fb3a7e7ab8996a17e780d76794dfd0 Mon Sep 17 00:00:00 2001 From: ele Date: Thu, 13 Apr 2023 21:49:23 +0200 Subject: [PATCH 2/3] Remove blank space --- docs/developers/tutorials/estimate-gas-cost.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/developers/tutorials/estimate-gas-cost.md b/docs/developers/tutorials/estimate-gas-cost.md index 4dc95dd..ed068e5 100644 --- a/docs/developers/tutorials/estimate-gas-cost.md +++ b/docs/developers/tutorials/estimate-gas-cost.md @@ -96,7 +96,7 @@ Then make sure there are no quotations in the elements list. 4. **Get the hex data for the transaction** -Now that you have the lists of `tokenOwnerAddresses`, `srcs`, `dests` and `amounts`, go to [the circles Hub on blockscout](https://gnosisscan.io/address/0x29b9a7fBb8995b2423a71cC17cf9810798F6C543#writeContract). +Now that you have the lists of `tokenOwnerAddresses`, `srcs`, `dests` and `amounts`, go to [the circles Hub on blockscout](https://gnosisscan.io/address/0x29b9a7fBb8995b2423a71cC17cf9810798F6C543#writeContract). In the "Write Contract" tab: - connect to your metamask account - use "3.transferThrough" and paste the value arrays from above From cacb594bfc4f2fbe84bb5dfe142b70b90c3666f1 Mon Sep 17 00:00:00 2001 From: ele Date: Thu, 13 Apr 2023 21:57:42 +0200 Subject: [PATCH 3/3] Update transfer-limitations-in-practice.mdx --- .../transfer-limitations-in-practice.mdx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/developers/transitive-transactions/transfer-limitations-in-practice.mdx b/docs/developers/transitive-transactions/transfer-limitations-in-practice.mdx index d9f4a7d..3a2ba62 100644 --- a/docs/developers/transitive-transactions/transfer-limitations-in-practice.mdx +++ b/docs/developers/transitive-transactions/transfer-limitations-in-practice.mdx @@ -25,16 +25,16 @@ Below is an example from criseth's pathfinder for transferring 1000 CRC between ## Gas limitations -Each transfer in a transitive transaction costs gas. Transactions made through [circles.garden](https://circles.garden) are paid for by the Circles Coop in Eth. In terms of CRC a small fee in circles is added for each transaction to "compensate" for this. +Each transfer in a transitive transaction costs gas. Transactions made through [circles.garden](https://circles.garden) are paid for by the Circles Coop in xDai. In terms of CRC a small fee in circles is added for each transaction to "compensate" for this. -On the Ethereum blockchain all contract calls or transactions end up inside a block. A block is either accepted or rejected on the blockchain. -All transactions in a transitive transaction should end up in the same block to make sure that all or none of the transfer steps go through. The maximum gas for a block is 12.500.000. This means that the total gas cost for a transitive transaction must not exceed this. +On Gnosis Chain all contract calls or transactions end up inside a block. A block is either accepted or rejected on the blockchain. +All transactions in a transitive transaction should end up in the same block to make sure that all or none of the transfer steps go through. The maximum gas for a block is 30.000.000. This means that the total gas cost for a transitive transaction must not exceed this. -In practice it is dangerous to get close to this limit. A transaction with a gas cost close to this limit might have to wait a very, very long time to fit into a block with other contract calls, because of how the Ethereum blockchain works. +In practice it is dangerous to get close to this limit. A transaction with a gas cost close to this limit might have to wait a very, very long time to fit into a block with other contract calls, because of how the Ethereum blockchains work. ## What this means in terms of number of transfer steps -Because of the limitations to the gas costs we have to set a maximum limit to the number of transfer steps in a transaction. This limit is currently set to 52. Here we explain why. +Because of the limitations to the gas costs we have to set a maximum limit to the number of transfer steps in a transaction. This limit is currently set to 40. Here we explain why. Following the steps in [this tutorial](../tutorials/estimate-gas-cost.md) gas costs for a number of hypothetical transactions were estimated. The results are displayed in this figure: