VerifySignature gRPC Method
Parameter
Nachricht
Objekt
ERFORDERLICH
Wird geladen...
Unterschrift
Objekt
ERFORDERLICH
Wird geladen...
Adresse
Zeichenkette
Wird geladen...
jwks
Array
Wird geladen...
Rücksendungen
isValid
boolesch
Wird geladen...
reason
Zeichenkette
Wird geladen...
Anfrage
1grpcurl -import-path . \2-proto sui/rpc/v2/signature_verification_service.proto \3-H "x-token: abcde123456789" \4-d '{5"message": {6"name": "PersonalMessage",7"value": "BASE64_MESSAGE_BYTES"8},9"signature": {10"scheme": "ED25519",11"signature": "BASE64_SIGNATURE",12"public_key": "BASE64_PUBLIC_KEY"13},14"address": "0xOPTIONAL_VERIFY_AGAINST_THIS_ADDRESS"15}' \16docs-demo.sui-mainnet.quiknode.pro:9000 \17sui.rpc.v2.SignatureVerificationService/VerifySignature18
1grpcurl -import-path . \2-proto sui/rpc/v2/signature_verification_service.proto \3-H "x-token: abcde123456789" \4-d '{5"message": {6"name": "PersonalMessage",7"value": "BASE64_MESSAGE_BYTES"8},9"signature": {10"scheme": "ED25519",11"signature": "BASE64_SIGNATURE",12"public_key": "BASE64_PUBLIC_KEY"13},14"address": "0xOPTIONAL_VERIFY_AGAINST_THIS_ADDRESS"15}' \16docs-demo.sui-mainnet.quiknode.pro:9000 \17sui.rpc.v2.SignatureVerificationService/VerifySignature18
1Paket Hauptteil23import (4„Kontext“5„crypto/tls“6"encoding/json"7„fmt“8„log“9„Zeit“1011"google.golang.org/grpc"12"google.golang.org/grpc/credentials"13"google.golang.org/protobuf/encoding/protojson"14"google.golang.org/protobuf/types/known/fieldmaskpb"1516pb "sui-grpc/sui/rpc/v2" // Your Generated .pb.go files path17)1819// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token20// For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678921// endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}22// token will be : abcde1234567892324var (25Token = "IHRE_TOKEN-NUMMER"26endpoint = "YOUR_QN_ENDPOINT:9000"27)2829// Auth structure for x-token30Typ auth Struktur {31Token Zeichenkette32}3334func (a *auth) GetRequestMetadata(ctx Kontext.Context, uri ...Zeichenkette) (map[Zeichenkette]Zeichenkette, Fehler) {35return map[string]string{"x-token": a.token}, nil36}37func (a *auth) RequireTransportSecurity() bool {38return true39}4041func main() {42creds := credentials.NewTLS(&tls.Config{})43opts := []grpc.DialOption{44grpc.WithTransportCredentials(creds),45grpc.Mit RPCC-Anmeldedaten(&auth{Token}),46}4748conn, err := grpc.Dial(endpoint, opts...)49wenn err != nil {50Protokoll.Fatalf(„Verbindung konnte nicht hergestellt werden: %v“, err)51}52aufschieben conn.Schließen()5354client := pb.NewSignatureVerificationServiceClient(conn)5556req := &pb.VerifySignatureRequest{57Signature: &pb.Signature{58Scheme: 0, // ED2551959Signature: []byte("YOUR_SIGNATURE_BYTES"), // Replace with actual signature60PublicKey: []byte("YOUR_PUBLIC_KEY_BYTES"), // Replace with actual public key61},62Message: []byte("YOUR_MESSAGE_BYTES"), // Replace with actual message63ReadMask: &fieldmaskpb.FieldMask{64Paths: []string{65"is_valid",66"error",67},68},69}7071ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)72defer cancel()7374resp, err := client.VerifySignature(ctx, req)75wenn err != nil {76log.Fatalf("VerifySignature failed: %v", err)77}7879// Pretty print the response80marshaler := protojson.MarshalOptions{81UseProtoNames: true,82EmitUnpopulated: true,83Indent: " ",84}8586jsonBytes, err := marshaler.Marshal(resp)87wenn err != nil {88log.Fatalf("Failed to marshal: %v", err)89}9091var pretty map[string]interface{}92if err := json.Unmarshal(jsonBytes, &pretty); err != nil {93log.Fatalf("Failed to parse JSON: %v", err)94}9596out, _ := json.MarshalIndent(pretty, "", " ")97fmt.Println(string(out))98}99
1Paket Hauptteil23import (4„Kontext“5„crypto/tls“6"encoding/json"7„fmt“8„log“9„Zeit“1011"google.golang.org/grpc"12"google.golang.org/grpc/credentials"13"google.golang.org/protobuf/encoding/protojson"14"google.golang.org/protobuf/types/known/fieldmaskpb"1516pb "sui-grpc/sui/rpc/v2" // Your Generated .pb.go files path17)1819// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token20// For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678921// endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}22// token will be : abcde1234567892324var (25Token = "IHRE_TOKEN-NUMMER"26endpoint = "YOUR_QN_ENDPOINT:9000"27)2829// Auth structure for x-token30Typ auth Struktur {31Token Zeichenkette32}3334func (a *auth) GetRequestMetadata(ctx Kontext.Context, uri ...Zeichenkette) (map[Zeichenkette]Zeichenkette, Fehler) {35return map[string]string{"x-token": a.token}, nil36}37func (a *auth) RequireTransportSecurity() bool {38return true39}4041func main() {42creds := credentials.NewTLS(&tls.Config{})43opts := []grpc.DialOption{44grpc.WithTransportCredentials(creds),45grpc.Mit RPCC-Anmeldedaten(&auth{Token}),46}4748conn, err := grpc.Dial(endpoint, opts...)49wenn err != nil {50Protokoll.Fatalf(„Verbindung konnte nicht hergestellt werden: %v“, err)51}52aufschieben conn.Schließen()5354client := pb.NewSignatureVerificationServiceClient(conn)5556req := &pb.VerifySignatureRequest{57Signature: &pb.Signature{58Scheme: 0, // ED2551959Signature: []byte("YOUR_SIGNATURE_BYTES"), // Replace with actual signature60PublicKey: []byte("YOUR_PUBLIC_KEY_BYTES"), // Replace with actual public key61},62Message: []byte("YOUR_MESSAGE_BYTES"), // Replace with actual message63ReadMask: &fieldmaskpb.FieldMask{64Paths: []string{65"is_valid",66"error",67},68},69}7071ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)72defer cancel()7374resp, err := client.VerifySignature(ctx, req)75wenn err != nil {76log.Fatalf("VerifySignature failed: %v", err)77}7879// Pretty print the response80marshaler := protojson.MarshalOptions{81UseProtoNames: true,82EmitUnpopulated: true,83Indent: " ",84}8586jsonBytes, err := marshaler.Marshal(resp)87wenn err != nil {88log.Fatalf("Failed to marshal: %v", err)89}9091var pretty map[string]interface{}92if err := json.Unmarshal(jsonBytes, &pretty); err != nil {93log.Fatalf("Failed to parse JSON: %v", err)94}9596out, _ := json.MarshalIndent(pretty, "", " ")97fmt.Println(string(out))98}99
1import * as grpc from '@grpc/grpc-js';2import * as protoLoader from '@grpc/proto-loader';3import * as path from 'path';45// Configuration6const PROTO_PATH = path.join(__dirname, 'protos/proto/sui/rpc/v2/signature_verification_service.proto');78// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token9// For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678910// endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}11// token will be : abcde1234567891213const endpoint = 'docs-demo.sui-mainnet.quiknode.pro:9000';14const token = 'abcde123456789';1516// Load protobuf definitions17const packageDefinition = protoLoader.loadSync(PROTO_PATH, {18keepCase: true,19longs: String,20enums: String,21defaults: true,22oneofs: true,23includeDirs: [path.join(__dirname, 'protos/proto')],24});2526const proto = grpc.loadPackageDefinition(packageDefinition) as any;27const SignatureVerificationService = proto.sui.rpc.v2.SignatureVerificationService;2829// Create secure client30const client = new SignatureVerificationService(endpoint, grpc.credentials.createSsl());3132// Add token metadata33const metadata = new grpc.Metadata();34metadata.add('x-token', token);3536// Request payload37const request = {38signature: {39scheme: 0, // ED2551940signature: Buffer.from('YOUR_SIGNATURE_BYTES', 'base64'), // Replace with actual signature41public_key: Buffer.from('YOUR_PUBLIC_KEY_BYTES', 'base64') // Replace with actual public key42},43message: Buffer.from('YOUR_MESSAGE_BYTES', 'base64'), // Replace with actual message44read_mask: {45paths: [46'is_valid',47'error',48],49},50};5152// Perform gRPC call53client.VerifySignature(request, metadata, (err: grpc.ServiceError | null, response: any) => {54if (err) {55console.error('gRPC Error:', {56code: err.code,57message: err.message,58details: err.details,59});60} else {61console.log('VerifySignature Response:');62console.log(JSON.stringify(response, null, 2));63}64});65
1import * as grpc from '@grpc/grpc-js';2import * as protoLoader from '@grpc/proto-loader';3import * as path from 'path';45// Configuration6const PROTO_PATH = path.join(__dirname, 'protos/proto/sui/rpc/v2/signature_verification_service.proto');78// Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token9// For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678910// endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}11// token will be : abcde1234567891213const endpoint = 'docs-demo.sui-mainnet.quiknode.pro:9000';14const token = 'abcde123456789';1516// Load protobuf definitions17const packageDefinition = protoLoader.loadSync(PROTO_PATH, {18keepCase: true,19longs: String,20enums: String,21defaults: true,22oneofs: true,23includeDirs: [path.join(__dirname, 'protos/proto')],24});2526const proto = grpc.loadPackageDefinition(packageDefinition) as any;27const SignatureVerificationService = proto.sui.rpc.v2.SignatureVerificationService;2829// Create secure client30const client = new SignatureVerificationService(endpoint, grpc.credentials.createSsl());3132// Add token metadata33const metadata = new grpc.Metadata();34metadata.add('x-token', token);3536// Request payload37const request = {38signature: {39scheme: 0, // ED2551940signature: Buffer.from('YOUR_SIGNATURE_BYTES', 'base64'), // Replace with actual signature41public_key: Buffer.from('YOUR_PUBLIC_KEY_BYTES', 'base64') // Replace with actual public key42},43message: Buffer.from('YOUR_MESSAGE_BYTES', 'base64'), // Replace with actual message44read_mask: {45paths: [46'is_valid',47'error',48],49},50};5152// Perform gRPC call53client.VerifySignature(request, metadata, (err: grpc.ServiceError | null, response: any) => {54if (err) {55console.error('gRPC Error:', {56code: err.code,57message: err.message,58details: err.details,59});60} else {61console.log('VerifySignature Response:');62console.log(JSON.stringify(response, null, 2));63}64});65
1import grpc2import json3from google.protobuf.field_mask_pb2 import FieldMask4from google.protobuf.json_format import MessageToDict5from sui.rpc.v2 import signature_verification_service_pb2, signature_verification_service_pb2_grpc678def verify_signature():910# Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token11# For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678912# endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}13# token will be : abcde1234567891415endpoint = 'docs-demo.sui-mainnet.quiknode.pro:9000';16token = 'abcde123456789';1718channel = grpc.secure_channel(endpoint, grpc.ssl_channel_credentials())19stub = signature_verification_service_pb2_grpc.SignatureVerificationServiceStub(channel)2021read_mask = FieldMask(paths=[22"is_valid",23"error"24])2526request = signature_verification_service_pb2.VerifySignatureRequest(27signature=signature_verification_service_pb2.Signature(28scheme=0, # ED2551929signature=b"YOUR_SIGNATURE_BYTES", # Replace with actual signature30public_key=b"YOUR_PUBLIC_KEY_BYTES" # Replace with actual public key31),32message=b"YOUR_MESSAGE_BYTES", # Replace with actual message33read_mask=read_mask34)3536metadata = [("x-token", token)]3738return stub.VerifySignature(request, metadata=metadata)394041def parse_response_to_json(response):42return json.dumps(43MessageToDict(response, preserving_proto_field_name=True),44indent=245)464748def main():49try:50response = verify_signature()51print(parse_response_to_json(response))52except grpc.RpcError as e:53print(f"{e.code().name}: {e.details()}")545556if __name__ == "__main__":57main()58
1import grpc2import json3from google.protobuf.field_mask_pb2 import FieldMask4from google.protobuf.json_format import MessageToDict5from sui.rpc.v2 import signature_verification_service_pb2, signature_verification_service_pb2_grpc678def verify_signature():910# Quicknode endpoints consist of two crucial components: the endpoint name and the corresponding token11# For eg: QN Endpoint: https://docs-demo.sui-mainnet.quiknode.pro/abcde12345678912# endpoint will be: docs-demo.sui-mainnet.quiknode.pro:9000 {9000 is the port number for Sui gRPC}13# token will be : abcde1234567891415endpoint = 'docs-demo.sui-mainnet.quiknode.pro:9000';16token = 'abcde123456789';1718channel = grpc.secure_channel(endpoint, grpc.ssl_channel_credentials())19stub = signature_verification_service_pb2_grpc.SignatureVerificationServiceStub(channel)2021read_mask = FieldMask(paths=[22"is_valid",23"error"24])2526request = signature_verification_service_pb2.VerifySignatureRequest(27signature=signature_verification_service_pb2.Signature(28scheme=0, # ED2551929signature=b"YOUR_SIGNATURE_BYTES", # Replace with actual signature30public_key=b"YOUR_PUBLIC_KEY_BYTES" # Replace with actual public key31),32message=b"YOUR_MESSAGE_BYTES", # Replace with actual message33read_mask=read_mask34)3536metadata = [("x-token", token)]3738return stub.VerifySignature(request, metadata=metadata)394041def parse_response_to_json(response):42return json.dumps(43MessageToDict(response, preserving_proto_field_name=True),44indent=245)464748def main():49try:50response = verify_signature()51print(parse_response_to_json(response))52except grpc.RpcError as e:53print(f"{e.code().name}: {e.details()}")545556if __name__ == "__main__":57main()58
Haben Sie noch kein Konto?
Erstellen Sie Ihren Quicknode-Endpunkt in Sekundenschnelle und legen Sie los
Kostenlos loslegen