anchor

package
v0.0.0-...-1208081 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2022 License: AGPL-3.0 Imports: 22 Imported by: 0

README

anchor

Contents

Getting Started

import "github.com/SouthbankSoftware/provendb-sdk-go/pkg/anchor"

There a two clients in this library. One is the client generated by protoc which provides direct API functionality, and the other is a client which provides developer simplicity by adding more convenient functions to communicate with the anchor service. For these examples, we are using the custom client.

To create a new client, do the following:

client, err := anchor.Connect(WithCredentials("$YOUR_API_TOKEN"))

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Anchor_Type_name = map[int32]string{
		0: "ETH",
		3: "ETH_MAINNET",
		4: "ETH_ELASTOS",
		9: "ETH_GOCHAIN",
		1: "BTC",
		5: "BTC_MAINNET",
		2: "CHP",
		6: "HEDERA",
		7: "HEDERA_MAINNET",
		8: "HYPERLEDGER",
	}
	Anchor_Type_value = map[string]int32{
		"ETH":            0,
		"ETH_MAINNET":    3,
		"ETH_ELASTOS":    4,
		"ETH_GOCHAIN":    9,
		"BTC":            1,
		"BTC_MAINNET":    5,
		"CHP":            2,
		"HEDERA":         6,
		"HEDERA_MAINNET": 7,
		"HYPERLEDGER":    8,
	}
)

Enum value maps for Anchor_Type.

View Source
var (
	Anchor_Status_name = map[int32]string{
		0: "ERROR",
		1: "STOPPED",
		2: "RUNNING",
	}
	Anchor_Status_value = map[string]int32{
		"ERROR":   0,
		"STOPPED": 1,
		"RUNNING": 2,
	}
)

Enum value maps for Anchor_Status.

View Source
var (
	Batch_Status_name = map[int32]string{
		0: "ERROR",
		1: "BATCHING",
		2: "QUEUING",
		3: "PROCESSING",
		4: "PENDING",
		5: "CONFIRMED",
	}
	Batch_Status_value = map[string]int32{
		"ERROR":      0,
		"BATCHING":   1,
		"QUEUING":    2,
		"PROCESSING": 3,
		"PENDING":    4,
		"CONFIRMED":  5,
	}
)

Enum value maps for Batch_Status.

View Source
var (
	Proof_Format_name = map[int32]string{
		0: "CHP_PATH",
		1: "ETH_TRIE",
		2: "CHP_PATH_SIGNED",
		3: "ETH_TRIE_SIGNED",
	}
	Proof_Format_value = map[string]int32{
		"CHP_PATH":        0,
		"ETH_TRIE":        1,
		"CHP_PATH_SIGNED": 2,
		"ETH_TRIE_SIGNED": 3,
	}
)

Enum value maps for Proof_Format.

View Source
var AnchorService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "anchor.AnchorService",
	HandlerType: (*AnchorServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetAnchor",
			Handler:    _AnchorService_GetAnchor_Handler,
		},
		{
			MethodName: "GetProof",
			Handler:    _AnchorService_GetProof_Handler,
		},
		{
			MethodName: "SubmitProof",
			Handler:    _AnchorService_SubmitProof_Handler,
		},
		{
			MethodName: "VerifyProof",
			Handler:    _AnchorService_VerifyProof_Handler,
		},
		{
			MethodName: "GetBatch",
			Handler:    _AnchorService_GetBatch_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "GetAnchors",
			Handler:       _AnchorService_GetAnchors_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "SubscribeBatches",
			Handler:       _AnchorService_SubscribeBatches_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "github.com/SouthbankSoftware/provendb-apis/anchor/anchor.proto",
}

AnchorService_ServiceDesc is the grpc.ServiceDesc for AnchorService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_github_com_SouthbankSoftware_provendb_apis_anchor_anchor_proto protoreflect.FileDescriptor

Functions

func DecodeProof

func DecodeProof(data string) (map[string]interface{}, error)

func NewServiceCredentials

func NewServiceCredentials(credentials string, secure bool) credentials.PerRPCCredentials

WithServiceCredentials will return an implementation of the PerRPCCredentials that will be used to attach your credentials to every RPC call.

func RegisterAnchorServiceServer

func RegisterAnchorServiceServer(s grpc.ServiceRegistrar, srv AnchorServiceServer)

Types

type Anchor

type Anchor struct {

	// Type is the anchor type
	Type Anchor_Type `protobuf:"varint,1,opt,name=type,proto3,enum=anchor.Anchor_Type" json:"type,omitempty"`
	// Status is the anchor status
	Status Anchor_Status `protobuf:"varint,2,opt,name=status,proto3,enum=anchor.Anchor_Status" json:"status,omitempty"`
	// Error is the error message when the anchor status is ERROR
	Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"`
	// SupportedFormats are the supported proof formats of the anchor
	SupportedFormats []Proof_Format `` /* 142-byte string literal not displayed */
	// contains filtered or unexported fields
}

Anchor represents an anchor of a blockchain, through which a hash can be anchored to that blockchain

func (*Anchor) Descriptor deprecated

func (*Anchor) Descriptor() ([]byte, []int)

Deprecated: Use Anchor.ProtoReflect.Descriptor instead.

func (*Anchor) GetError

func (x *Anchor) GetError() string

func (*Anchor) GetStatus

func (x *Anchor) GetStatus() Anchor_Status

func (*Anchor) GetSupportedFormats

func (x *Anchor) GetSupportedFormats() []Proof_Format

func (*Anchor) GetType

func (x *Anchor) GetType() Anchor_Type

func (*Anchor) ProtoMessage

func (*Anchor) ProtoMessage()

func (*Anchor) ProtoReflect

func (x *Anchor) ProtoReflect() protoreflect.Message

func (*Anchor) Reset

func (x *Anchor) Reset()

func (*Anchor) String

func (x *Anchor) String() string

type AnchorProof

type AnchorProof struct {
	Id         string
	AnchorType string
	BatchId    string
	Status     string
	Format     string
	Hash       string
	Metadata   interface{}
	Data       map[string]interface{}
}

*

  • AnchorProof is a represention of a Proof object with tasks such as decoding already
  • performed and enums represented as strings for readability.

func (*AnchorProof) FromProof

func (a *AnchorProof) FromProof(proof *Proof) error

type AnchorRequest

type AnchorRequest struct {

	// Type is the anchor type
	Type Anchor_Type `protobuf:"varint,1,opt,name=type,proto3,enum=anchor.Anchor_Type" json:"type,omitempty"`
	// contains filtered or unexported fields
}

AnchorRequest represents a request to get information for the given anchor type

func (*AnchorRequest) Descriptor deprecated

func (*AnchorRequest) Descriptor() ([]byte, []int)

Deprecated: Use AnchorRequest.ProtoReflect.Descriptor instead.

func (*AnchorRequest) GetType

func (x *AnchorRequest) GetType() Anchor_Type

func (*AnchorRequest) ProtoMessage

func (*AnchorRequest) ProtoMessage()

func (*AnchorRequest) ProtoReflect

func (x *AnchorRequest) ProtoReflect() protoreflect.Message

func (*AnchorRequest) Reset

func (x *AnchorRequest) Reset()

func (*AnchorRequest) String

func (x *AnchorRequest) String() string

type AnchorServiceClient

type AnchorServiceClient interface {
	// GetAnchors gets all anchors
	GetAnchors(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (AnchorService_GetAnchorsClient, error)
	// GetAnchor gets an anchor
	GetAnchor(ctx context.Context, in *AnchorRequest, opts ...grpc.CallOption) (*Anchor, error)
	// GetProof gets a proof
	GetProof(ctx context.Context, in *ProofRequest, opts ...grpc.CallOption) (*Proof, error)
	// SubmitProof submits a proof for the given hash
	SubmitProof(ctx context.Context, in *SubmitProofRequest, opts ...grpc.CallOption) (*Proof, error)
	// VerifyProof verifies the given proof. When the proof is unverifiable, an
	// exception is thrown
	VerifyProof(ctx context.Context, in *VerifyProofRequest, opts ...grpc.CallOption) (*VerifyProofReply, error)
	// GetBatch gets a batch
	GetBatch(ctx context.Context, in *BatchRequest, opts ...grpc.CallOption) (*Batch, error)
	// SubscribeBatches subscribes to batch status updates
	SubscribeBatches(ctx context.Context, in *SubscribeBatchesRequest, opts ...grpc.CallOption) (AnchorService_SubscribeBatchesClient, error)
}

AnchorServiceClient is the client API for AnchorService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type AnchorServiceServer

type AnchorServiceServer interface {
	// GetAnchors gets all anchors
	GetAnchors(*emptypb.Empty, AnchorService_GetAnchorsServer) error
	// GetAnchor gets an anchor
	GetAnchor(context.Context, *AnchorRequest) (*Anchor, error)
	// GetProof gets a proof
	GetProof(context.Context, *ProofRequest) (*Proof, error)
	// SubmitProof submits a proof for the given hash
	SubmitProof(context.Context, *SubmitProofRequest) (*Proof, error)
	// VerifyProof verifies the given proof. When the proof is unverifiable, an
	// exception is thrown
	VerifyProof(context.Context, *VerifyProofRequest) (*VerifyProofReply, error)
	// GetBatch gets a batch
	GetBatch(context.Context, *BatchRequest) (*Batch, error)
	// SubscribeBatches subscribes to batch status updates
	SubscribeBatches(*SubscribeBatchesRequest, AnchorService_SubscribeBatchesServer) error
	// contains filtered or unexported methods
}

AnchorServiceServer is the server API for AnchorService service. All implementations must embed UnimplementedAnchorServiceServer for forward compatibility

type AnchorService_GetAnchorsClient

type AnchorService_GetAnchorsClient interface {
	Recv() (*Anchor, error)
	grpc.ClientStream
}

type AnchorService_GetAnchorsServer

type AnchorService_GetAnchorsServer interface {
	Send(*Anchor) error
	grpc.ServerStream
}

type AnchorService_SubscribeBatchesClient

type AnchorService_SubscribeBatchesClient interface {
	Recv() (*Batch, error)
	grpc.ClientStream
}

type AnchorService_SubscribeBatchesServer

type AnchorService_SubscribeBatchesServer interface {
	Send(*Batch) error
	grpc.ServerStream
}

type Anchor_Status

type Anchor_Status int32

Status represents an anchor's status

const (
	// Error means the anchor has an error
	Anchor_ERROR Anchor_Status = 0
	// STOPPED means the anchor is stopped
	Anchor_STOPPED Anchor_Status = 1
	// RUNNING means the anchor is running
	Anchor_RUNNING Anchor_Status = 2
)

func (Anchor_Status) Descriptor

func (Anchor_Status) Enum

func (x Anchor_Status) Enum() *Anchor_Status

func (Anchor_Status) EnumDescriptor deprecated

func (Anchor_Status) EnumDescriptor() ([]byte, []int)

Deprecated: Use Anchor_Status.Descriptor instead.

func (Anchor_Status) Number

func (Anchor_Status) String

func (x Anchor_Status) String() string

func (Anchor_Status) Type

type Anchor_Type

type Anchor_Type int32

Type represents an anchor type. Please refer to this [list](https://docs.proofable.io/concepts/anchor_types.html) for all available anchor types

const (
	// [Ethereum](https://ethereum.org/) Rinkeby Testnet
	Anchor_ETH Anchor_Type = 0
	// Ethereum Mainnet. [Ethereum](https://ethereum.org/) is the second-largest
	// cryptocurrency
	Anchor_ETH_MAINNET Anchor_Type = 3
	// [Elastos](https://www.elastos.org/), which employs a "main
	// chain-sidechain architecture"
	Anchor_ETH_ELASTOS Anchor_Type = 4
	// [GoChain](https://gochain.io/), which is scalable, low cost and energy
	// efficient
	Anchor_ETH_GOCHAIN Anchor_Type = 9
	// [Bitcoin](https://bitcoin.org/) Testnet
	Anchor_BTC Anchor_Type = 1
	// Bitcoin Mainnet. [Bitcoin](https://bitcoin.org/) is the largest
	// cryptocurrency
	Anchor_BTC_MAINNET Anchor_Type = 5
	// [Chainpoint](https://chainpoint.org/)
	Anchor_CHP Anchor_Type = 2
	// Hedera Testnet
	Anchor_HEDERA Anchor_Type = 6
	// Hedera Mainnet. [Hedera](https://www.hedera.com/) is a DAG based
	// blockchain that provides much better TPS than tranditional blockchains
	Anchor_HEDERA_MAINNET Anchor_Type = 7
	// [Hyperledger Fabric](https://www.hyperledger.org/use/fabric), which is a
	// modular blockchain framework for private enterprises
	Anchor_HYPERLEDGER Anchor_Type = 8
)

func (Anchor_Type) Descriptor

func (Anchor_Type) Enum

func (x Anchor_Type) Enum() *Anchor_Type

func (Anchor_Type) EnumDescriptor deprecated

func (Anchor_Type) EnumDescriptor() ([]byte, []int)

Deprecated: Use Anchor_Type.Descriptor instead.

func (Anchor_Type) Number

func (x Anchor_Type) Number() protoreflect.EnumNumber

func (Anchor_Type) String

func (x Anchor_Type) String() string

func (Anchor_Type) Type

type Batch

type Batch struct {

	// Id is the batch ID
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// AnchorType is the batch's anchor type
	AnchorType Anchor_Type `protobuf:"varint,2,opt,name=anchor_type,json=anchorType,proto3,enum=anchor.Anchor_Type" json:"anchor_type,omitempty"`
	// ProofFormat is the batch's proof format, which determines how the merkle
	// tree is constructed for the batch.
	ProofFormat Proof_Format `protobuf:"varint,3,opt,name=proof_format,json=proofFormat,proto3,enum=anchor.Proof_Format" json:"proof_format,omitempty"`
	// Status is the batch status. FLOW: created_at -> BATCHING -> flushed_at ->
	// QUEUING -> started_at -> PROCESSING -> submitted_at -> PENDING ->
	// finalized_at -> CONFIRMED / ERROR; * -> ERROR; if a batch has not yet
	// reached PENDING and its anchor has restarted, the batch will be put back to
	// QUEUING
	Status Batch_Status `protobuf:"varint,4,opt,name=status,proto3,enum=anchor.Batch_Status" json:"status,omitempty"`
	// Error is the error message when status is ERROR
	Error string `protobuf:"bytes,5,opt,name=error,proto3" json:"error,omitempty"`
	// Size is the number of hashes contained in the batch
	Size int64 `protobuf:"varint,6,opt,name=size,proto3" json:"size,omitempty"`
	// CreateAt is the batch's created at timestamp. FLOW: created_at -> BATCHING
	CreatedAt *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	// FlushedAt is the batch's flushed at timestamp. FLOW: BATCHING -> flushed_at
	// -> QUEUING
	FlushedAt *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=flushed_at,json=flushedAt,proto3" json:"flushed_at,omitempty"`
	// StartedAt is the batch's started at timestamp. FLOW: QUEUING -> started_at
	// -> PROCESSING
	StartedAt *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=started_at,json=startedAt,proto3" json:"started_at,omitempty"`
	// SubmittedAt is the batch's submitted at timestamp. FLOW: PROCESSING ->
	// submitted_at -> PENDING
	SubmittedAt *timestamppb.Timestamp `protobuf:"bytes,10,opt,name=submitted_at,json=submittedAt,proto3" json:"submitted_at,omitempty"`
	// FinalizedAt is the batch's finalized at timestamp. FLOW: * -> finalized_at
	// -> CONFIRMED / ERROR. NOTE: this is not the real block confirmed time, use
	// the timestamp in the batch data instead
	FinalizedAt *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=finalized_at,json=finalizedAt,proto3" json:"finalized_at,omitempty"`
	// Hash is the batch's root hash
	Hash string `protobuf:"bytes,12,opt,name=hash,proto3" json:"hash,omitempty"`
	// Data is the batch data in JSON
	Data string `protobuf:"bytes,13,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

Batch represents a batch of hashes. When hash stream comes in, Anchor Service will try to process them in batches, just like blockchain processes transactions in blocks. This makes utilization of expensive resources, such as making Bitcoin transaction, more economic. Each batch's root hash will be embedded in a transaction made to the blockchain

func (*Batch) Descriptor deprecated

func (*Batch) Descriptor() ([]byte, []int)

Deprecated: Use Batch.ProtoReflect.Descriptor instead.

func (*Batch) GetAnchorType

func (x *Batch) GetAnchorType() Anchor_Type

func (*Batch) GetCreatedAt

func (x *Batch) GetCreatedAt() *timestamppb.Timestamp

func (*Batch) GetData

func (x *Batch) GetData() string

func (*Batch) GetError

func (x *Batch) GetError() string

func (*Batch) GetFinalizedAt

func (x *Batch) GetFinalizedAt() *timestamppb.Timestamp

func (*Batch) GetFlushedAt

func (x *Batch) GetFlushedAt() *timestamppb.Timestamp

func (*Batch) GetHash

func (x *Batch) GetHash() string

func (*Batch) GetId

func (x *Batch) GetId() string

func (*Batch) GetProofFormat

func (x *Batch) GetProofFormat() Proof_Format

func (*Batch) GetSize

func (x *Batch) GetSize() int64

func (*Batch) GetStartedAt

func (x *Batch) GetStartedAt() *timestamppb.Timestamp

func (*Batch) GetStatus

func (x *Batch) GetStatus() Batch_Status

func (*Batch) GetSubmittedAt

func (x *Batch) GetSubmittedAt() *timestamppb.Timestamp

func (*Batch) ProtoMessage

func (*Batch) ProtoMessage()

func (*Batch) ProtoReflect

func (x *Batch) ProtoReflect() protoreflect.Message

func (*Batch) Reset

func (x *Batch) Reset()

func (*Batch) String

func (x *Batch) String() string

type BatchRequest

type BatchRequest struct {

	// BatchId is the batch ID
	BatchId string `protobuf:"bytes,1,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"`
	// AnchorType is the batch's anchor type
	AnchorType Anchor_Type `protobuf:"varint,2,opt,name=anchor_type,json=anchorType,proto3,enum=anchor.Anchor_Type" json:"anchor_type,omitempty"`
	// contains filtered or unexported fields
}

BatchRequest represents a batch request

func (*BatchRequest) Descriptor deprecated

func (*BatchRequest) Descriptor() ([]byte, []int)

Deprecated: Use BatchRequest.ProtoReflect.Descriptor instead.

func (*BatchRequest) GetAnchorType

func (x *BatchRequest) GetAnchorType() Anchor_Type

func (*BatchRequest) GetBatchId

func (x *BatchRequest) GetBatchId() string

func (*BatchRequest) ProtoMessage

func (*BatchRequest) ProtoMessage()

func (*BatchRequest) ProtoReflect

func (x *BatchRequest) ProtoReflect() protoreflect.Message

func (*BatchRequest) Reset

func (x *BatchRequest) Reset()

func (*BatchRequest) String

func (x *BatchRequest) String() string

type Batch_Status

type Batch_Status int32

Status represents a batch's status

const (
	// ERROR means the batch has an error. FLOW: * -> ERROR
	Batch_ERROR Batch_Status = 0
	// BATCHING means the batch is batching for more hashes. FLOW: created_at ->
	// BATCHING -> flushed_at
	Batch_BATCHING Batch_Status = 1
	// QUEUING means the batch is queuing to be processed. FLOW: flushed_at ->
	// QUEUING -> started_at
	Batch_QUEUING Batch_Status = 2
	// PROCESSING means the batch is constructing merkle roots and submitting
	// hashes. FLOW: started_at -> PROCESSING -> submitted_at
	Batch_PROCESSING Batch_Status = 3
	// PENDING means the batch's root hash is pending to be confirmed. FLOW:
	// submitted_at -> PENDING -> finalized_at
	Batch_PENDING Batch_Status = 4
	// CONFIRMED means the batch's root hash is confirmed by the anchor's
	// blockchain. FLOW: finalized_at -> CONFIRMED
	Batch_CONFIRMED Batch_Status = 5
)

func (Batch_Status) Descriptor

func (Batch_Status) Enum

func (x Batch_Status) Enum() *Batch_Status

func (Batch_Status) EnumDescriptor deprecated

func (Batch_Status) EnumDescriptor() ([]byte, []int)

Deprecated: Use Batch_Status.Descriptor instead.

func (Batch_Status) Number

func (Batch_Status) String

func (x Batch_Status) String() string

func (Batch_Status) Type

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client holds the grpc anchor service client and provides simplified functionality to perform anchor operations.

func Connect

func Connect(opts ...ClientOption) (*Client, error)

Connect creates a new anchor client and performs all the grpc connections.

func (*Client) Close

func (c *Client) Close() error

Close the anchor connection gracefully.

func (*Client) GetAnchor

func (c *Client) GetAnchor(ctx context.Context, anchorType Anchor_Type) (*Anchor, error)

GetAnchor will retreive information about a single anchor.

func (*Client) GetAnchors

func (c *Client) GetAnchors(ctx context.Context) ([]*Anchor, error)

GetAnchors will retrieve all the available anchors.

func (*Client) GetBatch

func (c *Client) GetBatch(ctx context.Context, batchId string, anchorType Anchor_Type) (*Batch, error)

GetBatch retrieves a single batch information.

func (*Client) GetProof

func (c *Client) GetProof(ctx context.Context, id string, anchorType interface{}) (*AnchorProof, error)

GetProof retrieves a proof matching the given hash and batch ID.

func (*Client) SubmitProof

func (c *Client) SubmitProof(ctx context.Context, hash string, opts ...SubmitProofOption) (p *AnchorProof, e error)

SubmitProof submits a new proof to the anchor service.

func (*Client) SubscribeProof

func (c *Client) SubscribeProof(ctx context.Context, id string, anchorType interface{}, callback func(proof *AnchorProof, err error))

Subsribe proof will listen for changes to the proof and return either the updated proof, or an error. Function will complete once proof status returned is either CONFIRMED or ERROR, or context expired.

type ClientOption

type ClientOption func(*ClientOptions)

ClientOption func.

func WithAddress

func WithAddress(address string) ClientOption

func WithCredentials

func WithCredentials(credentials string) ClientOption

func WithInsecure

func WithInsecure(insecure bool) ClientOption

type ClientOptions

type ClientOptions struct {
	// The anchor service address.
	Address string
	// The credential for authentication.
	Credentials string
	// Establishes an insecure connection.
	Insecure bool
}

ClientOptions represents the anchor options.

type Proof

type Proof struct {

	// Hash is the hash the proof is proving for
	Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	// BatchId is the proof's batch ID
	BatchId string `protobuf:"bytes,2,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"`
	// AnchorType is the proof's anchor type
	AnchorType Anchor_Type `protobuf:"varint,3,opt,name=anchor_type,json=anchorType,proto3,enum=anchor.Anchor_Type" json:"anchor_type,omitempty"`
	// BatchStatus is the proof's batch status
	BatchStatus Batch_Status `protobuf:"varint,4,opt,name=batch_status,json=batchStatus,proto3,enum=anchor.Batch_Status" json:"batch_status,omitempty"`
	// Format is the proof format
	Format Proof_Format `protobuf:"varint,5,opt,name=format,proto3,enum=anchor.Proof_Format" json:"format,omitempty"`
	// Data is the proof data in base64
	Data string `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"`
	// Batch is the proof's batch detail
	Batch *Batch `protobuf:"bytes,7,opt,name=batch,proto3" json:"batch,omitempty"`
	// contains filtered or unexported fields
}

Proof represents a blockchain proof of a hash, which is a Merkle path from the hash to the root hash of the proof's batch

func (*Proof) Descriptor deprecated

func (*Proof) Descriptor() ([]byte, []int)

Deprecated: Use Proof.ProtoReflect.Descriptor instead.

func (*Proof) GetAnchorType

func (x *Proof) GetAnchorType() Anchor_Type

func (*Proof) GetBatch

func (x *Proof) GetBatch() *Batch

func (*Proof) GetBatchId

func (x *Proof) GetBatchId() string

func (*Proof) GetBatchStatus

func (x *Proof) GetBatchStatus() Batch_Status

func (*Proof) GetData

func (x *Proof) GetData() string

func (*Proof) GetFormat

func (x *Proof) GetFormat() Proof_Format

func (*Proof) GetHash

func (x *Proof) GetHash() string

func (*Proof) ProtoMessage

func (*Proof) ProtoMessage()

func (*Proof) ProtoReflect

func (x *Proof) ProtoReflect() protoreflect.Message

func (*Proof) Reset

func (x *Proof) Reset()

func (*Proof) String

func (x *Proof) String() string

type ProofRequest

type ProofRequest struct {

	// Hash is the hash the proof is proving for
	Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	// BatchId is the proof's batch ID
	BatchId string `protobuf:"bytes,2,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"`
	// AnchorType is the proof's anchor type
	AnchorType Anchor_Type `protobuf:"varint,3,opt,name=anchor_type,json=anchorType,proto3,enum=anchor.Anchor_Type" json:"anchor_type,omitempty"`
	// WithBatch indicates whether to include the proof's batch detail
	WithBatch bool `protobuf:"varint,4,opt,name=with_batch,json=withBatch,proto3" json:"with_batch,omitempty"`
	// contains filtered or unexported fields
}

ProofRequest represents a proof request

func (*ProofRequest) Descriptor deprecated

func (*ProofRequest) Descriptor() ([]byte, []int)

Deprecated: Use ProofRequest.ProtoReflect.Descriptor instead.

func (*ProofRequest) GetAnchorType

func (x *ProofRequest) GetAnchorType() Anchor_Type

func (*ProofRequest) GetBatchId

func (x *ProofRequest) GetBatchId() string

func (*ProofRequest) GetHash

func (x *ProofRequest) GetHash() string

func (*ProofRequest) GetWithBatch

func (x *ProofRequest) GetWithBatch() bool

func (*ProofRequest) ProtoMessage

func (*ProofRequest) ProtoMessage()

func (*ProofRequest) ProtoReflect

func (x *ProofRequest) ProtoReflect() protoreflect.Message

func (*ProofRequest) Reset

func (x *ProofRequest) Reset()

func (*ProofRequest) String

func (x *ProofRequest) String() string

type Proof_Format

type Proof_Format int32

Format represents a proof format

const (
	// CHP_PATH means Chainpoint Path format, which is the format used by
	// Chainpoint
	Proof_CHP_PATH Proof_Format = 0
	// ETH_TRIE means Ethereum Trie format
	Proof_ETH_TRIE Proof_Format = 1
	// CHP_PATH_SIGNED means signed Chainpoint Path format
	Proof_CHP_PATH_SIGNED Proof_Format = 2
	// ETH_TRIE_SIGNED means signed Ethereum Trie format
	Proof_ETH_TRIE_SIGNED Proof_Format = 3
)

func (Proof_Format) Descriptor

func (Proof_Format) Enum

func (x Proof_Format) Enum() *Proof_Format

func (Proof_Format) EnumDescriptor deprecated

func (Proof_Format) EnumDescriptor() ([]byte, []int)

Deprecated: Use Proof_Format.Descriptor instead.

func (Proof_Format) Number

func (Proof_Format) String

func (x Proof_Format) String() string

func (Proof_Format) Type

type ServiceCredentials

type ServiceCredentials struct {
	// contains filtered or unexported fields
}

Credentials implements perRPC credentials.

func (*ServiceCredentials) GetRequestMetadata

func (s *ServiceCredentials) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)

func (*ServiceCredentials) RequireTransportSecurity

func (s *ServiceCredentials) RequireTransportSecurity() bool

RequireTransportSecurity indicates whether the credentials requires transport security.

type SubmitProofOption

type SubmitProofOption func(o *SubmitProofOptions)

func SubmitProofWithAnchorType

func SubmitProofWithAnchorType(anchorType Anchor_Type) SubmitProofOption

func SubmitProofWithAwaitConfirmed

func SubmitProofWithAwaitConfirmed(awaitConfirmed bool) SubmitProofOption

func SubmitProofWithFormat

func SubmitProofWithFormat(format Proof_Format) SubmitProofOption

func SubmitProofWithSkipBatching

func SubmitProofWithSkipBatching(skip bool) SubmitProofOption

type SubmitProofOptions

type SubmitProofOptions struct {
	// The anchor type.
	AnchorType Anchor_Type
	// Whether to skip batching.
	SkipBatching bool
	// Format
	Format Proof_Format

	AwaitConfirmed bool
}

SubmitProofOptions options.

type SubmitProofRequest

type SubmitProofRequest struct {

	// Hash is the hash to be submitted
	Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	// AnchorType is the anchor type to be used
	AnchorType Anchor_Type `protobuf:"varint,2,opt,name=anchor_type,json=anchorType,proto3,enum=anchor.Anchor_Type" json:"anchor_type,omitempty"`
	// Format is the proof format to be used
	Format Proof_Format `protobuf:"varint,3,opt,name=format,proto3,enum=anchor.Proof_Format" json:"format,omitempty"`
	// SkipBatching indicates whether to skip batching and submit a proof for the
	// hash directly
	SkipBatching bool `protobuf:"varint,4,opt,name=skip_batching,json=skipBatching,proto3" json:"skip_batching,omitempty"`
	// WithBatch indicates whether to include the batch detail in the reply
	WithBatch bool `protobuf:"varint,5,opt,name=with_batch,json=withBatch,proto3" json:"with_batch,omitempty"`
	// contains filtered or unexported fields
}

SubmitProofRequest represents a submit proof request

func (*SubmitProofRequest) Descriptor deprecated

func (*SubmitProofRequest) Descriptor() ([]byte, []int)

Deprecated: Use SubmitProofRequest.ProtoReflect.Descriptor instead.

func (*SubmitProofRequest) GetAnchorType

func (x *SubmitProofRequest) GetAnchorType() Anchor_Type

func (*SubmitProofRequest) GetFormat

func (x *SubmitProofRequest) GetFormat() Proof_Format

func (*SubmitProofRequest) GetHash

func (x *SubmitProofRequest) GetHash() string

func (*SubmitProofRequest) GetSkipBatching

func (x *SubmitProofRequest) GetSkipBatching() bool

func (*SubmitProofRequest) GetWithBatch

func (x *SubmitProofRequest) GetWithBatch() bool

func (*SubmitProofRequest) ProtoMessage

func (*SubmitProofRequest) ProtoMessage()

func (*SubmitProofRequest) ProtoReflect

func (x *SubmitProofRequest) ProtoReflect() protoreflect.Message

func (*SubmitProofRequest) Reset

func (x *SubmitProofRequest) Reset()

func (*SubmitProofRequest) String

func (x *SubmitProofRequest) String() string

type SubscribeBatchesRequest

type SubscribeBatchesRequest struct {

	// Filter is the batch filter. When nil, all batches of all anchors will be
	// subscribed; otherwise, only the batches of the given anchor will be
	// subscribed; if batch_id is non-empty, only the matched batch will be
	// subscribed
	Filter *BatchRequest `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"`
	// contains filtered or unexported fields
}

SubscribeBatchesRequest represents a subscription request for batch information

func (*SubscribeBatchesRequest) Descriptor deprecated

func (*SubscribeBatchesRequest) Descriptor() ([]byte, []int)

Deprecated: Use SubscribeBatchesRequest.ProtoReflect.Descriptor instead.

func (*SubscribeBatchesRequest) GetFilter

func (x *SubscribeBatchesRequest) GetFilter() *BatchRequest

func (*SubscribeBatchesRequest) ProtoMessage

func (*SubscribeBatchesRequest) ProtoMessage()

func (*SubscribeBatchesRequest) ProtoReflect

func (x *SubscribeBatchesRequest) ProtoReflect() protoreflect.Message

func (*SubscribeBatchesRequest) Reset

func (x *SubscribeBatchesRequest) Reset()

func (*SubscribeBatchesRequest) String

func (x *SubscribeBatchesRequest) String() string

type UnimplementedAnchorServiceServer

type UnimplementedAnchorServiceServer struct {
}

UnimplementedAnchorServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedAnchorServiceServer) GetAnchor

func (UnimplementedAnchorServiceServer) GetAnchors

func (UnimplementedAnchorServiceServer) GetBatch

func (UnimplementedAnchorServiceServer) GetProof

func (UnimplementedAnchorServiceServer) SubmitProof

func (UnimplementedAnchorServiceServer) VerifyProof

type UnsafeAnchorServiceServer

type UnsafeAnchorServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeAnchorServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to AnchorServiceServer will result in compilation errors.

type VerifyProofReply

type VerifyProofReply struct {

	// Verified indicates whether the proof is verified
	Verified bool `protobuf:"varint,1,opt,name=verified,proto3" json:"verified,omitempty"`
	// Erorr is the error message when the proof is falsified
	Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"`
	// ProvenHash is the hash the proof is proving for
	ProvenHash string `protobuf:"bytes,3,opt,name=provenHash,proto3" json:"provenHash,omitempty"`
	// contains filtered or unexported fields
}

VerifyProofReply represents a verify proof reply

func (*VerifyProofReply) Descriptor deprecated

func (*VerifyProofReply) Descriptor() ([]byte, []int)

Deprecated: Use VerifyProofReply.ProtoReflect.Descriptor instead.

func (*VerifyProofReply) GetError

func (x *VerifyProofReply) GetError() string

func (*VerifyProofReply) GetProvenHash

func (x *VerifyProofReply) GetProvenHash() string

func (*VerifyProofReply) GetVerified

func (x *VerifyProofReply) GetVerified() bool

func (*VerifyProofReply) ProtoMessage

func (*VerifyProofReply) ProtoMessage()

func (*VerifyProofReply) ProtoReflect

func (x *VerifyProofReply) ProtoReflect() protoreflect.Message

func (*VerifyProofReply) Reset

func (x *VerifyProofReply) Reset()

func (*VerifyProofReply) String

func (x *VerifyProofReply) String() string

type VerifyProofRequest

type VerifyProofRequest struct {

	// AnchorType is the proof's anchor type
	AnchorType Anchor_Type `protobuf:"varint,1,opt,name=anchor_type,json=anchorType,proto3,enum=anchor.Anchor_Type" json:"anchor_type,omitempty"`
	// Format is the proof format. If skipping the signature checking is desired,
	// please use the corresponding non-signed format, eg. use CHP_PATH instead of
	// CHP_PATH_SIGNED in request
	Format Proof_Format `protobuf:"varint,2,opt,name=format,proto3,enum=anchor.Proof_Format" json:"format,omitempty"`
	// Data is the proof data in base64
	Data string `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

VerifyProofRequest represents a verify proof request

func (*VerifyProofRequest) Descriptor deprecated

func (*VerifyProofRequest) Descriptor() ([]byte, []int)

Deprecated: Use VerifyProofRequest.ProtoReflect.Descriptor instead.

func (*VerifyProofRequest) GetAnchorType

func (x *VerifyProofRequest) GetAnchorType() Anchor_Type

func (*VerifyProofRequest) GetData

func (x *VerifyProofRequest) GetData() string

func (*VerifyProofRequest) GetFormat

func (x *VerifyProofRequest) GetFormat() Proof_Format

func (*VerifyProofRequest) ProtoMessage

func (*VerifyProofRequest) ProtoMessage()

func (*VerifyProofRequest) ProtoReflect

func (x *VerifyProofRequest) ProtoReflect() protoreflect.Message

func (*VerifyProofRequest) Reset

func (x *VerifyProofRequest) Reset()

func (*VerifyProofRequest) String

func (x *VerifyProofRequest) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL