Solana 隐私环
getMerkleProofs
检索隐私状态树中承诺值的 Merkle 包含证明。
POST
/
v1
/
spr
/
getMerkleProofs
getMerkleProofs
curl --request POST \
--url 'https://devnet.helius-rpc.com/v1/spr/getMerkleProofs?api-key=' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": "1",
"method": "getMerkleProofs",
"params": {
"treeAccount": "33KVhbT4QtdQDrrrGwwThqD47Dh4Q6tA443t9jMNcWFN",
"leaves": [
"11111111111111111111111111111112"
]
}
}
'import requests
url = "https://devnet.helius-rpc.com/v1/spr/getMerkleProofs?api-key="
payload = {
"jsonrpc": "2.0",
"id": "1",
"method": "getMerkleProofs",
"params": {
"treeAccount": "33KVhbT4QtdQDrrrGwwThqD47Dh4Q6tA443t9jMNcWFN",
"leaves": ["11111111111111111111111111111112"]
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
jsonrpc: '2.0',
id: '1',
method: 'getMerkleProofs',
params: {
treeAccount: '33KVhbT4QtdQDrrrGwwThqD47Dh4Q6tA443t9jMNcWFN',
leaves: ['11111111111111111111111111111112']
}
})
};
fetch('https://devnet.helius-rpc.com/v1/spr/getMerkleProofs?api-key=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://devnet.helius-rpc.com/v1/spr/getMerkleProofs?api-key=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'jsonrpc' => '2.0',
'id' => '1',
'method' => 'getMerkleProofs',
'params' => [
'treeAccount' => '33KVhbT4QtdQDrrrGwwThqD47Dh4Q6tA443t9jMNcWFN',
'leaves' => [
'11111111111111111111111111111112'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://devnet.helius-rpc.com/v1/spr/getMerkleProofs?api-key="
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": \"1\",\n \"method\": \"getMerkleProofs\",\n \"params\": {\n \"treeAccount\": \"33KVhbT4QtdQDrrrGwwThqD47Dh4Q6tA443t9jMNcWFN\",\n \"leaves\": [\n \"11111111111111111111111111111112\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://devnet.helius-rpc.com/v1/spr/getMerkleProofs?api-key=")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": \"1\",\n \"method\": \"getMerkleProofs\",\n \"params\": {\n \"treeAccount\": \"33KVhbT4QtdQDrrrGwwThqD47Dh4Q6tA443t9jMNcWFN\",\n \"leaves\": [\n \"11111111111111111111111111111112\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://devnet.helius-rpc.com/v1/spr/getMerkleProofs?api-key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"id\": \"1\",\n \"method\": \"getMerkleProofs\",\n \"params\": {\n \"treeAccount\": \"33KVhbT4QtdQDrrrGwwThqD47Dh4Q6tA443t9jMNcWFN\",\n \"leaves\": [\n \"11111111111111111111111111111112\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"jsonrpc": "2.0",
"error": {
"code": 123,
"message": "<string>",
"data": {}
},
"result": {
"context": {
"blockTime": 123,
"slot": 1
},
"proofs": [
{
"leaf": "<string>",
"leafIndex": 1,
"merkleContext": {
"tree": "<string>",
"treeType": 1
},
"path": [
"<string>"
],
"root": "<string>",
"rootIndex": 1,
"rootSeq": 1
}
]
}
}{
"jsonrpc": "2.0",
"id": "<string>",
"error": {
"code": 123,
"message": "<string>",
"data": {}
}
}{
"jsonrpc": "2.0",
"id": "<string>",
"error": {
"code": 123,
"message": "<string>",
"data": {}
}
}{
"jsonrpc": "2.0",
"id": "<string>",
"error": {
"code": 123,
"message": "<string>",
"data": {}
}
}包含证明
提供同一状态树中的 1 到 1,000 个承诺值。每个叶子节点都必须编码一个 BN254 标量域元素。使用加密输出所返回的树和承诺值。证明的顺序与请求中叶子节点的顺序一致。 每个证明都包含同级path、leafIndex、root、rootSeq 和 rootIndex。对于状态树,rootSeq 是用于保证证明新鲜度的已完成 Solana 时隙。rootIndex 是根在 Solana 账户根历史记录中的位置;无法根据时隙计算得出。
如果已索引的根已从根历史记录中过期,请在索引器追上进度后重试。SDK 会为钱包操作处理证明组装。
请求参数
array
必填
编码为 base58 格式 32 字节 BN254 标量域元素的状态树承诺值。
string
必填
包含这些承诺值的状态树账户。
授权
你的 Helius API 密钥。
请求体
application/json
用于标识请求的 ID。
JSON-RPC 协议版本。
可用选项:
2.0 要调用的方法。必须与 URL 路径的最后一段匹配。
可用选项:
getMerkleProofs Show child attributes
Show child attributes
示例:
{
"treeAccount": "33KVhbT4QtdQDrrrGwwThqD47Dh4Q6tA443t9jMNcWFN",
"leaves": ["11111111111111111111111111111112"]
}
此页面对您有帮助吗?
⌘I
getMerkleProofs
curl --request POST \
--url 'https://devnet.helius-rpc.com/v1/spr/getMerkleProofs?api-key=' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": "1",
"method": "getMerkleProofs",
"params": {
"treeAccount": "33KVhbT4QtdQDrrrGwwThqD47Dh4Q6tA443t9jMNcWFN",
"leaves": [
"11111111111111111111111111111112"
]
}
}
'import requests
url = "https://devnet.helius-rpc.com/v1/spr/getMerkleProofs?api-key="
payload = {
"jsonrpc": "2.0",
"id": "1",
"method": "getMerkleProofs",
"params": {
"treeAccount": "33KVhbT4QtdQDrrrGwwThqD47Dh4Q6tA443t9jMNcWFN",
"leaves": ["11111111111111111111111111111112"]
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
jsonrpc: '2.0',
id: '1',
method: 'getMerkleProofs',
params: {
treeAccount: '33KVhbT4QtdQDrrrGwwThqD47Dh4Q6tA443t9jMNcWFN',
leaves: ['11111111111111111111111111111112']
}
})
};
fetch('https://devnet.helius-rpc.com/v1/spr/getMerkleProofs?api-key=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://devnet.helius-rpc.com/v1/spr/getMerkleProofs?api-key=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'jsonrpc' => '2.0',
'id' => '1',
'method' => 'getMerkleProofs',
'params' => [
'treeAccount' => '33KVhbT4QtdQDrrrGwwThqD47Dh4Q6tA443t9jMNcWFN',
'leaves' => [
'11111111111111111111111111111112'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://devnet.helius-rpc.com/v1/spr/getMerkleProofs?api-key="
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": \"1\",\n \"method\": \"getMerkleProofs\",\n \"params\": {\n \"treeAccount\": \"33KVhbT4QtdQDrrrGwwThqD47Dh4Q6tA443t9jMNcWFN\",\n \"leaves\": [\n \"11111111111111111111111111111112\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://devnet.helius-rpc.com/v1/spr/getMerkleProofs?api-key=")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": \"1\",\n \"method\": \"getMerkleProofs\",\n \"params\": {\n \"treeAccount\": \"33KVhbT4QtdQDrrrGwwThqD47Dh4Q6tA443t9jMNcWFN\",\n \"leaves\": [\n \"11111111111111111111111111111112\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://devnet.helius-rpc.com/v1/spr/getMerkleProofs?api-key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"id\": \"1\",\n \"method\": \"getMerkleProofs\",\n \"params\": {\n \"treeAccount\": \"33KVhbT4QtdQDrrrGwwThqD47Dh4Q6tA443t9jMNcWFN\",\n \"leaves\": [\n \"11111111111111111111111111111112\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"jsonrpc": "2.0",
"error": {
"code": 123,
"message": "<string>",
"data": {}
},
"result": {
"context": {
"blockTime": 123,
"slot": 1
},
"proofs": [
{
"leaf": "<string>",
"leafIndex": 1,
"merkleContext": {
"tree": "<string>",
"treeType": 1
},
"path": [
"<string>"
],
"root": "<string>",
"rootIndex": 1,
"rootSeq": 1
}
]
}
}{
"jsonrpc": "2.0",
"id": "<string>",
"error": {
"code": 123,
"message": "<string>",
"data": {}
}
}{
"jsonrpc": "2.0",
"id": "<string>",
"error": {
"code": 123,
"message": "<string>",
"data": {}
}
}{
"jsonrpc": "2.0",
"id": "<string>",
"error": {
"code": 123,
"message": "<string>",
"data": {}
}
}