add documentation for lightwalletd APIs and data types

This commit is contained in:
Larry Ruane 2020-02-26 09:36:55 -07:00 committed by Larry Ruane
parent 48f4de0efb
commit 40f9dab995
8 changed files with 123 additions and 119 deletions

13
.gitignore vendored
View File

@ -1,8 +1,5 @@
*.conf server
*.config server.log
*.log coverage.out
*.sqlite test-log
*.pem lwd-api.html
*.key
*.elf
coverage.*

View File

@ -14,9 +14,9 @@ GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/ | grep -v '*_test.go'
GO_TEST_FILES := $(shell find . -name '*_test.go' -type f | rev | cut -d "/" -f2- | rev | sort -u) GO_TEST_FILES := $(shell find . -name '*_test.go' -type f | rev | cut -d "/" -f2- | rev | sort -u)
GO_BUILD_FILES := $(shell find . -name 'main.go') GO_BUILD_FILES := $(shell find . -name 'main.go')
.PHONY: all dep build clean test coverage coverhtml lint .PHONY: all dep build clean test coverage coverhtml lint doc
all: build all: build doc
# Lint golang files # Lint golang files
lint: lint:
@ -52,8 +52,10 @@ coverage_html: coverage
go tool cover -html=coverage.out go tool cover -html=coverage.out
# Generate documents # Generate documents
docs: doc: lwd-api.html
@echo "Generating docs..."
lwd-api.html: walletrpc/compact_formats.proto walletrpc/service.proto
./docgen.sh $^ >lwd-api.html
# Generate docker image # Generate docker image
docker_img: docker_img:

23
docgen.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
#
# read argument files, construct simple html
echo '<html>'
echo '<head>'
echo '<title>Lightwalletd reference API</title>'
echo '</head>'
echo '<body>'
echo '<h1>Lightwalletd API reference</h1>'
for f
do
echo "<h2>$f</h2>"
echo '<pre>'
# list of reserved words https://developers.google.com/protocol-buffers/docs/proto3
sed <$f '
s/\/\/.*/<font color="grey">&<\/font>/
s/\(^\|[^a-zA-Z_.]\)\(message\|service\|enum\)\($\|[^a-zA-Z_0-9]\)/\1<font color="red">\2<\/font>\3/
s/\(^\|[^a-zA-Z_.]\)\(rpc\|reserved\|repeated\|enum|stream\)\($\|[^a-zA-Z_0-9]\)/\1<font color="green">\2\3<\/font>\3/
s/\(^\|[^a-zA-Z_.]\)\(double\|float\|int32\|int64\|uint32\|uint64\|sint32\|sint64\|fixed32\|fixed64\|sfixed32\|sfixed64\|bool\|string\|bytes\)\($\|[^a-zA-Z_0-9]\)/\1<font color="blue">\2<\/font>\3/'
echo '</pre>'
done
echo '</body>'
echo '</html>'

View File

@ -18,7 +18,6 @@ var (
ErrUnspecified = errors.New("request for unspecified identifier") ErrUnspecified = errors.New("request for unspecified identifier")
) )
// the service type
type LwdStreamer struct { type LwdStreamer struct {
cache *common.BlockCache cache *common.BlockCache
} }
@ -27,6 +26,7 @@ func NewLwdStreamer(cache *common.BlockCache) (walletrpc.CompactTxStreamerServer
return &LwdStreamer{cache}, nil return &LwdStreamer{cache}, nil
} }
// GetLatestBlock returns the height of the best chain, according to zcashd.
func (s *LwdStreamer) GetLatestBlock(ctx context.Context, placeholder *walletrpc.ChainSpec) (*walletrpc.BlockID, error) { func (s *LwdStreamer) GetLatestBlock(ctx context.Context, placeholder *walletrpc.ChainSpec) (*walletrpc.BlockID, error) {
latestBlock := s.cache.GetLatestHeight() latestBlock := s.cache.GetLatestHeight()
@ -38,7 +38,9 @@ func (s *LwdStreamer) GetLatestBlock(ctx context.Context, placeholder *walletrpc
return &walletrpc.BlockID{Height: uint64(latestBlock)}, nil return &walletrpc.BlockID{Height: uint64(latestBlock)}, nil
} }
func (s *LwdStreamer) GetAddressTxids( addressBlockFilter *walletrpc.TransparentAddressBlockFilter, resp walletrpc.CompactTxStreamer_GetAddressTxidsServer) error { // GetAddressTxids is a streaming RPC that returns transaction IDs that have
// the given transparent address (taddr) as either an input or output.
func (s *LwdStreamer) GetAddressTxids(addressBlockFilter *walletrpc.TransparentAddressBlockFilter, resp walletrpc.CompactTxStreamer_GetAddressTxidsServer) error {
// Test to make sure Address is a single t address // Test to make sure Address is a single t address
match, err := regexp.Match("\\At[a-zA-Z0-9]{34}\\z", []byte(addressBlockFilter.Address)) match, err := regexp.Match("\\At[a-zA-Z0-9]{34}\\z", []byte(addressBlockFilter.Address))
if err != nil || !match { if err != nil || !match {
@ -90,6 +92,8 @@ func (s *LwdStreamer) GetAddressTxids( addressBlockFilter *walletrpc.Transparent
return nil return nil
} }
// GetBlock returns the compact block at the requested height. Requesting a
// block by hash is not yet supported.
func (s *LwdStreamer) GetBlock(ctx context.Context, id *walletrpc.BlockID) (*walletrpc.CompactBlock, error) { func (s *LwdStreamer) GetBlock(ctx context.Context, id *walletrpc.BlockID) (*walletrpc.CompactBlock, error) {
if id.Height == 0 && id.Hash == nil { if id.Height == 0 && id.Hash == nil {
return nil, ErrUnspecified return nil, ErrUnspecified
@ -109,6 +113,9 @@ func (s *LwdStreamer) GetBlock(ctx context.Context, id *walletrpc.BlockID) (*wal
return cBlock, err return cBlock, err
} }
// GetBlockRange is a streaming RPC that returns blocks, in compact form,
// (as also returned by GetBlock) from the block height 'start' to height
// 'end' inclusively.
func (s *LwdStreamer) GetBlockRange(span *walletrpc.BlockRange, resp walletrpc.CompactTxStreamer_GetBlockRangeServer) error { func (s *LwdStreamer) GetBlockRange(span *walletrpc.BlockRange, resp walletrpc.CompactTxStreamer_GetBlockRangeServer) error {
blockChan := make(chan walletrpc.CompactBlock) blockChan := make(chan walletrpc.CompactBlock)
errChan := make(chan error) errChan := make(chan error)
@ -129,6 +136,8 @@ func (s *LwdStreamer) GetBlockRange(span *walletrpc.BlockRange, resp walletrpc.C
} }
} }
// GetTransaction returns the raw transaction bytes that are returned
// by the zcashd 'getrawtransaction' RPC.
func (s *LwdStreamer) GetTransaction(ctx context.Context, txf *walletrpc.TxFilter) (*walletrpc.RawTransaction, error) { func (s *LwdStreamer) GetTransaction(ctx context.Context, txf *walletrpc.TxFilter) (*walletrpc.RawTransaction, error) {
if txf.Hash != nil { if txf.Hash != nil {
txid := txf.Hash txid := txf.Hash
@ -167,7 +176,8 @@ func (s *LwdStreamer) GetTransaction(ctx context.Context, txf *walletrpc.TxFilte
return nil, errors.New("Please call GetTransaction with txid") return nil, errors.New("Please call GetTransaction with txid")
} }
// GetLightdInfo gets the LightWalletD (this server) info // GetLightdInfo gets the LightWalletD (this server) info, and includes information
// it gets from its backend zcashd.
func (s *LwdStreamer) GetLightdInfo(ctx context.Context, in *walletrpc.Empty) (*walletrpc.LightdInfo, error) { func (s *LwdStreamer) GetLightdInfo(ctx context.Context, in *walletrpc.Empty) (*walletrpc.LightdInfo, error) {
saplingHeight, blockHeight, chainName, consensusBranchId := common.GetSaplingInfo() saplingHeight, blockHeight, chainName, consensusBranchId := common.GetSaplingInfo()

View File

@ -111,10 +111,10 @@ func (m *CompactBlock) GetVtx() []*CompactTx {
return nil return nil
} }
// Index and hash will allow the receiver to call out to chain
// explorers or other data structures to retrieve more information
// about this transaction.
type CompactTx struct { type CompactTx struct {
// Index and hash will allow the receiver to call out to chain
// explorers or other data structures to retrieve more information
// about this transaction.
Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` Index uint64 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
// The transaction fee: present if server can provide. In the case of a // The transaction fee: present if server can provide. In the case of a

View File

@ -19,10 +19,10 @@ message CompactBlock {
repeated CompactTx vtx = 7; // compact transactions from this block repeated CompactTx vtx = 7; // compact transactions from this block
} }
// Index and hash will allow the receiver to call out to chain
// explorers or other data structures to retrieve more information
// about this transaction.
message CompactTx { message CompactTx {
// Index and hash will allow the receiver to call out to chain
// explorers or other data structures to retrieve more information
// about this transaction.
uint64 index = 1; uint64 index = 1;
bytes hash = 2; bytes hash = 2;

View File

@ -25,7 +25,7 @@ var _ = math.Inf
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// A BlockID message contains identifiers to select a block: a height or a // A BlockID message contains identifiers to select a block: a height or a
// hash. If the hash is present it takes precedence. // hash. Specification by hash is not implemented, but may be in the future.
type BlockID struct { type BlockID struct {
Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
@ -73,9 +73,8 @@ func (m *BlockID) GetHash() []byte {
return nil return nil
} }
// BlockRange technically allows ranging from hash to hash etc but this is not // BlockRange specifies a series of blocks from start to end inclusive.
// currently intended for support, though there is no reason you couldn't do // Both BlockIDs must be heights; specification by hash is not yet supported.
// it. Further permutations are left as an exercise.
type BlockRange struct { type BlockRange struct {
Start *BlockID `protobuf:"bytes,1,opt,name=start,proto3" json:"start,omitempty"` Start *BlockID `protobuf:"bytes,1,opt,name=start,proto3" json:"start,omitempty"`
End *BlockID `protobuf:"bytes,2,opt,name=end,proto3" json:"end,omitempty"` End *BlockID `protobuf:"bytes,2,opt,name=end,proto3" json:"end,omitempty"`
@ -125,6 +124,7 @@ func (m *BlockRange) GetEnd() *BlockID {
// A TxFilter contains the information needed to identify a particular // A TxFilter contains the information needed to identify a particular
// transaction: either a block and an index, or a direct transaction hash. // transaction: either a block and an index, or a direct transaction hash.
// Currently, only specification by hash is supported.
type TxFilter struct { type TxFilter struct {
Block *BlockID `protobuf:"bytes,1,opt,name=block,proto3" json:"block,omitempty"` Block *BlockID `protobuf:"bytes,1,opt,name=block,proto3" json:"block,omitempty"`
Index uint64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` Index uint64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"`
@ -229,6 +229,9 @@ func (m *RawTransaction) GetHeight() uint64 {
return 0 return 0
} }
// A SendResponse encodes an error code and a string. It is currently used
// only by SendTransaction(). If error code is zero, the operation was
// successful; if non-zero, it and the message specify the failure.
type SendResponse struct { type SendResponse struct {
ErrorCode int32 `protobuf:"varint,1,opt,name=errorCode,proto3" json:"errorCode,omitempty"` ErrorCode int32 `protobuf:"varint,1,opt,name=errorCode,proto3" json:"errorCode,omitempty"`
ErrorMessage string `protobuf:"bytes,2,opt,name=errorMessage,proto3" json:"errorMessage,omitempty"` ErrorMessage string `protobuf:"bytes,2,opt,name=errorMessage,proto3" json:"errorMessage,omitempty"`
@ -276,7 +279,7 @@ func (m *SendResponse) GetErrorMessage() string {
return "" return ""
} }
// Empty placeholder. Someday we may want to specify e.g. a particular chain fork. // Chainspec is a placeholder to allow specification of a particular chain fork.
type ChainSpec struct { type ChainSpec struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
@ -308,6 +311,7 @@ func (m *ChainSpec) XXX_DiscardUnknown() {
var xxx_messageInfo_ChainSpec proto.InternalMessageInfo var xxx_messageInfo_ChainSpec proto.InternalMessageInfo
// Empty is for gRPCs that take no arguments, currently only GetLightdInfo.
type Empty struct { type Empty struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
@ -339,6 +343,8 @@ func (m *Empty) XXX_DiscardUnknown() {
var xxx_messageInfo_Empty proto.InternalMessageInfo var xxx_messageInfo_Empty proto.InternalMessageInfo
// The LightdInfo returns various information about this lightwalletd instance
// and the state of the blockchain.
type LightdInfo struct { type LightdInfo struct {
Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
Vendor string `protobuf:"bytes,2,opt,name=vendor,proto3" json:"vendor,omitempty"` Vendor string `protobuf:"bytes,2,opt,name=vendor,proto3" json:"vendor,omitempty"`
@ -426,45 +432,8 @@ func (m *LightdInfo) GetBlockHeight() uint64 {
return 0 return 0
} }
type TransparentAddress struct { // TransparentAddressBlockFilter restricts the results to the given address
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // or block range.
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *TransparentAddress) Reset() { *m = TransparentAddress{} }
func (m *TransparentAddress) String() string { return proto.CompactTextString(m) }
func (*TransparentAddress) ProtoMessage() {}
func (*TransparentAddress) Descriptor() ([]byte, []int) {
return fileDescriptor_a0b84a42fa06f626, []int{8}
}
func (m *TransparentAddress) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TransparentAddress.Unmarshal(m, b)
}
func (m *TransparentAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TransparentAddress.Marshal(b, m, deterministic)
}
func (m *TransparentAddress) XXX_Merge(src proto.Message) {
xxx_messageInfo_TransparentAddress.Merge(m, src)
}
func (m *TransparentAddress) XXX_Size() int {
return xxx_messageInfo_TransparentAddress.Size(m)
}
func (m *TransparentAddress) XXX_DiscardUnknown() {
xxx_messageInfo_TransparentAddress.DiscardUnknown(m)
}
var xxx_messageInfo_TransparentAddress proto.InternalMessageInfo
func (m *TransparentAddress) GetAddress() string {
if m != nil {
return m.Address
}
return ""
}
type TransparentAddressBlockFilter struct { type TransparentAddressBlockFilter struct {
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
Range *BlockRange `protobuf:"bytes,2,opt,name=range,proto3" json:"range,omitempty"` Range *BlockRange `protobuf:"bytes,2,opt,name=range,proto3" json:"range,omitempty"`
@ -477,7 +446,7 @@ func (m *TransparentAddressBlockFilter) Reset() { *m = TransparentAddres
func (m *TransparentAddressBlockFilter) String() string { return proto.CompactTextString(m) } func (m *TransparentAddressBlockFilter) String() string { return proto.CompactTextString(m) }
func (*TransparentAddressBlockFilter) ProtoMessage() {} func (*TransparentAddressBlockFilter) ProtoMessage() {}
func (*TransparentAddressBlockFilter) Descriptor() ([]byte, []int) { func (*TransparentAddressBlockFilter) Descriptor() ([]byte, []int) {
return fileDescriptor_a0b84a42fa06f626, []int{9} return fileDescriptor_a0b84a42fa06f626, []int{8}
} }
func (m *TransparentAddressBlockFilter) XXX_Unmarshal(b []byte) error { func (m *TransparentAddressBlockFilter) XXX_Unmarshal(b []byte) error {
@ -521,55 +490,54 @@ func init() {
proto.RegisterType((*ChainSpec)(nil), "cash.z.wallet.sdk.rpc.ChainSpec") proto.RegisterType((*ChainSpec)(nil), "cash.z.wallet.sdk.rpc.ChainSpec")
proto.RegisterType((*Empty)(nil), "cash.z.wallet.sdk.rpc.Empty") proto.RegisterType((*Empty)(nil), "cash.z.wallet.sdk.rpc.Empty")
proto.RegisterType((*LightdInfo)(nil), "cash.z.wallet.sdk.rpc.LightdInfo") proto.RegisterType((*LightdInfo)(nil), "cash.z.wallet.sdk.rpc.LightdInfo")
proto.RegisterType((*TransparentAddress)(nil), "cash.z.wallet.sdk.rpc.TransparentAddress")
proto.RegisterType((*TransparentAddressBlockFilter)(nil), "cash.z.wallet.sdk.rpc.TransparentAddressBlockFilter") proto.RegisterType((*TransparentAddressBlockFilter)(nil), "cash.z.wallet.sdk.rpc.TransparentAddressBlockFilter")
} }
func init() { proto.RegisterFile("service.proto", fileDescriptor_a0b84a42fa06f626) } func init() { proto.RegisterFile("service.proto", fileDescriptor_a0b84a42fa06f626) }
var fileDescriptor_a0b84a42fa06f626 = []byte{ var fileDescriptor_a0b84a42fa06f626 = []byte{
// 647 bytes of a gzipped FileDescriptorProto // 641 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0xd1, 0x4e, 0x13, 0x41, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xd1, 0x4e, 0x13, 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b, 0xf3, 0x4d, 0x52, 0x83, 0x15, 0xc1, 0x17, 0xeb, 0x2d, 0x1d, 0xbf, 0xe8, 0x57, 0x5e, 0x61, 0x06, 0x36, 0x8e,
0x2b, 0x44, 0xc3, 0xda, 0x21, 0x4e, 0x9b, 0xa8, 0x3f, 0x49, 0x84, 0x21, 0xbb, 0x65, 0xd5, 0xdf, 0x71, 0x2a, 0xa2, 0xfe, 0x24, 0x52, 0x96, 0xed, 0x97, 0x4d, 0x7f, 0x9f, 0xe8, 0x16, 0xbe, 0xd2,
0xd7, 0x74, 0x73, 0x5f, 0x69, 0xbb, 0x4a, 0x98, 0x7f, 0x8d, 0xc2, 0xfc, 0x6f, 0x96, 0xe4, 0xfa, 0x6e, 0x95, 0x09, 0x7a, 0x8d, 0x82, 0x9f, 0xb7, 0x4b, 0x7a, 0xc9, 0xfc, 0x9d, 0xb2, 0xb7, 0xba,
0x8f, 0x45, 0xa7, 0xec, 0xad, 0x6e, 0x08, 0x68, 0x65, 0x7f, 0xf5, 0xa4, 0x99, 0x1d, 0xeb, 0x34, 0x03, 0xe0, 0x95, 0xc3, 0xf5, 0xb3, 0x66, 0x76, 0x6c, 0x92, 0xe0, 0x77, 0xad, 0x72, 0xb1, 0x4c,
0xfa, 0x5b, 0xab, 0x9c, 0x2d, 0xfa, 0xff, 0xc4, 0xab, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x21, 0xff, 0xfd, 0x17, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x08, 0x42, 0x5c, 0xfd, 0x36, 0x06, 0x00,
0x51, 0x32, 0x07, 0x66, 0x06, 0x00, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.

View File

@ -5,15 +5,14 @@ option swift_prefix = "";
import "compact_formats.proto"; import "compact_formats.proto";
// A BlockID message contains identifiers to select a block: a height or a // A BlockID message contains identifiers to select a block: a height or a
// hash. If the hash is present it takes precedence. // hash. Specification by hash is not implemented, but may be in the future.
message BlockID { message BlockID {
uint64 height = 1; uint64 height = 1;
bytes hash = 2; bytes hash = 2;
} }
// BlockRange technically allows ranging from hash to hash etc but this is not // BlockRange specifies a series of blocks from start to end inclusive.
// currently intended for support, though there is no reason you couldn't do // Both BlockIDs must be heights; specification by hash is not yet supported.
// it. Further permutations are left as an exercise.
message BlockRange { message BlockRange {
BlockID start = 1; BlockID start = 1;
BlockID end = 2; BlockID end = 2;
@ -21,6 +20,7 @@ message BlockRange {
// A TxFilter contains the information needed to identify a particular // A TxFilter contains the information needed to identify a particular
// transaction: either a block and an index, or a direct transaction hash. // transaction: either a block and an index, or a direct transaction hash.
// Currently, only specification by hash is supported.
message TxFilter { message TxFilter {
BlockID block = 1; BlockID block = 1;
uint64 index = 2; uint64 index = 2;
@ -34,30 +34,34 @@ message RawTransaction {
uint64 height = 2; uint64 height = 2;
} }
// A SendResponse encodes an error code and a string. It is currently used
// only by SendTransaction(). If error code is zero, the operation was
// successful; if non-zero, it and the message specify the failure.
message SendResponse { message SendResponse {
int32 errorCode = 1; int32 errorCode = 1;
string errorMessage = 2; string errorMessage = 2;
} }
// Empty placeholder. Someday we may want to specify e.g. a particular chain fork. // Chainspec is a placeholder to allow specification of a particular chain fork.
message ChainSpec {} message ChainSpec {}
// Empty is for gRPCs that take no arguments, currently only GetLightdInfo.
message Empty {} message Empty {}
// The LightdInfo returns various information about this lightwalletd instance
// and the state of the blockchain.
message LightdInfo { message LightdInfo {
string version = 1; string version = 1;
string vendor = 2; string vendor = 2;
bool taddrSupport = 3; bool taddrSupport = 3;
string chainName = 4; string chainName = 4;
uint64 saplingActivationHeight = 5; uint64 saplingActivationHeight = 5;
string consensusBranchId = 6; // This should really be u32 or []byte, but string for readability string consensusBranchId = 6;
uint64 blockHeight = 7; uint64 blockHeight = 7;
} }
message TransparentAddress { // TransparentAddressBlockFilter restricts the results to the given address
string address = 1; // or block range.
}
message TransparentAddressBlockFilter { message TransparentAddressBlockFilter {
string address = 1; string address = 1;
BlockRange range = 2; BlockRange range = 2;