23
README.md
23
README.md
@@ -1,11 +1,13 @@
|
|||||||
# Overview
|
# Overview
|
||||||
|
|
||||||
Zecwallet lightwalletd is a fork of [lightwalletd](https://github.com/adityapk00/lightwalletd) from the ECC.
|
SilentDragonLite (SDL) is a fork of Zecwallet lightwalletd, which is a fork of [lightwalletd](https://github.com/adityapk00/lightwalletd) from the ECC.
|
||||||
|
|
||||||
It is a backend service that provides a bandwidth-efficient interface to the Zcash blockchain for the [Zecwallet light wallet](https://github.com/adityapk00/zecwallet-lite-lib).
|
It is a backend service that provides a bandwidth-efficient interface to the Hush blockchain for the [SilentDragonLite cli](https://github.com/MyHush/zecwallet-light-cli).
|
||||||
|
|
||||||
## Changes from upstream lightwalletd
|
## Changes from upstream lightwalletd
|
||||||
This version of Zecwallet lightwalletd extends lightwalletd and:
|
This version of lightwalletd extends lightwalletd and:
|
||||||
|
|
||||||
|
* Adds support for HUSH
|
||||||
* Adds support for transparent addresses
|
* Adds support for transparent addresses
|
||||||
* Adds several new RPC calls for lightclients
|
* Adds several new RPC calls for lightclients
|
||||||
* Lots of perf improvements
|
* Lots of perf improvements
|
||||||
@@ -13,7 +15,7 @@ This version of Zecwallet lightwalletd extends lightwalletd and:
|
|||||||
* Replace local Txstore, delegating Tx lookups to Zcashd
|
* Replace local Txstore, delegating Tx lookups to Zcashd
|
||||||
* Remove the need for a separate ingestor
|
* Remove the need for a separate ingestor
|
||||||
|
|
||||||
## Running your own zeclite lightwalletd
|
## Running your own SDL lightwalletd
|
||||||
|
|
||||||
#### 0. First, install [Go >= 1.11](https://golang.org/dl/#stable).
|
#### 0. First, install [Go >= 1.11](https://golang.org/dl/#stable).
|
||||||
|
|
||||||
@@ -23,25 +25,24 @@ openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -node
|
|||||||
```
|
```
|
||||||
Answer the certificate questions to generate the self-signed certificate
|
Answer the certificate questions to generate the self-signed certificate
|
||||||
|
|
||||||
#### 2. You need to run a zcash full node with the following options in zcash.conf
|
#### 2. You need to run a full node with the following options in HUSH3.conf
|
||||||
```
|
```
|
||||||
server=1
|
server=1
|
||||||
rpcuser=user
|
rpcuser=user
|
||||||
rpcpassword=password
|
rpcpassword=password
|
||||||
rpcbind=127.0.0.1
|
rpcbind=127.0.0.1
|
||||||
rpcport=8232
|
|
||||||
experimentalfeatures=1
|
|
||||||
txindex=1
|
txindex=1
|
||||||
insightexplorer=1
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 3. Run the frontend:
|
#### 3. Run the frontend:
|
||||||
You'll need to use the certificate generated from step 1
|
You'll need to use the certificate generated from step 1
|
||||||
|
|
||||||
```
|
```
|
||||||
go run cmd/server/main.go -bind-addr 127.0.0.1:9067 -conf-file ~/.zcash/zcash.conf -tls-cert cert.pem -tls-key key.pem
|
go run cmd/server/main.go -bind-addr 127.0.0.1:9067 -conf-file ~/.komodo/HUSH3/HUSH3.conf -tls-cert cert.pem -tls-key key.pem
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 4. Point the `zecwallet-cli` to this server
|
#### 4. Point the `silentdragon-cli` to this server
|
||||||
```
|
```
|
||||||
./zecwallet-cli --server https://127.0.0.1:9067 --dangerous
|
./silentdragon-cli --server https://127.0.0.1:9067 --dangerous
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ type Options struct {
|
|||||||
bindAddr string `json:"bind_address,omitempty"`
|
bindAddr string `json:"bind_address,omitempty"`
|
||||||
tlsCertPath string `json:"tls_cert_path,omitempty"`
|
tlsCertPath string `json:"tls_cert_path,omitempty"`
|
||||||
tlsKeyPath string `json:"tls_cert_key,omitempty"`
|
tlsKeyPath string `json:"tls_cert_key,omitempty"`
|
||||||
|
noTLS bool `json:no_tls,omitempty`
|
||||||
logLevel uint64 `json:"log_level,omitempty"`
|
logLevel uint64 `json:"log_level,omitempty"`
|
||||||
logPath string `json:"log_file,omitempty"`
|
logPath string `json:"log_file,omitempty"`
|
||||||
hush3ConfPath string `json:"hush3_conf,omitempty"`
|
hush3ConfPath string `json:"hush3_conf,omitempty"`
|
||||||
@@ -90,6 +91,7 @@ func main() {
|
|||||||
flag.StringVar(&opts.bindAddr, "bind-addr", "127.0.0.1:9069", "the address to listen on")
|
flag.StringVar(&opts.bindAddr, "bind-addr", "127.0.0.1:9069", "the address to listen on")
|
||||||
flag.StringVar(&opts.tlsCertPath, "tls-cert", "", "the path to a TLS certificate (optional)")
|
flag.StringVar(&opts.tlsCertPath, "tls-cert", "", "the path to a TLS certificate (optional)")
|
||||||
flag.StringVar(&opts.tlsKeyPath, "tls-key", "", "the path to a TLS key file (optional)")
|
flag.StringVar(&opts.tlsKeyPath, "tls-key", "", "the path to a TLS key file (optional)")
|
||||||
|
flag.BoolVar(&opts.noTLS, "no-tls", false, "Disable TLS, serve un-encrypted traffic.")
|
||||||
flag.Uint64Var(&opts.logLevel, "log-level", uint64(logrus.InfoLevel), "log level (logrus 1-7)")
|
flag.Uint64Var(&opts.logLevel, "log-level", uint64(logrus.InfoLevel), "log level (logrus 1-7)")
|
||||||
flag.StringVar(&opts.logPath, "log-file", "", "log file to write to")
|
flag.StringVar(&opts.logPath, "log-file", "", "log file to write to")
|
||||||
flag.StringVar(&opts.hush3ConfPath, "conf-file", "", "conf file to pull RPC creds from")
|
flag.StringVar(&opts.hush3ConfPath, "conf-file", "", "conf file to pull RPC creds from")
|
||||||
@@ -104,7 +106,7 @@ func main() {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.tlsCertPath == "" || opts.tlsKeyPath == "" {
|
if !opts.noTLS && (opts.tlsCertPath == "" || opts.tlsKeyPath == "") {
|
||||||
println("Please specify a TLS certificate/key to use. You can use a self-signed certificate.")
|
println("Please specify a TLS certificate/key to use. You can use a self-signed certificate.")
|
||||||
println("See 'https://github.com/DenioD/lightwalletd/blob/master/README.md#running-your-own-hushlite-lightwalletd'")
|
println("See 'https://github.com/DenioD/lightwalletd/blob/master/README.md#running-your-own-hushlite-lightwalletd'")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
@@ -129,7 +131,7 @@ func main() {
|
|||||||
// gRPC initialization
|
// gRPC initialization
|
||||||
var server *grpc.Server
|
var server *grpc.Server
|
||||||
|
|
||||||
if opts.tlsCertPath != "" && opts.tlsKeyPath != "" {
|
if !opts.noTLS && (opts.tlsCertPath != "" && opts.tlsKeyPath != "") {
|
||||||
transportCreds, err := credentials.NewServerTLSFromFile(opts.tlsCertPath, opts.tlsKeyPath)
|
transportCreds, err := credentials.NewServerTLSFromFile(opts.tlsCertPath, opts.tlsKeyPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(logrus.Fields{
|
log.WithFields(logrus.Fields{
|
||||||
@@ -168,14 +170,24 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the sapling activation height from the RPC
|
// Get the sapling activation height from the RPC
|
||||||
saplingHeight, blockHeight, chainName, branchID, err := common.GetSaplingInfo(rpcClient)
|
saplingHeight, blockHeight, chainName, branchID, difficulty, longestchain, notarized, err := common.GetSaplingInfo(rpcClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(logrus.Fields{
|
log.WithFields(logrus.Fields{
|
||||||
"error": err,
|
"error": err,
|
||||||
}).Warn("Unable to get sapling activation height")
|
}).Warn("Unable to get sapling activation height")
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("Got sapling height ", saplingHeight, " chain ", chainName, " branchID ", branchID)
|
log.Info("Got sapling height ", saplingHeight, " chain ", chainName, " branchID ", branchID," difficulty ", difficulty,longestchain, " longestchain ",notarized," notarized ")
|
||||||
|
|
||||||
|
// Get the Coinsupply from the RPC
|
||||||
|
result, coin, height, supply, zfunds, total, err := common.GetCoinsupply(rpcClient)
|
||||||
|
if err != nil {
|
||||||
|
log.WithFields(logrus.Fields{
|
||||||
|
"error": err,
|
||||||
|
}).Warn("Unable to get coinsupply")
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Info( " result ", result, " coin ", coin," height", height, "supply", supply ,"zfunds", zfunds, "total", total)
|
||||||
|
|
||||||
// Initialize the cache
|
// Initialize the cache
|
||||||
cache := common.NewBlockCache(opts.cacheSize)
|
cache := common.NewBlockCache(opts.cacheSize)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import (
|
|||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetSaplingInfo(rpcClient *rpcclient.Client) (int, int, string, string, error) {
|
func GetSaplingInfo(rpcClient *rpcclient.Client) (int, int, string, string, int,int,int, error) {
|
||||||
result, rpcErr := rpcClient.RawRequest("getblockchaininfo", make([]json.RawMessage, 0))
|
result, rpcErr := rpcClient.RawRequest("getblockchaininfo", make([]json.RawMessage, 0))
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
@@ -27,15 +27,15 @@ func GetSaplingInfo(rpcClient *rpcclient.Client) (int, int, string, string, erro
|
|||||||
errCode, err = strconv.ParseInt(errParts[0], 10, 32)
|
errCode, err = strconv.ParseInt(errParts[0], 10, 32)
|
||||||
//Check to see if we are requesting a height the hushd doesn't have yet
|
//Check to see if we are requesting a height the hushd doesn't have yet
|
||||||
if err == nil && errCode == -8 {
|
if err == nil && errCode == -8 {
|
||||||
return -1, -1, "", "", nil
|
return -1, -1, "", "",-1,-1,-1, nil
|
||||||
}
|
}
|
||||||
return -1, -1, "", "", errors.Wrap(rpcErr, "error requesting block")
|
return -1, -1, "", "",-1,-1,-1, errors.Wrap(rpcErr, "error requesting block")
|
||||||
}
|
}
|
||||||
|
|
||||||
var f interface{}
|
var f interface{}
|
||||||
err = json.Unmarshal(result, &f)
|
err = json.Unmarshal(result, &f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return -1, -1, "", "", errors.Wrap(err, "error reading JSON response")
|
return -1, -1, "", "",-1,-1,-1, errors.Wrap(err, "error reading JSON response")
|
||||||
}
|
}
|
||||||
|
|
||||||
chainName := f.(map[string]interface{})["chain"].(string)
|
chainName := f.(map[string]interface{})["chain"].(string)
|
||||||
@@ -45,11 +45,48 @@ func GetSaplingInfo(rpcClient *rpcclient.Client) (int, int, string, string, erro
|
|||||||
saplingHeight := saplingJSON.(map[string]interface{})["activationheight"].(float64)
|
saplingHeight := saplingJSON.(map[string]interface{})["activationheight"].(float64)
|
||||||
|
|
||||||
blockHeight := f.(map[string]interface{})["headers"].(float64)
|
blockHeight := f.(map[string]interface{})["headers"].(float64)
|
||||||
|
difficulty := f.(map[string]interface{})["difficulty"].(float64)
|
||||||
|
longestchain := f.(map[string]interface{})["longestchain"].(float64)
|
||||||
|
notarized := f.(map[string]interface{})["notarized"].(float64)
|
||||||
|
|
||||||
consensus := f.(map[string]interface{})["consensus"]
|
consensus := f.(map[string]interface{})["consensus"]
|
||||||
branchID := consensus.(map[string]interface{})["nextblock"].(string)
|
branchID := consensus.(map[string]interface{})["nextblock"].(string)
|
||||||
|
|
||||||
return int(saplingHeight), int(blockHeight), chainName, branchID, nil
|
return int(saplingHeight), int(blockHeight), chainName, branchID, int(difficulty), int(longestchain), int(notarized), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetCoinsupply(rpcClient *rpcclient.Client) (string, string, int, int, int,int, error) {
|
||||||
|
result1, rpcErr := rpcClient.RawRequest("coinsupply", make([]json.RawMessage, 0))
|
||||||
|
|
||||||
|
var err error
|
||||||
|
var errCode int64
|
||||||
|
|
||||||
|
|
||||||
|
// For some reason, the error responses are not JSON
|
||||||
|
if rpcErr != nil {
|
||||||
|
errParts := strings.SplitN(rpcErr.Error(), ":", 2)
|
||||||
|
errCode, err = strconv.ParseInt(errParts[0], 10, 32)
|
||||||
|
//Check to see if we are requesting a height the hushd doesn't have yet
|
||||||
|
if err == nil && errCode == -8 {
|
||||||
|
return "","", -1, -1,-1,-1, nil
|
||||||
|
}
|
||||||
|
return "","", -1, -1,-1,-1, errors.Wrap(rpcErr, "error requesting coinsupply")
|
||||||
|
}
|
||||||
|
|
||||||
|
var f interface{}
|
||||||
|
err = json.Unmarshal(result1, &f)
|
||||||
|
if err != nil {
|
||||||
|
return "","", -1, -1,-1,-1, errors.Wrap(err, "error reading JSON response")
|
||||||
|
}
|
||||||
|
|
||||||
|
result := f.(map[string]interface{})["result"].(string)
|
||||||
|
coin := f.(map[string]interface{})["coin"].(string)
|
||||||
|
height := f.(map[string]interface{})["height"].(float64)
|
||||||
|
supply := f.(map[string]interface{})["supply"].(float64)
|
||||||
|
zfunds := f.(map[string]interface{})["zfunds"].(float64)
|
||||||
|
total := f.(map[string]interface{})["total"].(float64)
|
||||||
|
|
||||||
|
return result,coin, int(height), int(supply),int(zfunds), int(total), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getBlockFromRPC(rpcClient *rpcclient.Client, height int) (*walletrpc.CompactBlock, error) {
|
func getBlockFromRPC(rpcClient *rpcclient.Client, height int) (*walletrpc.CompactBlock, error) {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
"regexp"
|
||||||
|
|
||||||
"github.com/btcsuite/btcd/rpcclient"
|
"github.com/btcsuite/btcd/rpcclient"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
@@ -51,7 +52,17 @@ func (s *SqlStreamer) GetLatestBlock(ctx context.Context, placeholder *walletrpc
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *SqlStreamer) GetAddressTxids(addressBlockFilter *walletrpc.TransparentAddressBlockFilter, resp walletrpc.CompactTxStreamer_GetAddressTxidsServer) error {
|
func (s *SqlStreamer) GetAddressTxids(addressBlockFilter *walletrpc.TransparentAddressBlockFilter, resp walletrpc.CompactTxStreamer_GetAddressTxidsServer) error {
|
||||||
params := make([]json.RawMessage, 1)
|
var err error
|
||||||
|
var errCode int64
|
||||||
|
|
||||||
|
// Test to make sure Address is a single t address
|
||||||
|
match, err := regexp.Match("^R[a-zA-Z0-9]{33}$", []byte(addressBlockFilter.Address))
|
||||||
|
if err != nil || !match {
|
||||||
|
s.log.Errorf("Unrecognized address: %s", addressBlockFilter.Address)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
params := make([]json.RawMessage, 1)
|
||||||
st := "{\"addresses\": [\"" + addressBlockFilter.Address + "\"]," +
|
st := "{\"addresses\": [\"" + addressBlockFilter.Address + "\"]," +
|
||||||
"\"start\": " + strconv.FormatUint(addressBlockFilter.Range.Start.Height, 10) +
|
"\"start\": " + strconv.FormatUint(addressBlockFilter.Range.Start.Height, 10) +
|
||||||
", \"end\": " + strconv.FormatUint(addressBlockFilter.Range.End.Height, 10) + "}"
|
", \"end\": " + strconv.FormatUint(addressBlockFilter.Range.End.Height, 10) + "}"
|
||||||
@@ -60,8 +71,6 @@ func (s *SqlStreamer) GetAddressTxids(addressBlockFilter *walletrpc.TransparentA
|
|||||||
|
|
||||||
result, rpcErr := s.client.RawRequest("getaddresstxids", params)
|
result, rpcErr := s.client.RawRequest("getaddresstxids", params)
|
||||||
|
|
||||||
var err error
|
|
||||||
var errCode int64
|
|
||||||
|
|
||||||
// For some reason, the error responses are not JSON
|
// For some reason, the error responses are not JSON
|
||||||
if rpcErr != nil {
|
if rpcErr != nil {
|
||||||
@@ -229,7 +238,7 @@ func (s *SqlStreamer) GetTransaction(ctx context.Context, txf *walletrpc.TxFilte
|
|||||||
|
|
||||||
// GetLightdInfo gets the LightWalletD (this server) info
|
// GetLightdInfo gets the LightWalletD (this server) info
|
||||||
func (s *SqlStreamer) GetLightdInfo(ctx context.Context, in *walletrpc.Empty) (*walletrpc.LightdInfo, error) {
|
func (s *SqlStreamer) GetLightdInfo(ctx context.Context, in *walletrpc.Empty) (*walletrpc.LightdInfo, error) {
|
||||||
saplingHeight, blockHeight, chainName, consensusBranchId, err := common.GetSaplingInfo(s.client)
|
saplingHeight, blockHeight, chainName, consensusBranchId, difficulty, longestchain, notarized, err := common.GetSaplingInfo(s.client)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.log.WithFields(logrus.Fields{
|
s.log.WithFields(logrus.Fields{
|
||||||
@@ -248,9 +257,36 @@ func (s *SqlStreamer) GetLightdInfo(ctx context.Context, in *walletrpc.Empty) (*
|
|||||||
SaplingActivationHeight: uint64(saplingHeight),
|
SaplingActivationHeight: uint64(saplingHeight),
|
||||||
ConsensusBranchId: consensusBranchId,
|
ConsensusBranchId: consensusBranchId,
|
||||||
BlockHeight: uint64(blockHeight),
|
BlockHeight: uint64(blockHeight),
|
||||||
|
Difficulty: uint64(difficulty),
|
||||||
|
Longestchain: uint64(longestchain),
|
||||||
|
Notarized: uint64(notarized),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetCoinsupply gets the Coinsupply info
|
||||||
|
func (s *SqlStreamer) GetCoinsupply(ctx context.Context, in *walletrpc.Empty) (*walletrpc.Coinsupply, error) {
|
||||||
|
result, coin, height, supply, zfunds,total, err := common.GetCoinsupply(s.client)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
s.log.WithFields(logrus.Fields{
|
||||||
|
"error": err,
|
||||||
|
}).Warn("Unable to get Coinsupply")
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO these are called Error but they aren't at the moment.
|
||||||
|
// A success will return code 0 and message txhash.
|
||||||
|
return &walletrpc.Coinsupply{
|
||||||
|
Result: result,
|
||||||
|
Coin: coin,
|
||||||
|
Height: uint64(height),
|
||||||
|
Supply: uint64(supply),
|
||||||
|
Zfunds: uint64(zfunds),
|
||||||
|
Total: uint64(total),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// SendTransaction forwards raw transaction bytes to a hushd instance over JSON-RPC
|
// SendTransaction forwards raw transaction bytes to a hushd instance over JSON-RPC
|
||||||
func (s *SqlStreamer) SendTransaction(ctx context.Context, rawtx *walletrpc.RawTransaction) (*walletrpc.SendResponse, error) {
|
func (s *SqlStreamer) SendTransaction(ctx context.Context, rawtx *walletrpc.RawTransaction) (*walletrpc.SendResponse, error) {
|
||||||
// sendrawtransaction "hexstring" ( allowhighfees )
|
// sendrawtransaction "hexstring" ( allowhighfees )
|
||||||
|
|||||||
@@ -347,6 +347,9 @@ type LightdInfo struct {
|
|||||||
SaplingActivationHeight uint64 `protobuf:"varint,5,opt,name=saplingActivationHeight,proto3" json:"saplingActivationHeight,omitempty"`
|
SaplingActivationHeight uint64 `protobuf:"varint,5,opt,name=saplingActivationHeight,proto3" json:"saplingActivationHeight,omitempty"`
|
||||||
ConsensusBranchId string `protobuf:"bytes,6,opt,name=consensusBranchId,proto3" json:"consensusBranchId,omitempty"`
|
ConsensusBranchId string `protobuf:"bytes,6,opt,name=consensusBranchId,proto3" json:"consensusBranchId,omitempty"`
|
||||||
BlockHeight uint64 `protobuf:"varint,7,opt,name=blockHeight,proto3" json:"blockHeight,omitempty"`
|
BlockHeight uint64 `protobuf:"varint,7,opt,name=blockHeight,proto3" json:"blockHeight,omitempty"`
|
||||||
|
Difficulty uint64 `protobuf:"varint,8,opt,name=difficulty,proto3" json:"difficulty,omitempty"`
|
||||||
|
Longestchain uint64 `protobuf:"varint,9,opt,name=longestchain,proto3" json:"longestchain,omitempty"`
|
||||||
|
Notarized uint64 `protobuf:"varint,10,opt,name=notarized,proto3" json:"notarized,omitempty"`
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
XXX_unrecognized []byte `json:"-"`
|
XXX_unrecognized []byte `json:"-"`
|
||||||
XXX_sizecache int32 `json:"-"`
|
XXX_sizecache int32 `json:"-"`
|
||||||
@@ -418,6 +421,24 @@ func (m *LightdInfo) GetConsensusBranchId() string {
|
|||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
func (m *LightdInfo) Getdifficulty() uint64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Difficulty
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
func (m *LightdInfo) Getlongestchain() uint64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Longestchain
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
func (m *LightdInfo) Getnotarized() uint64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Notarized
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
func (m *LightdInfo) GetBlockHeight() uint64 {
|
func (m *LightdInfo) GetBlockHeight() uint64 {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
@@ -426,6 +447,85 @@ func (m *LightdInfo) GetBlockHeight() uint64 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Coinsupply struct {
|
||||||
|
Result string `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"`
|
||||||
|
Coin string `protobuf:"bytes,2,opt,name=coin,proto3" json:"coin,omitempty"`
|
||||||
|
Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"`
|
||||||
|
Supply uint64 `protobuf:"varint,4,opt,name=supply,proto3" json:"supply,omitempty"`
|
||||||
|
Zfunds uint64 `protobuf:"varint,5,opt,name=zfunds,proto3" json:"zfunds,omitempty"`
|
||||||
|
Total uint64 `protobuf:"varint,6,opt,name=total,proto3" json:"total,omitempty"`
|
||||||
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
|
XXX_unrecognized []byte `json:"-"`
|
||||||
|
XXX_sizecache int32 `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Coinsupply) Reset() { *m = Coinsupply{} }
|
||||||
|
func (m *Coinsupply) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*Coinsupply) ProtoMessage() {}
|
||||||
|
func (*Coinsupply) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_a0b84a42fa06f626, []int{7}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Coinsupply) XXX_Unmarshal(b []byte) error {
|
||||||
|
return xxx_messageInfo_Coinsupply.Unmarshal(m, b)
|
||||||
|
}
|
||||||
|
func (m *Coinsupply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
return xxx_messageInfo_Coinsupply.Marshal(b, m, deterministic)
|
||||||
|
}
|
||||||
|
func (m *Coinsupply) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_Coinsupply.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *Coinsupply) XXX_Size() int {
|
||||||
|
return xxx_messageInfo_Coinsupply.Size(m)
|
||||||
|
}
|
||||||
|
func (m *Coinsupply) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_Coinsupply.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_Coinsupply proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *Coinsupply) GetResult() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Result
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Coinsupply) GetCoin() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Coin
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Coinsupply) GetHeight() uint64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Height
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Coinsupply) GetSupply() uint64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Supply
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Coinsupply) GetZfunds() uint64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Zfunds
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Coinsupply) GetTotal() uint64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Total
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
type TransparentAddress struct {
|
type TransparentAddress 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"`
|
||||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||||
@@ -521,6 +621,7 @@ 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((*Coinsupply)(nil), "cash.z.wallet.sdk.rpc.Coinsupply")
|
||||||
proto.RegisterType((*TransparentAddress)(nil), "cash.z.wallet.sdk.rpc.TransparentAddress")
|
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")
|
||||||
}
|
}
|
||||||
@@ -595,6 +696,7 @@ type CompactTxStreamerClient interface {
|
|||||||
GetAddressTxids(ctx context.Context, in *TransparentAddressBlockFilter, opts ...grpc.CallOption) (CompactTxStreamer_GetAddressTxidsClient, error)
|
GetAddressTxids(ctx context.Context, in *TransparentAddressBlockFilter, opts ...grpc.CallOption) (CompactTxStreamer_GetAddressTxidsClient, error)
|
||||||
// Misc
|
// Misc
|
||||||
GetLightdInfo(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*LightdInfo, error)
|
GetLightdInfo(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*LightdInfo, error)
|
||||||
|
GetCoinsupply(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Coinsupply, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type compactTxStreamerClient struct {
|
type compactTxStreamerClient struct {
|
||||||
@@ -713,6 +815,14 @@ func (c *compactTxStreamerClient) GetLightdInfo(ctx context.Context, in *Empty,
|
|||||||
}
|
}
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
func (c *compactTxStreamerClient) GetCoinsupply(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Coinsupply, error) {
|
||||||
|
out := new(Coinsupply)
|
||||||
|
err := c.cc.Invoke(ctx, "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetCoinsupply", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
// CompactTxStreamerServer is the server API for CompactTxStreamer service.
|
// CompactTxStreamerServer is the server API for CompactTxStreamer service.
|
||||||
type CompactTxStreamerServer interface {
|
type CompactTxStreamerServer interface {
|
||||||
@@ -727,6 +837,7 @@ type CompactTxStreamerServer interface {
|
|||||||
GetAddressTxids(*TransparentAddressBlockFilter, CompactTxStreamer_GetAddressTxidsServer) error
|
GetAddressTxids(*TransparentAddressBlockFilter, CompactTxStreamer_GetAddressTxidsServer) error
|
||||||
// Misc
|
// Misc
|
||||||
GetLightdInfo(context.Context, *Empty) (*LightdInfo, error)
|
GetLightdInfo(context.Context, *Empty) (*LightdInfo, error)
|
||||||
|
GetCoinsupply(context.Context, *Empty) (*Coinsupply, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnimplementedCompactTxStreamerServer can be embedded to have forward compatible implementations.
|
// UnimplementedCompactTxStreamerServer can be embedded to have forward compatible implementations.
|
||||||
@@ -754,6 +865,9 @@ func (*UnimplementedCompactTxStreamerServer) GetAddressTxids(req *TransparentAdd
|
|||||||
func (*UnimplementedCompactTxStreamerServer) GetLightdInfo(ctx context.Context, req *Empty) (*LightdInfo, error) {
|
func (*UnimplementedCompactTxStreamerServer) GetLightdInfo(ctx context.Context, req *Empty) (*LightdInfo, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetLightdInfo not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GetLightdInfo not implemented")
|
||||||
}
|
}
|
||||||
|
func (*UnimplementedCompactTxStreamerServer) GetCoinsupply(ctx context.Context, req *Empty) (*Coinsupply, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method GetCoinsupply not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
func RegisterCompactTxStreamerServer(s *grpc.Server, srv CompactTxStreamerServer) {
|
func RegisterCompactTxStreamerServer(s *grpc.Server, srv CompactTxStreamerServer) {
|
||||||
s.RegisterService(&_CompactTxStreamer_serviceDesc, srv)
|
s.RegisterService(&_CompactTxStreamer_serviceDesc, srv)
|
||||||
@@ -891,6 +1005,24 @@ func _CompactTxStreamer_GetLightdInfo_Handler(srv interface{}, ctx context.Conte
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _CompactTxStreamer_GetCoinsupply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(Empty)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(CompactTxStreamerServer).GetCoinsupply(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/cash.z.wallet.sdk.rpc.CompactTxStreamer/GetCoinsupply",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(CompactTxStreamerServer).GetCoinsupply(ctx, req.(*Empty))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
var _CompactTxStreamer_serviceDesc = grpc.ServiceDesc{
|
var _CompactTxStreamer_serviceDesc = grpc.ServiceDesc{
|
||||||
ServiceName: "cash.z.wallet.sdk.rpc.CompactTxStreamer",
|
ServiceName: "cash.z.wallet.sdk.rpc.CompactTxStreamer",
|
||||||
HandlerType: (*CompactTxStreamerServer)(nil),
|
HandlerType: (*CompactTxStreamerServer)(nil),
|
||||||
@@ -915,6 +1047,10 @@ var _CompactTxStreamer_serviceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "GetLightdInfo",
|
MethodName: "GetLightdInfo",
|
||||||
Handler: _CompactTxStreamer_GetLightdInfo_Handler,
|
Handler: _CompactTxStreamer_GetLightdInfo_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetCoinsupply",
|
||||||
|
Handler: _CompactTxStreamer_GetCoinsupply_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{
|
Streams: []grpc.StreamDesc{
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -52,6 +52,17 @@ message LightdInfo {
|
|||||||
uint64 saplingActivationHeight = 5;
|
uint64 saplingActivationHeight = 5;
|
||||||
string consensusBranchId = 6; // This should really be u32 or []byte, but string for readability
|
string consensusBranchId = 6; // This should really be u32 or []byte, but string for readability
|
||||||
uint64 blockHeight = 7;
|
uint64 blockHeight = 7;
|
||||||
|
uint64 difficulty = 8;
|
||||||
|
uint64 longestchain = 9;
|
||||||
|
uint64 notarized = 10;
|
||||||
|
}
|
||||||
|
message Coinsupply {
|
||||||
|
string result = 1;
|
||||||
|
string coin = 2;
|
||||||
|
uint64 height = 3;
|
||||||
|
uint64 supply = 4;
|
||||||
|
uint64 zfunds = 5;
|
||||||
|
uint64 total = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
message TransparentAddress {
|
message TransparentAddress {
|
||||||
@@ -78,4 +89,5 @@ service CompactTxStreamer {
|
|||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
rpc GetLightdInfo(Empty) returns (LightdInfo) {}
|
rpc GetLightdInfo(Empty) returns (LightdInfo) {}
|
||||||
|
rpc GetCoinsupply(Empty) returns (Coinsupply) {}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user