# get\_transaction\_receipt\_by\_hash

根据交易哈希获取该交易的回执信息。

## 方法定义

```python
def get_transaction_receipt_by_hash(self, transaction_hash: _Hash32) -> Optional[TransactionReceiptData]
```

## 参数说明

| 参数                | 类型       | 说明   |
| ----------------- | -------- | ---- |
| transaction\_hash | \_Hash32 | 交易哈希 |

## 返回值

返回 TransactionReceiptData 对象,包含以下字段:

| 字段                           | 类型                           | 说明                     |
| ---------------------------- | ---------------------------- | ---------------------- |
| transaction\_hash            | HexBytes                     | 交易哈希                   |
| block\_number                | BlockNumber                  | 区块高度                   |
| transaction\_index           | int                          | 交易在区块中的索引              |
| transaction\_status          | int                          | 交易状态(1 成功,0 失败)        |
| transaction\_type            | int                          | 交易类型                   |
| action                       | str                          | 交易动作类型                 |
| sender                       | ChecksumAddress              | 发送者地址                  |
| to                           | ChecksumAddress              | 接收者地址                  |
| nonce                        | Nonce                        | 交易序号                   |
| value                        | Wei                          | 转账金额                   |
| gas\_used                    | int                          | 实际使用的 Gas              |
| gas\_limit                   | int                          | Gas 上限                 |
| gas\_price                   | Optional\[Wei]               | Gas 价格(EIP-155 交易)     |
| max\_fee\_per\_gas           | Optional\[Wei]               | 最大 Gas 费用(EIP-1559 交易) |
| max\_priority\_fee\_per\_gas | Optional\[Wei]               | 最大优先费用(EIP-1559 交易)    |
| effective\_gas\_price        | Optional\[Wei]               | 实际 Gas 价格              |
| contract\_address            | Optional\[ChecksumAddress]   | 部署的合约地址(仅合约创建交易)       |
| logs                         | Optional\[List\[LogReceipt]] | 交易日志                   |
| input\_data                  | HexBytes                     | 交易输入数据                 |
| r                            | HexBytes                     | 签名 r 值                 |
| s                            | HexBytes                     | 签名 s 值                 |
| v                            | HexBytes                     | 签名 v 值                 |

## 示例代码

```python
# 获取交易回执
receipt = chain.get_transaction_receipt_by_hash("0x...")
if receipt.transaction_status:
    print("Transaction Successful")
    print(f"Gas Used: {receipt.gas_used}")
    if receipt.contract_address:
        print(f"Deployed Contract: {receipt.contract_address}")
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://poseidon.seaeye.cn/evm/chain/get_transaction_receipt_by_hash.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
