跳转到主要内容

参数

blockhash
string
必填
要验证的 blockhash(base-58 编码)
config
object
包含以下内容的配置对象:
commitment
string
Commitment 级别(processed、confirmed、finalized)
minContextSlot
number
请求可被评估的最小 slot

响应

result
boolean
blockhash 是否仍然有效(true)或无效(false)

代码示例

基本请求

使用 web3.js

注意事项

  1. 返回 blockhash 是否仍然有效
  2. blockhash 在经过一定数量的 slot 后会过期
  3. 响应是即时的,因为它从当前状态读取
  4. 无效的 blockhash 不能在交易中使用
  5. blockhash 必须是 base-58 编码的

最佳实践

  1. 根据需求使用适当的 commitment 级别
  2. 在适当时缓存结果以减少 RPC 负载
  3. 在发送交易之前检查 blockhash 有效性
  4. 考虑使用 WebSocket 订阅获取实时更新
  5. 适当处理网络错误并重试

常见错误

用例

  1. Blockhash 验证
  2. Blockhash 监控
  3. 交易规划