0

Need to generate error cases for ether transfer to see how blockchain deals with these cases. But ethereum clients like metamask didn't allow sending ether higher than the balance. Tried the same with etherjs, didn't work.

Is there any way to force send ether higher than the account balance?

1 Answer 1

1

Not sure if it is similar to what you want to do but you can either write a script to transfer ether without Metamask OR write a smart contract that does not accept ether and then try to send ether to it with Metamask. Metamask will warn you that it will fail, but you can still do the transaction.

/* SPDX-License-Identifier: MIT */

pragma solidity ^0.8.6;

contract Test {
    receive() external payable {
        revert("Not supported");
    }

    fallback() external payable {
        revert("Not supported");
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.