Long story short I need a way to send programmatically a raw transaction without any bounds checkings or any checks...now I am not trying to abuse or flood the network - my goal is to attempt to send several (~50) gasless transactions to see if any of them will get mined, aka similar to the economic abstraction on eos.

I know web3 isn't against this but I need a way where no encoded output is checked before sending it to nodes. I've no idea how myetherwallet works with their gui-friendly interface and web3 is the only way that I know of where I have more control, I guess installing old version of web3 will get me closer to my goal?

Obviously I want to send ether on the blockchain, not just do something simple as with querying a contract balance etc. Thanks!

  • To my understanding, web3 is a protocol of interacting between client and server, where the server is an Ethereum Node (also referred to - unfortunately in this context - as Ethereum Client). web3.js is an implementation (one of several different implementations, e.g., web3j) of the client-side functionality of this protocol. – goodvibration Oct 30 '19 at 18:18

Web3 will interact with an Ethereum node (usually Geth or Parity), and the node is the one in charge of broadcasting the transaction to the network.

my goal is to attempt to send several (~50) gasless transactions to see if any of them will get mined

Setting the gas to 0 will make the node reject your transaction. I just tried because I was curious as well, and here's the code in python:

from web3.auto import w3

    trx = w3.eth.sendTransaction({
        'from': w3.eth.accounts[0],
        'to': w3.eth.accounts[1],
        'gas': 0,
        'value': int(1e16),
except Exception as e:
    print(f'Transaction {trx.hex()} successfully processed by a node.')

It prints the following:

{"message": "base fee exceeds gas limit", "code": -32000, "data": {"stack": "Error: base fee exceeds gas limit......."}

If I remove the line where gas is specified it works perfectly fine.

  • Gotcha...but isn't the node that takes it first also operating web3? In other words say someone sends a very ill-formed raw transaction of just string of 0, obviously this will never be written to the blockchain but curious how it can pass sending to a node. Btw: via myetherwallet you get that transaction may get mined...but it never really does (sending gasless that is...). – Robert Ggg Oct 30 '19 at 18:14
  • No, Web3 is for clients only. Nodes operate differently with custom code each one. Parity is written in Rust, uses its own stuff, which is totally different from Geth, written in Golang. They act aggressively against transactions that are either malformed or that will never be able to reach consensus. There are two reasons: all miners will reject the transaction because they wouldn't be able to mine a block with it (it'd be rejected by the validators), and secondly for the sake of the network so that it's not polluted with pointless transactions. – Molina Oct 30 '19 at 18:19
  • That being said, both clients are open source, so feel free if you want to modify the code to broadcast to the network whatever you send to them, ignoring all checks. – Molina Oct 30 '19 at 18:20
  • So shodan just confirmed what you said that most nodes run Geth/Parity: shodan.io/search?query=port%3A8545+ , I don't see much info other than the compiler version...I am also curious what will happen when I send shorter raw transaction missing the gas part too. – Robert Ggg Oct 30 '19 at 18:25
  • They will all be rejected... or there's a bug on the nodes! Nodes exhaustively make sure everything is perfectly OK before broadcasting transactions, and specially when validating other miner's blocks or their owns. This is of course something very good, since otherwise people wouldn't trust on Ethereum, and for good reasons. – Molina Oct 30 '19 at 18:30

Metamask injects web3 provider onto the normal browser so that it can connect to the ethereum network


Using web3.js / web3.php / web3.py / etc all you have to do is submit a transaction with "gasPrice" as 0, not "gas" 0.

Gas is the amount of "resources" a transaction can use before running out, and you use it to limit execution.

GasPrice is what you're willing to pay for said execution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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