> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstream.io/llms.txt
> Use this file to discover all available pages before exploring further.

# 区块与交易

> Blocks、Transactions、Events、Calls 以及其他基础设施 Cubes 的查询示例

## 概述

本页提供区块链基础设施相关 Cube 的查询示例 — 涵盖区块、交易、智能合约事件与内部 trace 等基础数据。

***

## 区块

### 最新区块（Solana）

```graphql theme={null}
query {
  Solana {
    Blocks(limit: {count: 10}, orderBy: {descending: Block_Time}) {
      Block {
        Time
        Slot
        Height
        Hash
        ParentSlot
        TxCount
      }
    }
  }
}
```

### 最新区块（Ethereum）

```graphql theme={null}
query {
  EVM(network: eth) {
    Blocks(limit: {count: 10}, orderBy: {descending: Block_Time}) {
      Block {
        Time
        Number
        Hash
        GasUsed
        GasLimit
        BaseFee
        TxCount
        Coinbase
      }
    }
  }
}
```

***

## 交易

### 按地址查询近期交易（Solana）

```graphql theme={null}
query {
  Solana {
    Transactions(
      signer: {is: "WALLET_ADDRESS"}
      limit: {count: 20}
      orderBy: {descending: Block_Time}
    ) {
      Block { Time Slot }
      Transaction {
        Signature
        Fee
        FeePayer
        Result { Success }
      }
    }
  }
}
```

### 按地址查询近期交易（EVM）

```graphql theme={null}
query {
  EVM(network: eth) {
    Transactions(
      fromAddress: {is: "0xWALLET_ADDRESS"}
      limit: {count: 20}
      orderBy: {descending: Block_Time}
    ) {
      Block { Time Number }
      Transaction {
        Hash
        From
        To
        Value
        Gas
        GasPrice
      }
    }
  }
}
```

***

## 事件（仅 EVM）

### 按合约与 Topic 过滤事件

```graphql theme={null}
query {
  EVM(network: eth) {
    Events(
      contractAddress: {is: "0xCONTRACT_ADDRESS"}
      limit: {count: 20}
      orderBy: {descending: Block_Time}
    ) {
      Block { Time Number }
      Transaction { Hash }
      Log {
        SmartContract
        Index
        Signature { Name Signature }
        Data
      }
    }
  }
}
```

### 按事件签名（Topic0）过滤

```graphql theme={null}
query {
  EVM(network: eth) {
    Events(
      topic0: {is: "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"}
      limit: {count: 10}
      orderBy: {descending: Block_Time}
    ) {
      Block { Time }
      Transaction { Hash }
      Log { SmartContract Index Data }
    }
  }
}
```

***

## 调用 / Trace（仅 EVM）

### 对某合约的内部调用

```graphql theme={null}
query {
  EVM(network: eth) {
    Calls(
      toAddress: {is: "0xCONTRACT_ADDRESS"}
      limit: {count: 20}
      orderBy: {descending: Block_Time}
    ) {
      Block { Time Number }
      Transaction { Hash }
      Call {
        From
        To
        Opcode
        Value
        Gas
        GasUsed
        Signature { Name }
      }
    }
  }
}
```

***

## 指令（仅 Solana）

### 某程序的近期指令

```graphql theme={null}
query {
  Solana {
    Instructions(
      programId: {is: "PROGRAM_ADDRESS"}
      limit: {count: 20}
      orderBy: {descending: Block_Time}
    ) {
      Block { Time Slot }
      Transaction { Signature }
      Instruction {
        Index
        Depth
        Program { Address Name Method }
        Accounts
      }
    }
  }
}
```

***

## 奖励（仅 Solana）

### 验证者的质押奖励

```graphql theme={null}
query {
  Solana {
    Rewards(
      address: {is: "VALIDATOR_ADDRESS"}
      limit: {count: 50}
      orderBy: {descending: Block_Time}
    ) {
      Block { Time Slot }
      Reward {
        Address
        Amount
        AmountInUSD
        PostBalance
        RewardType
        Commission
      }
    }
  }
}
```

***

## 矿工奖励（仅 EVM）

### 区块奖励构成

```graphql theme={null}
query {
  EVM(network: eth) {
    MinerRewards(
      limit: {count: 20}
      orderBy: {descending: Block_Time}
    ) {
      Block { Time Number }
      Reward {
        Miner
        TotalReward
        TotalRewardInUSD
        StaticReward
        DynamicReward
        TxFees
        BurntFees
      }
    }
  }
}
```

***

## 相关文档

<CardGroup cols={2}>
  <Card title="数据 Cube" icon="cubes" href="/cn/graphql/schema/cubes">
    所有 Cube（含 Blocks、Transactions、Events、Calls）的详细字段结构。
  </Card>

  <Card title="链分组" icon="layer-group" href="/cn/graphql/schema/chain-groups">
    了解 EVM 与 Solana 分别提供哪些 Cube。
  </Card>
</CardGroup>
