التحقق من الإجماع
curl --request GET \
--url https://api.truthlocks.com/v1/witness/{witnessRequestID}/consensus \
--header 'X-API-Key: <api-key>'const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.truthlocks.com/v1/witness/{witnessRequestID}/consensus', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/witness/{witnessRequestID}/consensus"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/witness/{witnessRequestID}/consensus"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"reached": true,
"attestation_count": 123,
"required": 123,
"signatures": [
"<string>"
]
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}الثقة والشهادة
الحصول على إجماع الشهود
استرداد نتيجة الإجماع لطلب التحقق من الشاهد
GET
/
v1
/
witness
/
{witnessRequestID}
/
consensus
التحقق من الإجماع
curl --request GET \
--url https://api.truthlocks.com/v1/witness/{witnessRequestID}/consensus \
--header 'X-API-Key: <api-key>'const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.truthlocks.com/v1/witness/{witnessRequestID}/consensus', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/witness/{witnessRequestID}/consensus"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/witness/{witnessRequestID}/consensus"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"reached": true,
"attestation_count": 123,
"required": 123,
"signatures": [
"<string>"
]
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}يعرض حالة الإجماع الحالية لطلب شاهد، بما في ذلك إحصاءات التصويت والتحديد النهائي. استخدم نقطة النهاية هذه للاستعلام عن اكتمال الإجماع أو لاسترداد النتيجة النهائية بعد أن يشهد الشهود.
يتم حساب الإجماع تلقائيًا عندما يصل عدد الشهادات إلى عتبة
required_witnesses. تحدد أغلبية بسيطة من أحكام confirm أو deny النتيجة. تُحتسب أصوات abstain ضمن النصاب القانوني ولكنها لا تؤثر على حساب الأغلبية.
المصادقة
يتطلب رأسX-API-Key أو رمز Bearer JWT. يتم اشتقاق مساحة العمل من بيانات الاعتماد الموثقة؛ لا ترسل X-Tenant-ID.
الاستجابة
الحالة الحالية لطلب الشاهد. أحد الخيارات: -
pending — لا يزال ينتظر
الشهادات - confirmed — تم التوصل إلى توافق، وتم تأكيد المطالبة - denied
— تم التوصل إلى توافق، تم رفض المطالبة - expired — انقضى TTL بدون
الوصول إلى النصاب القانونيطابع زمني ISO 8601 عندما تم التوصل إلى توافق.
null إذا كان لا يزال معلقًا أو
انتهت صلاحيته دون توافق.منطق الإجماع
| السيناريو | النتيجة |
|---|---|
تم تحقيق النصاب، أغلبية confirm | confirmed |
تم تحقيق النصاب، أغلبية deny | denied |
تم تحقيق النصاب، متساوٍ confirm/deny | مرجح حسب درجات الثقة؛ أعلى ثقة إجمالية تفوز |
| تنتهي صلاحية TTL قبل النصاب | expired |

