Solana RPC API手册

在线工具推荐: Three.js AI纹理开发包 - YOLO合成数据生成器 - GLTF/GLB在线编辑 - 3D模型格式在线转换 - 可编程3D场景编辑器

getBalance

getBalance方法返回指定公钥对应账号的余额。

请求参数

  • <string> - 要查询账号的公钥,base-58编码字符串
  • <object> - (可选) Commitment

返回结果

getBalance方法返回RpcResponse JSON对象,value字段为账号余额,类型为u64。

示例代码

请求:

curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
  {"jsonrpc":"2.0", "id":1, "method":"getBalance", "params":["83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri"]}

响应:

{"jsonrpc":"2.0","result":{"context":{"slot":1},"value":0},"id":1}