/r/ethdev

Photograph via snooOG

Ethereum-related dev talk:

Contracts, DApps, Wallets, Clients, Infrastructure, Tooling, UIs, Patterns, and others.

Ethereum Development and DApps

No specific rules are enforced apart from the normal global reddit rules.

Search our history

Testnet Ethers

Updated faucets for 2022:

https://goerlifaucet.com (new since March)

Goerli Github Request Issue

https://www.rinkebyfaucet.com

Updated faucet for 2021:

https://faucets.chain.link/

Older faucets (some might be broken):

For Rinkeby, Ropsten, Kovan, Goerli Testnet Ethers: Get them here and here

For more Görli Testnet Ethers: Get them here

For more Ropsten Testnet Ethers: Get them here

Other subreddits

http://ethereum.stackexchange.com/ - The Ethereum Programming Stack Exchange

r/EthDevJobs - To find Jobs, and posting you're Hiring

r/ethereum - Offical sub, for discussion of Tech and Application Development using Ethereum.

r/ethfinance - A community for investors, traders, users, developers, and others to discuss Ethereum and its cryptocurrency ETH.

r/ethtrader - Trading sub, for price discussion of Ether and other cryptocurrencies

r/ethstaker - About staking your ETH: help and guidance

r/EtherMining - Ether Mining discussion.

r/ethereumnoobies - Ethereum for newbies

Others: r/ethtraderpro, r/cryptocurrency

/r/ethdev

110,643 Subscribers

5

Ethereum Arbitrage Transaction Reverted but Still Included in Block - Seeking Advice

I’ve run into a perplexing issue with my Ethereum arbitrage transactions, and I’m hoping to get some insights from the community.

Currently, I’m executing arbitrage strategies by sending transactions through Flashbots bundles directly to private nodes (such as beaverbuild.org). Recently, I encountered a situation where one of my arbitrage orders, which was supposed to be handled exclusively by private nodes, reverted but still got included in the blockchain.

Here’s the setup:

I use an increased gas price to pay the bribe, meaning that even if the transaction reverts, the node still receives some compensation.

My understanding was that if a transaction reverts, it should not be included in a block, especially when using private nodes for MEV purposes.

However, contrary to this assumption, a reverted transaction was still included on-chain, and I’m trying to figure out why.

My questions are:

1 . Is this a configuration issue with the node operator, or is it something that can occur when using Flashbots to send bundles?

2 . What strategies can I implement to avoid this situation? Should I add extra validation logic in my contract?

Has anyone else experienced similar issues, particularly when using beaverbuild.org or other similar nodes?

4 Comments
2024/08/25
10:50 UTC

2

Base sepolia

Hi all,

Please excuse my ignorance and if the question is silly, but I am new to layer 2, I used to use Infura to listen for transactions, now I want to do the same with Base, but base.org doesn't seem to have a websocket url, am I missing something?

My application needs do certain things when a user makes a deposit, how can I achieve this?

TIA

3 Comments
2024/08/24
15:28 UTC

1

Solidity counting decimals

Im implementing division logic in my smart contract where i take an amount of tokens and divide it by a number up to 120. There are cases where the result's decimal places are more than the token's decimal places. example: A token that only has 6 decimal places. 0.123456 / 100 = 0.00123456 the result has 8 decimals while the token only allows 6. In other coding languages we can count the number of characters after the dot and work with it. This is not possible with soldity. Is there any way to know how many decimal places a uint256 will be. The amount is variable could be any amount, and the division amount is between 1-120.

7 Comments
2024/08/24
09:17 UTC

2

Ethereum's Dominance and Key Financial Movements

We recently (from 14th August to 21 August 2024) dug into some fascinating data surrounding blockchain networks and their associated financial metrics, focusing on staking, pooled investments, and borrowing. Here’s what we found:

Ethereum's Commanding Presence:

  • Ethereum remains a giant with $242,209.20 in total on-chain value.
  • Notably, it has a whopping $21,190,386.18 in borrowed assets and the highest staking value at $4,177,451.16.

Top Holdings:

  • Tether Gold holds the top spot on Ethereum with a massive $617,841,741.09.
  • Blackrock Buidl also shows a strong Ethereum presence at $503,171,839.14.

Major Borrowers:

  • Centrifuge: $279,000,732.15 borrowed.
  • Goldfinch: $71,965,864.28 borrowed.

Cross-Chain Activity:

  • Ondo Finance has a presence across multiple chains (Polygon, Mantle, Noble, Ethereum, Sui, Aptos, Solana), though it shows no staking or borrowing activity.

Staking Insights:

Mantra DAO exhibits a diverse staking strategy with substantial figures across Polygon, Binance, and Ethereum.

The data underscores Ethereum's dominance in the blockchain space, particularly in staking and borrowing. For a more detailed analysis or to track trends over time, historical data would be necessary. Stay tuned as we continue to explore these financial movements and their implications on the DeFi ecosystem.

🔗 Join the conversation below and let us know your thoughts! How do you see these trends evolving? For more information, you can visit us at https://verified.network/ or reach out to us at https://x.com/veridefi

1 Comment
2024/08/23
12:38 UTC

1

Help: Fiat-to-Crypto Subscriptions

Has anyone here used any fiat to subscriptions method that doesn't use Stripe, I've been looking for a fiat on-ramp solution which charges the card every months sends it out in crypto

2 Comments
2024/08/22
12:31 UTC

2

How can I prepare for a role that requires practical experience with the EVM?

I'm a backend developer with experience in higher-level blockchain technologies, such as smart contracts and web3 integration. However, I'm interested in transitioning to a more low-level role in distributed systems. I've been studying technologies like libp2p and CometBFT, but I've noticed that many positions in this area require not just theoretical knowledge of the Ethereum Virtual Machine (EVM), but also practical experience. How can I best prepare myself for such a role?

5 Comments
2024/08/22
10:04 UTC

0

can a expert reveiw this smart contract and tell me what could be wrong with it

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;

import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IWETH.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface ISushiSwapRouter {
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);

    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
}

contract Arbitrage is ReentrancyGuard {
    address public owner;
    IUniswapV2Router02 public uniswapRouter;
    ISushiSwapRouter public sushiswapRouter;
    IWETH public weth;
    address public fixedTokenAddress;
    bool public running;
    bool public paused;

    event ArbitrageStarted();
    event ArbitrageStopped();
    event TokensWithdrawn(address token, uint256 amount);
    event ArbitrageExecuted(address[] path, uint amountIn, uint amountOutMin, bool isUniswapToSushiswap);

    modifier onlyOwner() {
        require(msg.sender == owner, "Not the contract owner");
        _;
    }

    modifier whenNotPaused() {
        require(!paused, "Contract is paused");
        _;
    }

    constructor(
    ) {   
        owner = msg.sender;
        uniswapRouter = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // Uniswap V2 Router address on Ethereum Mainnet
        sushiswapRouter = ISushiSwapRouter(0x6B3595068778DD592e39A122f4f5a5cF09C90fE2); // Sushiswap Router address on Ethereum Mainnet
        weth = IWETH(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); // WETH address on Ethereum Mainnet
        fixedTokenAddress = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // WETH as the fixed token
        running = false;
        paused = false;
    }

    function start() external onlyOwner {
        running = true;
        emit ArbitrageStarted();
    }

    function stop() external onlyOwner {
        running = false;
        emit ArbitrageStopped();
    }

    function pause() external onlyOwner {
        paused = true;
    }

    function unpause() external onlyOwner {
        paused = false;
    }

    address public constant TOKEN_ADDRESS = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // Define the token address

    function withdraw() external onlyOwner {
        uint256 balance = IERC20(TOKEN_ADDRESS).balanceOf(address(this));
        require(balance > 0, "Insufficient token balance");
        IERC20(TOKEN_ADDRESS).transfer(owner, balance);
        emit TokensWithdrawn(TOKEN_ADDRESS, balance);
    }

    function approveToken(address token, address spender, uint256 amount) external onlyOwner {
        IERC20(token).approve(spender, amount);
    }

    function wrapETH() external payable onlyOwner {
        weth.deposit{value: msg.value}();
    }

    function unwrapWETH(uint256 amount) external onlyOwner {
        weth.withdraw(amount);
    }

    function executeArbitrage(
        address[] calldata path,
        uint amountIn,
        uint amountOutMin,
        uint deadline,
        bool isUniswapToSushiswap
    ) external onlyOwner nonReentrant whenNotPaused {
        require(running, "Arbitrage is not running");
        require(path.length >= 2, "Invalid path length");

        uint initialBalance = IERC20(path[0]).balanceOf(address(this));

        _executeSwap(path, amountIn, amountOutMin, deadline, isUniswapToSushiswap);

        uint finalBalance = IERC20(path[0]).balanceOf(address(this));
        require(finalBalance > initialBalance, "Arbitrage not profitable");

        emit ArbitrageExecuted(path, amountIn, amountOutMin, isUniswapToSushiswap);
    }

    function _executeSwap(
        address[] calldata path,
        uint amountIn,
        uint amountOutMin,
        uint deadline,
        bool isUniswapToSushiswap
    ) internal {
        uint[] memory amountsOut;
        address[] memory reversedPath;

        if (isUniswapToSushiswap) {
            // Swap on Uniswap first
            amountsOut = uniswapRouter.getAmountsOut(amountIn, path);
            require(amountsOut[amountsOut.length - 1] >= amountOutMin, "Slippage too high");
            uniswapRouter.swapExactTokensForTokens(amountIn, amountOutMin, path, address(this), deadline);

            // Reverse path for Sushiswap
            reversedPath = reversePath(path);
            amountsOut = sushiswapRouter.getAmountsOut(amountsOut[amountsOut.length - 1], reversedPath);
            require(amountsOut[amountsOut.length - 1] >= amountOutMin, "Slippage too high");
            sushiswapRouter.swapExactTokensForTokens(amountsOut[amountsOut.length - 1], amountOutMin, reversedPath, address(this), deadline);
        } else {
            // Swap on Sushiswap first
            amountsOut = sushiswapRouter.getAmountsOut(amountIn, path);
            require(amountsOut[amountsOut.length - 1] >= amountOutMin, "Slippage too high");
            sushiswapRouter.swapExactTokensForTokens(amountIn, amountOutMin, path, address(this), deadline);

            // Reverse path for Uniswap
            reversedPath = reversePath(path);
            amountsOut = uniswapRouter.getAmountsOut(amountsOut[amountsOut.length - 1], reversedPath);
            require(amountsOut[amountsOut.length - 1] >= amountOutMin, "Slippage too high");
            uniswapRouter.swapExactTokensForTokens(amountsOut[amountsOut.length - 1], amountOutMin, reversedPath, address(this), deadline);
        }
    }

    function reversePath(address[] calldata path) internal pure returns (address[] memory) {
        uint length = path.length;
        address[] memory reversed = new address[](length);
        for (uint i = 0; i < length; i++) {
            reversed[i] = path[length - 1 - i];
        }
        return reversed;
    }

    function emergencyWithdraw() external onlyOwner {
        uint256 balance = IERC20(fixedTokenAddress).balanceOf(address(this));
        require(balance > 0, "Insufficient token balance");
        IERC20(fixedTokenAddress).transfer(owner, balance);
        emit TokensWithdrawn(fixedTokenAddress, balance);
    }

    function fundGas() external payable onlyOwner {
        // Function to fund the contract with ETH for gas fees.
    }

    // To receive ETH
    receive() external payable {}
}
16 Comments
2024/08/22
05:30 UTC

0

Liquid restaking platform - CTO needed!

Hey all,

We are building a Liquid Restaking Token (LRT) and Strategy Manager for EigenLayer (and other assets) and are looking for a technically experienced and motivated CTO candidate with a passion for blockchain technology and ideally DeFi to take join the team.

The ideal candidate will be a detail-oriented developer with a passion for delivering high-quality, scalable solutions and a strong curiosity for innovation in the DeFi space. In this role you will be developing the Back-end and Frontend Application, creating new smart-contracts and integrating smart-contracts to our protocol, be responsible for all back-end integrations (e.g. with other DeFi protocols, node operators, AVSs, etc.) and more. You will also have the opportunity to shape the technical and product roadmap.

Stage: Testnet is 90% done - the new CTO will need to finish it fully and add the next product will need to be built before we do the fundraising.

If you would be interested or know someone, please shoot me a DM.

Much appreciated, Thank you.

7 Comments
2024/08/21
16:11 UTC

2

Creating a browser extension that helps X / Twitter users write notes about other users that they can view later (eg a reminder of who that person is or good / bad things they've done in the past). Is there any good on-chain functionality that I could add to it?

I'm writing a browser extension where you (an X user) can write notes about other users and view those notes later. This can help users keep track of who people are that are in their feed, and remind themselves of anything relevant they think that they should know about that user. I am curious if there is any good web3 functionality that I could implement for this, beyond the obvious like allowing users to connect their EVM accounts for sending and receiving or displaying NFTs owned by a user who connects / registers their account with our system.

I may take a look into soul-bound tokens but I was curious if there is any web3 functionality that I could add to the extension to make the tool more useful. What do you guys think?

1 Comment
2024/08/21
15:45 UTC

0

Integrating Cartesi Rollups with Chronicle Oracles

Explore this exciting new building opportunity! Unleash the power of secure and immutable data delivery with Chronicle Oracles, combined with Cartesi Rollups running complex computations off-chain in a Linux environment.

A step-by-step guide is provided for developers leveraging oracle data in their Cartesi Rollup applications. A reusable template is included in the article to help you deliver your own applications. Building explorations just keep getting better, don't they?

https://medium.com/@souza.mvsl/integrating-cartesi-rollups-with-chronicle-oracles-67b671613edcExplore

0 Comments
2024/08/20
18:43 UTC

1

Hardhat ignition will the cintract persist?

For example Today i do hardhat ignition ... When i run hardhat node

Is the contract and the data in the block chain still persist?

3 Comments
2024/08/20
13:36 UTC

2

Any way to live sync fork with hardhat/ganache

I'm a newbie dev to blockchain and I was wondering that, is there any way to live sync fork with hardhat or ganache ?

4 Comments
2024/08/20
11:18 UTC

2

Need Help Implementing an Existing Contract’s Token Interface into My Smart Contract

Hello everyone,

I’m currently working on a smart contract project and I need to integrate an existing token interface from another contract. I’m fairly new to this and would appreciate if someone could guide me through the process step by step.

Here’s what I’m trying to do:

•	I want to interact with an existing token contract to perform operations like transferring tokens and checking balances within my contract.
•	I’m not sure how to correctly import and implement the interface of this existing token into my smart contract.

Could someone please explain how to:

1.	Import the token contract interface into my smart contract.
2.	Call functions from the token contract within my contract.
3.	Handle any permissions or approvals that might be necessary.

Any examples or resources you could share would be extremely helpful

4 Comments
2024/08/20
09:29 UTC

4

Why Exocore and Omnichain Restaking?

Reasonably Decentralized

"Exocore should be architecturally designed to be reasonably decentralized from inception."

From its technical architecture to its governance structure, Exocore is committed to real decentralization. It shouldn't be an afterthought added later.

Protocol Agnostic (Omnichain design)

"In unity, there’s strength."

As an L1 for omnichain restaking, Exocore extends an olive branch to all blockchain networks and ecosystems and embraces technological diversity.

Good design is intentional. All of Exocore's design decisions were guided by the first principles laid out in the Exocore Manifesto.

Here are three key principles from the Manifesto that explain the WHY of Exocore's design: Security first, Resonably decentralized and Protocol Agnostic.

11 Comments
2024/08/20
03:33 UTC

2

Start an archive node but from a specific block number in geth

Hey guys, I wanted to know if its possible to start an archive node from a specific block number (eg, block number from 1 year ago).
From what i read, there is partial/full archive.

partial archive can be done with snap sync but ill start from latest 128 blocks and act as archive from now on.

full archive starts from genesis.

But is it possible to configure geth to start partial archive from x block number or somewhere close to x instead of now?

10 Comments
2024/08/19
08:28 UTC

1

Web3 Builder News: 8/12-8/18

Week of 8/12-8/18:

Grants 🏅

-Coinbase Developer Platform Introduces AI Builder Program

Research 🧑‍🔬

-nero_eth Analyzes Timing Games on Ethereum's Consensus

Infra 🏗️

-OP Labs Plans to Bring Native Interoperability to the OP Stack

and more 👀

https://www.web3builder.news/web3-builder-news-08-12-24/

1 Comment
2024/08/19
08:12 UTC

22

The Problem Restaking Solves

"Developers just want to build the thing, launch it, and have it available everywhere... restaking provides the crypto-economic security for this to happen... the web3 equivalent of AWS will be powered by restaking."

Listen to Warpaul, the co-founder of Exocore's thoughts about this: https://twitter.com/ExocoreNetwork/status/1824594746104484292?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Etweet

10 Comments
2024/08/18
15:10 UTC

0

web3 Job Portal

web3jobPortal .com

0 Comments
2024/08/17
17:25 UTC

1

To create an NFT SQL database, is it best to create a massive database or one db per collection?

I am going to create a postgresql database for the purpose of making a NFT trading bot. The bot should be horizontally scalable, expecting it to accommodate to various NFT collections on active trading.

My question is should I set up the db to house all NFT from NFT collections of should each NFT collection be of its own db? If all in one db, will it slow down runtime?

9 Comments
2024/08/17
15:59 UTC

2

iterate through every smart contract

What type of ethereum client should I use so I can iterate through every Ethereum smart contract on the ethereum network? A Geth full node?

8 Comments
2024/08/16
16:37 UTC

2

How does Opensea Pro obtain real-time listing information from Blur.io without an API?

Blur doesn't have any public API/SDK, so how does Opensea Pro get their real-time listing information? Is it from web-scraping?

6 Comments
2024/08/16
15:33 UTC

0

Devnet participation for interested folks. [EVM based open sourced chain]

We are launching our devnet for an EVM based chain. I was curious if i can ask for developer participation here?

These are the components if anyone is interested:

Golden Age Compatible Devnet: Semi-closed devnet with a public RPC for developers to build & test before launch.

Quaiscan explorer: Major updates in UI, indexing, and support for the Golden Age devnet & Qi ledger.

Pelagus wallet: New Chrome extension with a sleek UI & full Golden Age support. Note: New addresses required!

Quais SDK: Completely overhauled with Golden Age Quai & Qi support.

Faucet: Redesigned to support Golden Age Quai token drips with added sybil resistance.

Not production-ready, so bugs may occur. If you find any, reach out via our Discord or Telegram. Users can seek support at Quai Network.

Please let me know if this is allowed here? I am willing to take down the post if not allowed.

4 Comments
2024/08/16
14:39 UTC

Back To Top