1

I fetched the transaction receipts of a block and had some questions regarding some of the fields. If a transaction receipt shows the "to" field empty and a address in the "contractAddress" field, does it mean that the specified contract was created?

> AttributeDict({'blockHash':
> HexBytes('0x05578d94e81075639f393dd1252deda65c6ab244e399073b6ff946d26af0dce7'),
> 'blockNumber': 8945008, **'contractAddress':
> '0x0E3A2A1f2146d86A604adc220b4967A898D7Fe07'**, 'cumulativeGasUsed':
> 9263902, 'from': '0xef536c805482FeB3D838426ED48320f77FD5F82b',
> 'gasUsed': 6928008, 'logs': [AttributeDict({'address':
> '0x0E3A2A1f2146d86A604adc220b4967A898D7Fe07', 'topics':
> [HexBytes('0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0'),
> HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000'),
> HexBytes('0x000000000000000000000000ef536c805482feb3d838426ed48320f77fd5f82b')],
> 'data': '0x', 'blockNumber': 8945008, 'transactionHash':
> HexBytes('0xc599d6ea2e6d4bd9d908f887a46040338105c20d2e8a08bc457b75180a660f17'),
> 'transactionIndex': 28, 'blockHash':
> HexBytes('0x05578d94e81075639f393dd1252deda65c6ab244e399073b6ff946d26af0dce7'),
> 'logIndex': 38, 'removed': False})], 'logsBloom':
> HexBytes('0x00000002000000000000000000000000000000000000000000800000000000000002000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000001000000000000000000400000000000000000020000000000000000000800000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000001000000020000000000000000000000000000000000000000000000000000000000000000000'),
> 'status': 1, **'to': None**, 'transactionHash':
> HexBytes('0xc599d6ea2e6d4bd9d908f887a46040338105c20d2e8a08bc457b75180a660f17'),
> 'transactionIndex': 28})

Also, what if no address is specified under contractAddress and an empty logs field is shown. What do these two scenarios show? If logs array is empty but we do have input data then what is the difference in the type of data between these two? From what I understand logs[] contains events information but input data contains information about the method called. Am i right?




> AttributeDict({'blockHash':
> HexBytes('0x05578d94e81075639f393dd1252deda65c6ab244e399073b6ff946d26af0dce7'),
> 'blockNumber': 8945008, **'contractAddress': None**,
> 'cumulativeGasUsed': 9284902, 'from':
> '0xddcca96aF7Ff342f9a945f2430D1d6162CA05BeA', 'gasUsed': 21000,
> **'logs': []**, 'logsBloom': HexBytes('0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'),
> 'status': 1, 'to': '0x400592202fC8b27Cc4bC19a88D00dCA590e77799',
> 'transactionHash':
> HexBytes('0x5d7ea4017967e5a190cf283f04675f7b15fd8218b25db20a13f3747181d9ce9c'),
> 'transactionIndex': 29})```
2

If a transaction receipt shows the to field empty and an address in the contractAddress field, does it mean that the specified contract was created?

Yes, it implies that a contract was deployed at the address specified in the contractAddress field. And the exact opposite implies that the transaction was sent to a contract which has already been deployed at the address specified in the to field.

Also, what if no address is specified under contractAddress and an empty logs field is shown?

As mentioned above, the transaction was sent to a contract which has already been deployed. And the fact that the logs field is empty implies that no events were emitted during the transaction.

| improve this answer | |
2

If the to field is empty it is most likely a transaction that deployed the smart contract, found in the contractAddress.

logs contain emitted events from Solidity. You can match them to actual ABI events using web3.py Contract API.

logs are optional. Smart contracts may not emit them and they are not present in account to account transfers.

Hope this helps.

| improve this answer | |

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.