The Rent is Too Damn High Part II

Further Explorations into Sending Money to Myself

Thomas Jay Rush
Aug 24 · 8 min read

This is the second article in a two-part series using TrueBlocks to explore the MetaMask Swap Router and how much it costs. Click here for part I.

Yes Dear…

In the previous article, I was discussing this transaction (as presented by the TrueBlocks front end in US dollars at the time of the transaction):

We were discussing the fact that, once one starts looking at one’s own transactions in US dollars, it becomes very obvious where one’s money is disappearing. (I mean going.) What is not so clear, however, is into which tiny spider holes that money falls.

In this article, we explore this issue more deeply using a really helpful aspect of TrueBlocks software: our command line.

Getting Started with the TrueBlocks Command Line

This article is not the place for instruction on how to use a Linux command line. Nor how to download and install TrueBlocks. We’ll assume you follow these instructions: https://docs.trueblocks.io/docs/prologue/installing-trueblocks/. Do so now and return when you’re ready…

Playing Around…

Assuming you’ve completed the above installation instructions, let’s try the following command:

chifra names -c trueblocks

You should get results similar to these (please help us improve our software by opening up an issue if you don’t).

tags        address       name
00-Active 0xf50...79b TrueBlocks Wallet 0xf503

Copy and paste the address (0xf503017d7baf7fbc0fff7492b751025c6a78179b) and type this command:

chifra transactions 13071849.239 --reconcile \
0xf503017d7baf7fbc0fff7492b751025c6a78179b --fmt json

You’ll get a JSONish blob of reconciliation information as we presented in the previous article:

{
"data": [
{
"blockNumber": 13071849,
"transactionIndex": 239,
"assetAddr": "0xf503017d7baf7fbc0fff7492b751025c6a78179b",
"assetSymbol": "ETH",
"begBal": "38.220952577792982227",
"gasCostOut": "0.004103324588246856",
"spotPrice": 3240.70642,
"priceSource": "uniswap",
"totalIn": "0.00000000000000000",
"totalOut": "0.004103324588246856",
"amountNet": "-0.004103324588246856",
"endBal": "38.216849253204735371",
"reconciled": true
},
{
"blockNumber": 13071849,
"transactionIndex": 239,
"assetAddr": "0x6b175474e89094c44da98b954eedeac495271d0f",
"assetSymbol": "DAI",
"begBal": "5188.943282141176871055",
"amountIn": "16003.446778836992430933",
"spotPrice": 1,
"priceSource": "stable-coin",
"endBalCalc": "21192.390060978169301988",
"totalIn": "16003.446778836992430933",
"totalOut": "",
"amountNet": "16003.446778836992430933",
"endBal": "21192.390060978169301988",
"reconciled": true
},
{
"blockNumber": 13071849,
"transactionIndex": 239,
"assetAddr": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"assetSymbol": "WETH",
"begBal": "44.165326226182661143",
"amountOut": "5.0000000",
"spotPrice": 3240.70642,
"priceSource": "uniswap",
"endBalCalc": "39.165326226182661143",
"totalOut": "5.0000000",
"totalOutLessGas": "5.0000000",
"amountNet": "-5.0000000",
"endBal": "39.165326226182661143",
"reconciled": true
}
]
}

There’s so much to notice here, it’s embarrassing…but…

You’ll notice the transactionIndex shows this transaction to be the 239th transaction of block 13,071,849. Note this, we will need it below.

You’ll notice the last item in each record says reconciled: true. This is where the green reconciliation dot we show on the front end comes from.

You’ll notice each record has a field called priceSource and for all but one of those records, that value says, uniswap. This records the source from which we get our pricing of the given token in US dollars — the other value for priceSource is stable-coin which means we can (if our users wish) peg this value to $1.00, thereby avoiding a query to the node. We will write a future article discussing exactly how we use UniSwap and stable coins soon.

You’ll question pegging DAI to 1.00 US dollar is legitimate. (We think it is, and if our users don’t they can always disable this optimization.) Do so, greatly speeds up the pricing calculations. So, for our purposes in this article, it’s fine.

You’ll notice we calculate spotPrice only to five decimal points — we figure what’s the point of going further when the final reporting is in US dollars anyway?

You’ll notice that the data actually denominates the values in their own native token. For example, the wETH reconciliation (the third record), says we transacted 5.0000 wETH. We do this to provide maximum flexibility to the consumer of the reconciliation. Think of these values as count of the number of tokens transacted.

Getting US Dollars from SpotPrice and Token Count

So, how do we get US dollars?

Simple — for each data item we multiply the spotPrice per token by the nTokens, which is the value in the data itself.

5.000 wETH times a spotPrice of 3,240.70642 = 16203.5321 which is the amount of wETH denominated in US dollars that we wanted to swap.

16,003.446778836992430933 DAI times 1.00 US dollar per DAI is the number of DAI we received from the swap.

And, finally, you’ll notice that there is an ‘unaccounted for’ difference between what we sent and what we got in return.

Some people call this slippage. This is not surprising, but it’s annoying and…“The rent is too high!”

I’m incredulous — it cost me 200.085321163007569 US dollars to swap money with myself in a completely programmatic way?

“The freaking rent is too damn high!”

Where Exactly Did the Money Go?

Being anal retentive, like my father, it wasn’t enough for me to know that I had spent $200.00. I wanted to know exactly where it went.

Let’s go back to the command line. Do this command:

chifra transactions 13071849.239 --uniq

This will return all the unique addresses that appear in the given transaction. You should get these results (we’ve cleaned this up, your result may vary):

bn.tx        addr
13071849.239 0xf503017d7baf7fbc0fff7492b751025c6a78179b
13071849.239 0x881d40237659c251811cec9c364ef91dc08d300c
13071849.239 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
13071849.239 0x6b175474e89094c44da98b954eedeac495271d0f
13071849.239 0x11ededebf63bef0ea2d2d071bdf88f71543ec6fb
13071849.239 0x74de5d4fcbf63e00296fd95d33236b9794016631
13071849.239 0x60594a405d53811d3bc4766596efd80fd545a270
13071849.239 0xdef1c0ded9bec7f1a1670819833240f027b25eff
13071849.239 0x3d1d55c23dfc759c5ae48500ca88ddf477b3c9e5
13071849.239 0x47f01db18a38261e4cb153bae6db7d3743acb33c
13071849.239 0xfffd8963efd1fc6a506488495d951d5263988d25

Let’s see if we can name them. Run chifra names against each address to get these results:

addr                                       name
0x11ededebf63bef0ea2d2d071bdf88f71543ec6fb Metamask Fees
0x6b175474e89094c44da98b954eedeac495271d0f Dai Stablecoin
0x60594a405d53811d3bc4766596efd80fd545a270 Uniswap V3: DAI
0x881d40237659c251811cec9c364ef91dc08d300c Metamask Swap Router
0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 Wrapped Ether
0xdef1c0ded9bec7f1a1670819833240f027b25eff 0x Exchange Proxy
0xf503017d7baf7fbc0fff7492b751025c6a78179b TrueBlocks Wallet
No results for 0x74de5d4fcbf63e00296fd95d33236b9794016631
No results for 0x3d1d55c23dfc759c5ae48500ca88ddf477b3c9e5
No results for 0x47f01db18a38261e4cb153bae6db7d3743acb33c
No results for 0xfffd8963efd1fc6a506488495d951d5263988d25

You’ll notice that four of the addresses are un-named. That’s not a problem. Obviously, TrueBlocks can’t know every name of every address. Also, just be aware that some of these “addresses” may not even be addresses — they may just appear to be addresses. This is why we frequently speak of appearances instead of addresses. Sometimes, during creation of our index, we simply cannot tell if something is an address or if it just appears to be an address, so we include it anyway. No harm. No foul.

If you look more closely at the named addresses, you’ll see that all but one make sense.

Obviously, the TrueBlocks wallet is present in the transaction.

Obviously also, DAI and wETH are present — this is what we were swapping.

The three routers and/or proxies also make sense (Uniswap, Metamask Swap Router, 0x Exchange). One must complete the swap somewhere, after all.

But, let’s start with the first item in the list: MetaMask Fees.

Let’s see what we can see. Run this command:

chifra transactions 13071849.239 --reconcile \
0x11ededebf63bef0ea2d2d071bdf88f71543ec6fb --fmt json

This is the same command we ran above, but now we’re showing the reconciliation for the MetaMask Fee wallet address. This command returns results similar to these:

{
"data": [
{
"blockNumber": 13071849,
"transactionIndex": 239,
"assetAddr": "0x11ededebf63bef0ea2d2d071bdf88f71543ec6fb",
"assetSymbol": "ETH",
"begBal": "1250.563288183878021420",
"amountIn": "",
"internalIn": "0.043750000000000000",
"spotPrice": 3240.70642,
"priceSource": "uniswap",
"totalIn": "0.043750000000000000",
"totalOut": "",
"amountNet": "",
"endBal": "1250.586983614757050983",
"reconciled": true
}
]
}

You’ll notice that the spotPrice is the same as the previous data. This is to be expected as this is the same transaction.

The amount the MetaMask Fee address took in during this transaction equals the spotPrice (3,240.70642 US dollars per ETH) multiplied by 0.043750000000000000 ETH which equates to 141.780905875 US dollars.

I don’t know about you, but that feels like a lot of money to me. My wife, after some Stephen Colberic finger tapping,

tells me that’s 87.5 basis points (we confirmed this number on MetaMask’s website).

She says she would have advised her clients to find a cheaper solution.

We did a quick and dirty calculation on the web to see how much it would cost us to exchange US dollars to Euro in the regular, old-fashioned, 200 year old FAIT system, and it was much lower. WTF!

We are in the process of writing a companion article to this series where we look at how much income the MetaMask Fees contract makes in a single day. Look for that.

What About the Rest?

The above calculations leave 58.304415288007569 still unaccounted for. Where did money that go? Looking at the above image, you can see we paid $13.30 to the miner in gas fees, leaving 45.004415288007569 that went to UniSwap and its liquidity providers. I’ll leave it as an exercise for the interested reader to dig deeper.

In any case, “The rent is too damn high!”

Conclusion

Alright, we admit it we punted on the final resolution above, but you get the idea: TrueBlocks is amazing.

Okay. I’m done. This article is too damn long.

Support Our Work

If you like this article or you simply wish to support our work go to our GitCoin grant https://gitcoin.co/grants/184/trueblocks. Donate to the next matching round. We get the added benefit of a larger matching grant. Even small amounts have a big impact.

If you’d rather, please send ETH or any other token to our public Ethereum address 0xf503017d7baf7fbc0fff7492b751025c6a78179b.

Thanks for reading…stay tuned for more.

Join Coinmonks Telegram Channel and learn about crypto trading and investing

Also, Read

Coinmonks

Coinmonks is a non-profit Crypto educational publication.