We have an event as follows :

event LogNewObject(address sender, bytes32 indexed id, bytes32 sub_states_types, bytes32 sub_states_values, address owner);

This event is called in following function :

function newObject(bytes32 _id, uint256 number_of_sub_states, bytes32[10] sub_states_types, bytes32[10] sub_states_values, address _owner) public returns(bool success) {

        uint256 counter=0;
        for(counter; counter < number_of_sub_states; counter++) {

            objectStructs[_id].state.sub_state[sub_states_types[counter]] = sub_states_values[counter];

            emit LogNewObject(msg.sender, _id, bytes32(sub_states_types[counter]), bytes32(sub_states_values[counter]), _owner);


        objectStructs[_id].owner = _owner;
        objectStructs[_id].isObject = true;


        return true;

I want to get the logs like remix as following picture shows :


For this purpose, I use following command :

contractInstance.events.LogNewObject({fromBlock: 0, toBlock: 'latest'}, function(error, event){ console.log(event); })

And I receive following output :

> contractInstance.events.LogNewObject({fromBlock: 0, toBlock: 'latest'}, function(error, event){ console.log(event); })
Subscription {
  id: null,
  callback: [Function],
   [ { fromBlock: '0x0',
       toBlock: 'latest',
       topics: [Array],
       address: '0xe1623aaf57fcbe260f022404c730ae32aebe39f6' } ],
  _reconnectIntervalId: null,
   { subscription: 
      { params: 1,
        inputFormatter: [Array],
        outputFormatter: [Function: bound ],
        subscriptionHandler: [Function: subscriptionHandler] },
     type: 'eth',
      RequestManager {
        provider: [HttpProvider],
        providers: [Object],
        subscriptions: {} } },
  subscriptionMethod: 'logs' }

As you see, the output is not as it's expected.

I used also the command proposed by user " Jitendra Kumar. Balla". However, I receive same output and not the output similar to the remix logs output as I uploaded its screen shot above in my question. I expect this output:

enter image description here

What option must be added to this command to receive an output similar to remix output logs which is shown in above picture ?

  • Try to use contractInstance.events.LogNewObject({fromBlock: 0, toBlock: 'latest'}, function(error, event){ console.log(JSON.stringify(event)); }) May 7, 2018 at 12:09
  • Which blockchain tools are u using ?
    – Majd TL
    Feb 6, 2021 at 15:53

1 Answer 1


I suggest you to use the eventEmitter structure which is easier to manage and do what you want to do :)

  • Thanks, I think I used same structure and command, isn't it ?
    – Questioner
    May 7, 2018 at 12:44
  • Where is your console.log or debugger breakpoint in your code?
    – oktapodia
    May 7, 2018 at 15:52

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.