1

I have a Smart Contrat where there is some events like bellow :

    MyContract {

   event CustomerDataSendingToSeller(address _seller, string _hasheCustomerData, uint256 _orderSeq);

     function SigneCustomerDataToSell(string _hasheCustomerData) public {

            require(seller != msg.sender);

            customer = msg.sender;

            DataExchangeSeq++;

            DataExchanges[DataExchangeSeq] = DataExchange(customer,_hasheCustomerData,0,0,DataExchangeSeq,0,Buyer(0,"0x",false,false),false);

            emit CustomerDataSendingToSeller(seller,_hasheCustomerData, DataExchangeSeq);

        }

}

Then I passed my the Smart Contract function as transaction after deployement, and I check the transaction receipt, I saw that there is only one args instead of my three args in the Smart Contract.

Here the output of the transaction receipt function : w3.eth.getTransactionReceipt(tx_hash)

        AttributeDict({
        'transactionHash':HexBytes('0xee50268e0c525cdee61fa58b1459a74915d7ac25ca72ebdb06065c3bd03a8f73'), 
        'transactionIndex': 0, 
        'blockHash':HexBytes('0x2ddd79c415277e02dc51c649f3463085a8043b87bb7067e3da81062cf608357c'), 
        'blockNumber': 97, 
        'gasUsed': 93882, 
        'cumulativeGasUsed': 93882, 
        'contractAddress': None, 
        'logs': 
          [AttributeDict({
          'logIndex': 0, 
          'transactionIndex': 0,         'transactionHash':0xee50268e0c525cdee61fa58b1459a74915d7ac25ca72ebdb06065c3bd03a8f73', 'blockHash':'0x2ddd79c415277e02dc51c649f3463085a8043b87bb7067e3da81062cf608357c', 'blockNumber': 97, 
'address': '0xAAe858AE95DE4eA7acE44Bc58bBB27C331e6dc0d',     'data':'0x0000000000000000000000000db7fec9d38cb5a3e789228f93ac0b27cb25d24d00000000000000, 
'topics': ['0xf9a97ac82c9d5863f1a327d99b2f678c53726ddea126435a5752717390af467b')], 'type': 'mined'})], 
'status': 1, 
'logsBloom':('0x0000000000004000000000000000000000000000000000000000000000000000000004')})

In the topics I should see my three hashed args, but only one is present and seems to be the hash of the event function itself, so why don't see the other ?

Thanks for help :)

1
  • What value you expect, will be returned for seller and DataExchangeSeq
    – Aniket
    Commented May 3, 2018 at 6:38

1 Answer 1

0

Your parameters are added as topic only if they‘re indexed (see indexed keyword in Solidity). Otherwise the parameters are put into the data field.

The topic that you see is the signature of the event. You can add up to 3 indexed parameters, i.e. together with the signature of the event, you can have up to 4 topics.

1
  • yes thanks ! I just had to read the documentation correctly ... thank you for your reply :)
    – Lbrth_BoC
    Commented May 3, 2018 at 8:04

Your Answer

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

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