This is my contract:

pragma solidity ^0.4.22;

contract Test {
  event Deposit( address indexed from, uint amt );
  event Withdrawal( address indexed to, uint amt );

  address owner;

  constructor() public {
    owner = msg.sender;

  function Withdraw(uint amt) public {
    require(msg.sender == owner);
    emit Withdrawal(msg.sender, amt);

  function () payable external {
    emit Deposit(msg.sender, msg.value);


I use truffle v4.1.11 and Solidity v0.4.24

I run docker: run -d -p 8545:8545 trufflesuite/ganache-cli:latest -a 10 --debug

I connect with: truffle console

It connects, the contract deploys. And I can send like this:

{ tx:
   { transactionHash:
     transactionIndex: 0,
     blockNumber: 27,
     from: '0xb9cd57a299ebf2eca11435ed890d5de0717f2889',
     to: '0xd8f24367662cd76f0723271cfd6000ab3d317e40',
     gasUsed: 21040,
     cumulativeGasUsed: 21040,
     contractAddress: null,
     logs: [],
     status: '0x1',
     v: '0x1b',
      '0x23f68bc8533232aa113aeb0f2ba8e6425f2e0783bcbbc9e6cf825342890d0e73' },
  logs: [] }

It all works, but you will notice that logs is empty - why was the Deposit event not emitted?


Seeing as nobody else is answering, I could provide you with an answer of some sorts.

First things first: your contract is not valid with the compiler version you are implying in the code (0.4.22) - keyword constructor did not exist back then and you had to use constructors in a different way. But, I see you are in reality using 0.4.24 so all's fine.

If you put the code in Remix everything works just fine. However, Remix gives gas usage of 22489 instead of your 21040.

So my best guess is that the transaction is faulty in some way. It succeeded (status 0x1) but something isn't right. Or perhaps your ganache is too old or something? Or maybe running it in docker interferes with something?

Unfortunately I can't give you a more definite answer, but hopefully it's better than nothing.


Code runs fine and does emit an event on Remix IDE. I had to change pragma solidity to 0.5.0, though. Try the following:

  • Update truffle to v5.

  • Change pragma solidity to ^0.5.0.

  • Run a locally installed ganache cli (e.g npm install -g ganache-cli).

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.