Solana 隐私环
getEncryptedUtxosByTags
检索与查看标签或特定环匹配的加密 UTXO 输出。
POST
/
v1
/
spr
/
getEncryptedUtxosByTags
getEncryptedUtxosByTags
curl --request POST \
--url 'https://devnet.helius-rpc.com/v1/spr/getEncryptedUtxosByTags?api-key=' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": "1",
"method": "getEncryptedUtxosByTags",
"params": {
"tags": [
"11111111111111111111111111111112"
],
"limit": 100
}
}
'import requests
url = "https://devnet.helius-rpc.com/v1/spr/getEncryptedUtxosByTags?api-key="
payload = {
"jsonrpc": "2.0",
"id": "1",
"method": "getEncryptedUtxosByTags",
"params": {
"tags": ["11111111111111111111111111111112"],
"limit": 100
}
}
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: 'getEncryptedUtxosByTags',
params: {tags: ['11111111111111111111111111111112'], limit: 100}
})
};
fetch('https://devnet.helius-rpc.com/v1/spr/getEncryptedUtxosByTags?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/getEncryptedUtxosByTags?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' => 'getEncryptedUtxosByTags',
'params' => [
'tags' => [
'11111111111111111111111111111112'
],
'limit' => 100
]
]),
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/getEncryptedUtxosByTags?api-key="
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": \"1\",\n \"method\": \"getEncryptedUtxosByTags\",\n \"params\": {\n \"tags\": [\n \"11111111111111111111111111111112\"\n ],\n \"limit\": 100\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/getEncryptedUtxosByTags?api-key=")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": \"1\",\n \"method\": \"getEncryptedUtxosByTags\",\n \"params\": {\n \"tags\": [\n \"11111111111111111111111111111112\"\n ],\n \"limit\": 100\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://devnet.helius-rpc.com/v1/spr/getEncryptedUtxosByTags?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\": \"getEncryptedUtxosByTags\",\n \"params\": {\n \"tags\": [\n \"11111111111111111111111111111112\"\n ],\n \"limit\": 100\n }\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": "1",
"result": {
"context": {
"slot": 4242,
"blockTime": 1730000000
},
"data": [],
"paginationToken": null
}
}{
"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": {}
}
}加密输出
使用此方法获取加密 UTXO,以便在客户端解密。你的钱包会解密这些输出,并汇总每种资产的未花费金额,以确定其隐私余额。 这类似于 Solana 的getTokenAccountsByOwner,后者返回某个地址拥有的 SPL 代币账户。隐私余额存储在 UTXO 中,而不是 Solana 账户中,因此需要专用的 RPC 方法。详细了解隐私状态和 UTXO。
此方法在 result.data 中返回匹配的输出,并按 Solana 交易分组。每个条目都包含交易的 slot 和 signature。输出包含其密文、查看标签、承诺、树 ID 和叶索引。
响应包含可能已被花费的历史输出。你的钱包必须跟踪作废标识符,以确定其可花费余额。请参阅隐私余额指南。
空的 tags 数组需要提供 ringProgramId,并选择该环中的输出。同时提供两者时,输出必须同时匹配标签和环。
有关页面限制、续传代币和增量读取的信息,请参阅分页和新鲜度。
请求参数
object
Slot 范围。要恢复已追赶至最新状态且无上限的读取,请将
slot.gt 设置为最后一页的 context.slot。object
读取的 Slot 范围。提供的范围条件使用 AND 组合。
number
仅包含此 Slot 之后的交易。
number
仅包含此 Slot 或之后的交易。
number
仅包含此 Slot 之前的交易。
number
仅包含此 Slot 或之前的交易。
number
默认值:"1000"
每页最多包含的 Solana 交易数,取值范围为 1 到 1,000。
number
此次读取所需的索引器最小持久化 Slot。如果索引器落后,则返回 JSON-RPC 错误 -32016。
string
上一个响应中的续传代币。使用相同的标签、环和 Slot 过滤条件,将其原样传回。
string
将结果限制为由此程序 ID 授权的环。当 tags 为空时,此参数为必填项。
array
必填
经过 Base58 编码的 32 字节查看标签,最多可提供 1,000 个。空数组需要提供 ringProgramId,并选择该环。
授权
你的 Helius API 密钥。
请求体
application/json
此页面对您有帮助吗?
⌘I
getEncryptedUtxosByTags
curl --request POST \
--url 'https://devnet.helius-rpc.com/v1/spr/getEncryptedUtxosByTags?api-key=' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": "1",
"method": "getEncryptedUtxosByTags",
"params": {
"tags": [
"11111111111111111111111111111112"
],
"limit": 100
}
}
'import requests
url = "https://devnet.helius-rpc.com/v1/spr/getEncryptedUtxosByTags?api-key="
payload = {
"jsonrpc": "2.0",
"id": "1",
"method": "getEncryptedUtxosByTags",
"params": {
"tags": ["11111111111111111111111111111112"],
"limit": 100
}
}
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: 'getEncryptedUtxosByTags',
params: {tags: ['11111111111111111111111111111112'], limit: 100}
})
};
fetch('https://devnet.helius-rpc.com/v1/spr/getEncryptedUtxosByTags?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/getEncryptedUtxosByTags?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' => 'getEncryptedUtxosByTags',
'params' => [
'tags' => [
'11111111111111111111111111111112'
],
'limit' => 100
]
]),
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/getEncryptedUtxosByTags?api-key="
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": \"1\",\n \"method\": \"getEncryptedUtxosByTags\",\n \"params\": {\n \"tags\": [\n \"11111111111111111111111111111112\"\n ],\n \"limit\": 100\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/getEncryptedUtxosByTags?api-key=")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": \"1\",\n \"method\": \"getEncryptedUtxosByTags\",\n \"params\": {\n \"tags\": [\n \"11111111111111111111111111111112\"\n ],\n \"limit\": 100\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://devnet.helius-rpc.com/v1/spr/getEncryptedUtxosByTags?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\": \"getEncryptedUtxosByTags\",\n \"params\": {\n \"tags\": [\n \"11111111111111111111111111111112\"\n ],\n \"limit\": 100\n }\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": "1",
"result": {
"context": {
"slot": 4242,
"blockTime": 1730000000
},
"data": [],
"paginationToken": null
}
}{
"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": {}
}
}