Compare commits

...

16 Commits

  1. 2
      AUTHORS
  2. 24
      Makefile
  3. 50
      README.md
  4. 6
      cmd/root.go
  5. 2
      cmd/root_test.go
  6. 2
      cmd/version.go
  7. 4
      common/cache.go
  8. 21
      common/common.go
  9. 4
      common/generatecerts.go
  10. 3
      common/logging/logging.go
  11. 2
      common/logging/logging_test.go
  12. 2
      common/mempool.go
  13. 28
      contrib/debian/changelog
  14. 7
      contrib/debian/control
  15. 4
      contrib/debian/copyright
  16. 5
      contrib/debian/files
  17. 83
      doc/man/lightwalletd.1
  18. 12
      frontend/rpc_client.go
  19. 4
      frontend/service.go
  20. 2
      main.go
  21. 2
      parser/block.go
  22. 2
      parser/block_header.go
  23. 3
      parser/block_header_test.go
  24. 3
      parser/block_test.go
  25. 3
      parser/fuzz.go
  26. 2
      parser/internal/bytestring/bytestring.go
  27. 3
      parser/internal/bytestring/bytestring_test.go
  28. 4
      parser/transaction.go
  29. 3
      parser/transaction_test.go
  30. 2
      parser/util.go
  31. 2
      start-tls.sh
  32. 2
      start.sh
  33. 37
      util/RELEASE-new-version.sh
  34. 105
      util/build-debian-package-SBC.sh
  35. 58
      util/build-debian-package.sh
  36. 2
      util/build.sh
  37. 2
      walletrpc/compact_formats.pb.go
  38. 2
      walletrpc/compact_formats.proto
  39. 3
      walletrpc/generate.go
  40. 2
      walletrpc/service.pb.go
  41. 6
      walletrpc/service.proto
  42. 12
      walletrpc/service_grpc.pb.go

2
AUTHORS

@ -1,4 +1,4 @@
# The Hush Developers
Jahway603 https://git.hush.is/jahway603 https://github.com/jahway603
jahway603 https://git.hush.is/jahway603 https://codeberg.org/jahway603 https://github.com/jahway603
Duke Leto https://git.hush.is/duke

24
Makefile

@ -1,26 +1,28 @@
# Copyright (c) 2021-2023 Jahway603 & The Hush Developers
# Copyright (c) 2021-2024 Jahway603 & The Hush Developers
# Released under the GPLv3
#
# Hush Lightwalletd Makefile
# author: jahway603
#
.PHONY: format help
# Help system from https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.DEFAULT_GOAL := help
PROJECT_NAME := "lightwalletd"
GOCMD=go
GOTEST=$(GOCMD) test
GOVET=$(GOCMD) vet
#.PHONY: build
help:
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
build:
# Build binary
build: ## Build binary for amd64 (x86_64) architecture
./util/build.sh
build-arm:
# Build binary for ARM architecture (aarch64)
build-arm: ## Build binary for ARM architecture (aarch64)
GOOS=linux GOARCH=arm64 ./util/build.sh
protobuf:
# Generate protobuf shizzle
protobuf: ## Generate protobuf shizzle
cd walletrpc && protoc --go_out=paths=source_relative:. service.proto compact_formats.proto && protoc --go-grpc_out=paths=source_relative:. service.proto
# Stop the hushd process in the hushdlwd container
@ -31,13 +33,13 @@ protobuf:
#docker_remove_all:
# docker system prune -f
dep:
dep: ## Pull dependencies (if needed)
@go get -v -d ./...
vendor:
vendor: ## Pull vendor files locally (if needed)
go mod tidy && go mod vendor
clean:
clean: ## Clean the project
@echo "Cleaning project $(PROJECT_NAME) files..."
rm -f $(PROJECT_NAME)
rm -rf /tmp/$(PROJECT_NAME)-*

50
README.md

@ -82,7 +82,10 @@ server {
# Replace 9067 with the port of your gRPC server if using a custom port
# Hush Smart Chains should use a different port than 9067 so it doesn't conflict with HUSH lightwalletd
# NOTE: it's only safe to use --no-tls on lightwalletd if this is on localhost
grpc_pass grpc://localhost:9067;
grpc_pass grpc://localhost:9067;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
```
@ -93,6 +96,13 @@ Then run the lightwalletd frontend with the following:
./start.sh
```
If you see the following error `"Can't create data directory: /var/lib/lightwalletd"` you need to set the correct user permissions:
```
sudo chown -R $USER:$USER /var/lib/lightwalletd
sudo chmod -R 755 /var/lib/lightwalletd
```
Note: we use the "--no-tls" option as we are using NGINX as a reverse proxy and letting it handle the TLS authentication for us instead. If you want to do TLS directly with lightwalletd with no reverse proxy, see the next section.
If you encounter an error about the lightwalletd "data directory", then set one on the command line with `--data-dir` (OR) create the `/var/lib/lightwalletd` and `/var/lib/lightwalletd/db` directories & chown that new db directory as the user account running lightwalletd and hushd.
@ -146,23 +156,21 @@ what you give to `--grpc-bin-addr` .
These are some of the most used command line options for lightwalletd:
| CLI option | Default | What it does |
|------------|:--------------:|------------------------------:|
| CLI option | Default | What it does |
|------------------|:--------------:|:------------------------------|
| --grpc-bind-addr | 127.0.0.1:9067 | address and port to listen on via GRPC |
| --http-bind-addr | 127.0.0.1:9068 | address and port to listen on vi HTTP |
| --tls-cert | blank | the path to a TLS certificate |
| --tls-key | blank | the path to a TLS key file |
| --no-tls | false | Disable TLS, serve un-encrypted traffic |
| --data-dir | /var/lib/lightwalletd | Sets the lightwalletd data directory |
| --log-file | blank | log file to write to |
| --log-level | logrus.InfoLevel | log level 1 thru 7 (something from logrus)|
| --hush-conf-path | blank | conf file to pull RPC creds from |
| --cache-size| 40000 | number of blocks to hold in the cache |
| --rpcport | 18031 | RPC port |
Run `./lightwalletd --help` to see all options.
| --tls-cert | blank | the path to a TLS certificate |
| --tls-key | blank | the path to a TLS key file |
| --no-tls | false | Disable TLS, serve un-encrypted traffic |
| --data-dir | /var/lib/lightwalletd | Sets the lightwalletd data directory |
| --log-file | blank | log file to write to |
| --log-level | logrus.InfoLevel | log level 1 thru 7 (something from logrus) |
| --hush-conf-path | blank | conf file to pull RPC creds from |
| --rpcport | 18031 | RPC port |
| version | n/a | Display lightwalletd version |
Run `./lightwalletd --help` or `./lightwalletd help` to see all options.
## Developing
@ -176,12 +184,16 @@ Or do `make protobuf`
To update the version of lightwalletd, update the value of the `Version` variable in common/common.go .
## Support
For support or other questions, join us on [Telegram](https://hush.is/telegram), or tweet at [@HushIsPrivacy](https://twitter.com/HushIsPrivacy), or toot at our [Mastodon](https://fosstodon.org/@myhushteam) or join [Telegram Support](https://hush.is/telegram_support).
## Support and Socials
* Telegram: [https://hush.is/tg](https://hush.is/tg)
* Matrix: [https://hush.is/matrix](https://hush.is/matrix)
* Twitter: [https://hush.is/twitter](https://hush.is/twitter)
* PeerTube [https://hush.is/peertube](https://hush.is/peertube)
## License
GPLv3 or later
# Copyright
2016-2023 The Hush Developers
2016-2024 The Hush Developers

6
cmd/root.go

@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 Duke Leto and The Hush developers
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license
package cmd
@ -49,7 +49,7 @@ var rootCmd = &cobra.Command{
TLSKeyPath: viper.GetString("tls-key"),
LogLevel: viper.GetUint64("log-level"),
LogFile: viper.GetString("log-file"),
HushConfPath: viper.GetString("hush-conf-path"),
HushConfPath: viper.GetString("hush-conf-path"),
RPCUser: viper.GetString("rpcuser"),
RPCPassword: viper.GetString("rpcpassword"),
RPCHost: viper.GetString("rpchost"),
@ -204,7 +204,7 @@ func startServer(opts *common.Options) error {
// Indirect function for test mocking (so unit tests can talk to stub functions).
common.RawRequest = rpcClient.RawRequest
// Ensure that we can communicate with zcashd
// Ensure that we can communicate with hushd
common.FirstRPC()
getLightdInfo, err := common.GetLightdInfo()

2
cmd/root_test.go

@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 Duke Leto and The Hush developers
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license
package cmd

2
cmd/version.go

@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 Duke Leto and The Hush developers
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license
package cmd

4
common/cache.go

@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 Duke Leto and The Hush developers
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license
// Package common contains utilities that are shared by other packages.
@ -284,7 +284,7 @@ func (c *BlockCache) Add(height int, block *walletrpc.CompactBlock) error {
bheight := int(block.Height)
if bheight != height {
// This could only happen if zcashd returned the wrong
// This could only happen if hushd returned the wrong
// block (not the height we requested).
Log.Fatal("cache.Add wrong height: ", bheight, " expecting: ", height)
return nil

21
common/common.go

@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 Duke Leto and The Hush developers
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license
package common
@ -18,7 +18,7 @@ import (
// TODO: 'make build' will overwrite this string with the output of git-describe (tag)
var (
Version = "v0.1.3"
Version = "v0.2.0"
GitCommit = ""
Branch = ""
BuildDate = ""
@ -283,21 +283,30 @@ func CallRpcWithRetries(method string, params []json.RawMessage) (json.RawMessag
result, err := RawRequest(method, params)
if err == nil {
if retryCount > 0 {
Log.Warn(fmt.Sprintf("%s RPC successful"), method)
Log.Warn(fmt.Sprintf("%s RPC successful", method))
}
return result, err
break
}
retryCount++
if retryCount > maxRetries {
if retryCount > maxRetries && method != "sendrawtransaction" {
Log.WithFields(logrus.Fields{
"timeouts": retryCount,
}).Fatal(fmt.Sprintf("unable to issue %s RPC call to hushd node"), method)
}).Fatal(fmt.Sprintf("unable to issue %s RPC call to hushd node", method))
}
if retryCount > maxRetries && method == "sendrawtransaction" {
// TODO: it would be better to only give up if the error is an expired tx
Log.WithFields(logrus.Fields{
"error": err.Error(),
"retry": retryCount,
}).Warn(fmt.Sprintf("giving up on %s rpc", method))
// TODO: return a better error
return nil, nil
}
Log.WithFields(logrus.Fields{
"error": err.Error(),
"retry": retryCount,
}).Warn(fmt.Sprintf("error with %s rpc, retrying..."), method)
}).Warn(fmt.Sprintf("error with %s rpc, retrying...", method))
Time.Sleep(time.Duration(10+retryCount*5) * time.Second) // backoff
}
return nil, nil

4
common/generatecerts.go

@ -1,6 +1,6 @@
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or https://www.opensource.org/licenses/mit-license.php .
// Distributed under the GPLv3 software license
package common
import (

3
common/logging/logging.go

@ -1,3 +1,6 @@
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license
package logging
import (

2
common/logging/logging_test.go

@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 Duke Leto and The Hush developers
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license
package logging

2
common/mempool.go

@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 Duke Leto and The Hush developers
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license

28
contrib/debian/changelog

@ -1,5 +1,29 @@
lightwalletd (0.1.1) stable; urgency=medium
lightwalletd (0.2.0) unstable; urgency=high
* Fixed logging error
* Fixed issue with clients sending expired transactions
* Implemented help system in Makefile
* Updates to manpage to include all CLI options
* Updates to Documentation
-- Hush Core <jahway603@protonmail.com> Sat, 11 May 2024 09:44:17 -0700
lightwalletd (0.1.3) unstable; urgency=medium
* Bugfixes
* Removed old & unused code
-- Hush Core <jahway603@protonmail.com> Fri, 23 Jun 2023 06:39:17 -0700
lightwalletd (0.1.2) unstable; urgency=medium
* New codebase from upstream lightwalletd
* Updates to Documentation
-- Hush Core <jahway603@protonmail.com> Mon, 06 Mar 2023 07:18:21 -0700
lightwalletd (0.1.1) unstable; urgency=medium
* 0.1.1 release.
-- Hush Core <jahway603@protonmail.com> Sunday, 24 Oct 2021 13:40:30 -0700
-- Hush Core <jahway603@protonmail.com> Sun, 24 Oct 2021 13:40:30 -0700

7
contrib/debian/control

@ -2,12 +2,15 @@ Source: lightwalletd
Section: utils
Priority: optional
Maintainer: Jahway603 <jahway603@protonmail.com>
Build-Depends: go, libc6-dev
Standards-Version: 4.0.0
Homepage: https://hush.is
Build-Depends: go
Vcs-Git: https://git.hush.is/hush/lightwalletd.git
Vcs-Browser: https://git.hush.is/hush/lightwalletd
Package: lightwalletd
Architecture: amd64 arm64
Depends: ${shlibs:Depends}
Description: Hush lightwallet daemon to run a Silent Dragon Lite server. Speak And Transact Freely. Hush inherits from Bitcoin Protocol and Zcash Protocol and is focused on private communications.
Description: Hush lightwallet daemon to run a Silent Dragon Lite server.
Speak And Transact Freely with Hush, which inherits from Bitcoin Protocol and
Zcash Protocol and is focused on private communications.

4
contrib/debian/copyright

@ -1,6 +1,6 @@
Files: *
Copyright: 2019-2021, The Hush developers
Copyright: 2019-2024, The Hush developers
2018-2019, The Zcash developers
License: GPLv3
Comment: https://hush.is/developers
Comment: https://hush.is

5
contrib/debian/files

@ -1 +1,4 @@
lightwalletd_0.1.1_amd64.deb utils optional
lightwalletd_0.1.3_amd64.deb utils optional
lightwalletd_0.1.3_arm64.deb utils optional
lightwalletd_0.2.0_amd64.deb utils optional
lightwalletd_0.2.0_arm64.deb utils optional

83
doc/man/lightwalletd.1

@ -1,6 +1,6 @@
.TH LIGHTWALLET "1" "June 2023" "lightwalletd v0.1.3" "User Commands"
.TH LIGHTWALLETD "1" "May 2024" "lightwalletd v0.2.0" "User Commands"
.SH NAME
lightwalletd \- manual page for hush lightwalletd v0.1.3
lightwalletd \- manual page for hush lightwalletd v0.2.0
.SH DESCRIPTION
.B lightwalletd
runs a lightwallet daemon for a Hush Silent Dragon Lite node.
@ -12,60 +12,103 @@ please see <https://hush.is/security/>.
.B lightwalletd [options]
Start Hush lightwalletd
.TP
lightwalletd --help
lightwalletd completion
Generate the autocompletion script for the specified shell
.TP
lightwalletd help
List available command line options
.TP
lightwalletd --version
lightwalletd version
Display version information
.SH OPTIONS
.HP
\fB\-help | -h | -?
\fB\--help | help | -h | -?
.IP
Display command line options
.HP
\fB\--hush-conf-path\fR [conf_file location]
\fB\--config \fRstring
.IP
Configure your lightwalletd config file location (default is current directory, lightwalletd.yaml)
.HP
\fB\--data-dir \fR [location]
.IP
Configures your HUSH3.conf file location to pull RPC creds from (default "./HUSH3.conf")
Configure your lightwalletd data directory (such as db) (default "/var/lib/lightwalletd")
.HP
\fB\--data-dir\fR [location]
\fB\--gen-cert-very-insecure
.IP
Configures your lightwalletd data directory (such as db) (default "/var/lib/lightwalletd")
Configure lightwalled to run with a self-signed TLS certificate. ONLY do this for debugging & DO NOT use in production!
.HP
\fB\--grpc-bind-addr \fRlocalhost:chosen_port
.IP
The address to listen for grpc on (default "localhost:9067")
Configure the address and port to listen for grpc on (default "localhost:9067")
.HP
\fB\--grpc-logging-insecure
.IP
Configure lightwalled to enable grpc logging to stderr
.HP
\fB\--http-bind-addr \fRstring
.IP
Configure the address and port to listen for http on (default "localhost:9068")
.HP
\fB\--hush-conf-path\fR [conf_file location]
.IP
Configure your HUSH3.conf file location to pull RPC creds from (default "./HUSH3.conf")
.HP
\fB\--log-file \fRstring
.IP
Configure log file to write to (default "./server.log")
.HP
\fB\--log-level \fRint
.IP
Configure log level (logrus 1-7) (default 4)
.HP
\fB\--no-tls
.IP
Run without TLS, only safe if a reverse proxy like nginx does TLS on localhost.
.HP
\fB\--cache-size \fRint
\fB\--ping-very-insecure
.IP
Set number of blocks to hold in the cache (default 40000)
Configure lightwalled to allow Ping GRPC for testing.
.HP
\fB\--log-file \fRstring
\fB\--redownload
.IP
Re-fetch all blocks from hushd; reinitialize local cache files
.HP
\fB\--rpchost \fRstring
.IP
Configure RPC host used.
.HP
\fB\--rpcpassword \fRstring
.IP
Configure RPC password used (default value used from HUSH3.conf)
.HP
\fB\--rpcport \fRstring
.IP
Configure RPC host port used (default value used from HUSH3.conf)
.HP
\fB\--rpcuser \fRstring
.IP
Set log file to write to
Configure RPC username used (default value used from HUSH3.conf)
.HP
\fB\--log-level \fRuint
\fB\--sync-from-height \fRint
.IP
log level (logrus 1-7) (default 4)
Re-fetch blocks from hushd start at this height (default -1)
.HP
\fB\--tls-cert \fRstring
.IP
the path to a TLS certificate (optional)
Configure the path to a TLS certificate (default "./cert.pem")
.HP
\fB\--tls-key \fRstring
.IP
the path to a TLS key file (optional)
Configure the path to a TLS key file (default "./cert.key")
.SH COPYRIGHT
In order to ensure you are adequately protecting your privacy when using Hush,
please see <https://hush.is/security/>.
Copyright (C) 2021-2023 Jahway603 and The Hush Developers
Copyright (C) 2021-2024 Jahway603 and The Hush Developers
This is experimental Free Software! Fuck Yeah!!!!!
Distributed under the GPLv3 software license, see the accompanying file COPYING
Distributed under the GPLv3 software license, see the accompanying file LICENSE
or <https://www.gnu.org/licenses/gpl-3.0.en.html>.

12
frontend/rpc_client.go

@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 Duke Leto and The Hush developers
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license
package frontend
@ -6,9 +6,9 @@ package frontend
import (
"net"
"git.hush.is/hush/lightwalletd/common"
"github.com/btcsuite/btcd/rpcclient"
"github.com/pkg/errors"
"git.hush.is/hush/lightwalletd/common"
ini "gopkg.in/ini.v1"
)
@ -26,15 +26,15 @@ func NewZRPCFromConf(confPath string) (*rpcclient.Client, error) {
return NewZRPCFromCreds(net.JoinHostPort(rpcaddr, rpcport), username, password)
}
// NewZRPCFromFlags gets zcashd rpc connection information from provided flags.
// NewZRPCFromFlags gets hushd rpc connection information from provided flags.
func NewZRPCFromFlags(opts *common.Options) (*rpcclient.Client, error) {
// Connect to local Zcash RPC server using HTTP POST mode.
// Connect to local Hush RPC server using HTTP POST mode.
connCfg := &rpcclient.ConnConfig{
Host: net.JoinHostPort(opts.RPCHost, opts.RPCPort),
User: opts.RPCUser,
Pass: opts.RPCPassword,
HTTPPostMode: true, // Zcash only supports HTTP POST mode
DisableTLS: true, // Zcash does not provide TLS by default
HTTPPostMode: true, // Hush only supports HTTP POST mode
DisableTLS: true, // Hush does not provide TLS by default
}
return rpcclient.New(connCfg, nil)
}

4
frontend/service.go

@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 Duke Leto and The Hush developers
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license
// Package frontend implements the gRPC handlers called by the wallets.
@ -258,7 +258,7 @@ func (s *lwdStreamer) GetCoinsupply(ctx context.Context, in *walletrpc.Empty) (*
}, nil
}
// SendTransaction forwards raw transaction bytes to a zcashd instance over JSON-RPC
// SendTransaction forwards raw transaction bytes to a full node over JSON-RPC
func (s *lwdStreamer) SendTransaction(ctx context.Context, rawtx *walletrpc.RawTransaction) (*walletrpc.SendResponse, error) {
// sendrawtransaction "hexstring" ( allowhighfees )
//

2
main.go

@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 Duke Leto and The Hush developers
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license
package main

2
parser/block.go

@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 Duke Leto and The Hush developers
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license

2
parser/block_header.go

@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 Duke Leto and The Hush developers
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license
package parser

3
parser/block_header_test.go

@ -1,3 +1,6 @@
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license
package parser
import (

3
parser/block_test.go

@ -1,3 +1,6 @@
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license
package parser
import (

3
parser/fuzz.go

@ -1,3 +1,6 @@
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license
// +build gofuzz
package parser

2
parser/internal/bytestring/bytestring.go

@ -1,4 +1,4 @@
// Copyright (c) 2019-2022 Duke Leto and The Hush developers
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license

3
parser/internal/bytestring/bytestring_test.go

@ -1,3 +1,6 @@
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license
package bytestring
import (

4
parser/transaction.go

@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 Duke Leto and The Hush developers
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license
// Package parser deserializes (full) transactions from hushd
@ -336,7 +336,7 @@ func (p *action) ToCompact() *walletrpc.CompactOrchardAction {
}
*/
// Transaction encodes a full (zcashd) transaction.
// Transaction encodes a full (hushd) transaction.
type Transaction struct {
*rawTransaction
rawBytes []byte

3
parser/transaction_test.go

@ -1,3 +1,6 @@
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license
package parser
import (

2
parser/util.go

@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 Duke Leto and The Hush developers
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license
// Package parser deserializes (full) transactions from hushd

2
start-tls.sh

@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Copyright 2020-2023 The Hush Developers
# Copyright 2020-2024 The Hush Developers
# Released under GPLv3
# Description: This script would be used with a NGINX reverse proxy

2
start.sh

@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Copyright 2020-2023 The Hush Developers
# Copyright 2020-2024 The Hush Developers
# Released under GPLv3
# Description: This script would be used with a NGINX reverse proxy

37
util/RELEASE-new-version.sh

@ -1,37 +0,0 @@
#!/usr/bin/env bash
# Copyright 2021-2023 Duke Leto and The Hush Developers
# Distributed under the GPLv3 software license, see the accompanying
# file LICENSE or https://www.gnu.org/licenses/gpl-3.0.en.html
# Purpose: To process a release for a new version of lightwalletd
# *** Run with ***
# ./util/RELEASE-new-version.sh 0.1.3
# *** the above 0.1.3 is the version number you're building ***
VERSION=$1
readonly VERSION
sed -i "s/0.1.3/$VERSION/g" util/build-debian-package.sh
sed -i "s/0.1.3/$VERSION/g" util/build-debian-package-SBC.sh
sed -i "s/0.1.3/$VERSION/g" common/common.go
sed -i "s/0.1.3/$VERSION/g" doc/man/lightwalletd.1
set -e
echo ""
echo "Let's build new release $VERSION of lightwalletd..."
echo ""
echo ""
echo "Building x86 binary"
make build
echo "Building x86 Debian package"
./util/build-debian-package.sh
echo "lightwalletd $VERSION x86 is done... now to build ARM..."
# TO-DO: automate ARM deb pkg build
#echo ""
#echo "Building ARM binary"
#make build-arm
#./util/build-debian-package-SBC.sh
#rm lightwalletd
#
echo "ALL DONE FOR lightwalletd $VERSION release"

105
util/build-debian-package-SBC.sh

@ -1,105 +0,0 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2023 The Hush developers
# Distributed under the GPLv3 software license, see the accompanying
# file LICENSE or https://www.gnu.org/licenses/gpl-3.0.en.html
#
# Remix for SBC (Single Board Computer) like PineBook, Rock64, Raspberry Pi, etc.
## Usage: ./util/build-debian-package-SBC.sh
echo "Let's see who read the README.md or not..."
echo ""
# Check if lightwalletd is already built on system and exit if it is not
if ! [ -x "$(command -v ./lightwalletd)" ]; then
echo 'Error: lightwalletd is not compiled yet. Run "make build" and try again.' >&2
echo ""
exit 1
fi
# Check if lintian is installed and exit if it is not
if ! [ -x "$(command -v lintian)" ]; then
echo 'Error: lintian is not installed yet. Consult your Linux version package manager...' >&2
echo 'On Debian/Ubuntu, try "sudo apt install lintian"'
echo ""
exit 1
fi
# Check if fakeroot is installed and exit if it is not
if ! [ -x "$(command -v fakeroot)" ]; then
echo 'Error: fakeroot is not installed yet. Consult your Linux version package manager...' >&2
echo 'On Debian/Ubuntu, try "sudo apt install fakeroot"'
echo ""
exit 1
fi
# TODO - check that the lightwalletd binary is not x86 and is actually aarch64
echo "Let There Be Hush Lightwalletd Debian Packages for ARM!!!"
echo ""
echo "((_,...,_))"
echo " |o o|"
echo " \ /"
echo " ^_^ cp97"
echo ""
set -e
set -x
BUILD_PATH="/tmp/lightwalletd-debian-$$"
PACKAGE_NAME="lightwalletd"
SRC_PATH=`pwd`
SRC_DEB=$SRC_PATH/contrib/debian
SRC_DOC=$SRC_PATH/doc
ARCH="aarch64"
umask 022
if [ ! -d $BUILD_PATH ]; then
mkdir $BUILD_PATH
fi
PACKAGE_VERSION=0.1.3
DEBVERSION=$(echo $PACKAGE_VERSION)
BUILD_DIR="$BUILD_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH"
if [ -d $BUILD_DIR ]; then
rm -R $BUILD_DIR
fi
DEB_BIN=$BUILD_DIR/usr/bin
DEB_CMP=$BUILD_DIR/usr/share/bash-completion/completions
DEB_DOC=$BUILD_DIR/usr/share/doc/$PACKAGE_NAME
DEB_MAN=$BUILD_DIR/usr/share/man/man1
DEB_SHR=$BUILD_DIR/usr/share/hush
mkdir -p $BUILD_DIR/DEBIAN $DEB_CMP $DEB_BIN $DEB_DOC $DEB_MAN $DEB_SHR
chmod 0755 -R $BUILD_DIR/*
# Package maintainer scripts (currently empty)
#cp $SRC_DEB/postinst $BUILD_DIR/DEBIAN
#cp $SRC_DEB/postrm $BUILD_DIR/DEBIAN
#cp $SRC_DEB/preinst $BUILD_DIR/DEBIAN
#cp $SRC_DEB/prerm $BUILD_DIR/DEBIAN
# Copy binary
cp $SRC_PATH/lightwalletd $DEB_BIN/lightwalletd
strip $DEB_BIN/lightwalletd
cp $SRC_DEB/changelog $DEB_DOC
cp $SRC_DEB/copyright $DEB_DOC
cp -r $SRC_DEB/examples $DEB_DOC
# Copy manpage
cp $SRC_DOC/man/lightwalletd.1 $DEB_MAN/lightwalletd.1
# Gzip files
gzip --best -n $DEB_MAN/lightwalletd.1
cd $SRC_PATH/contrib
# Create the control file
dpkg-shlibdeps $DEB_BIN/lightwalletd
dpkg-gencontrol -P$BUILD_DIR -v$DEBVERSION
# Create the Debian package
fakeroot dpkg-deb --build $BUILD_DIR
cp $BUILD_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH.deb $SRC_PATH
shasum -a 256 $SRC_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH.deb
# Analyze with Lintian, reporting bugs and policy violations
lintian -i $SRC_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH.deb
exit 0

58
util/build-debian-package.sh

@ -1,11 +1,22 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2023 The Hush developers
# Copyright (c) 2021-2024 The Hush developers
# Distributed under the GPLv3 software license, see the accompanying
# file LICENSE or https://www.gnu.org/licenses/gpl-3.0.en.html
#
## Usage: ./util/build-debian-package.sh
## USAGE
# ./util/build-debian-package.sh <architecture flag> <version-you-are-building>
#
## Example to build debian pkg for amd64 (most common) for version 0.2.0:
# ./util/build-debian-package.sh --amd64 0.2.0
#
## Example to build debian pkg for ARM (aarch64) for version 0.2.0:
# ./util/build-debian-package.sh --arm 0.2.0
#
## USAGE Requirements:
# - Needs to be run in lightwalletd root directory
# - Needs to be run on a Debian system (NOT UBUNTU)
echo "Let's see who read the README.md or not..."
echo "Let's see who read the USAGE EXAMPLES in this script or not..."
echo ""
# Check if lightwalletd is already built on system and exit if it is not
@ -16,11 +27,36 @@ if ! [ -x "$(command -v ./lightwalletd)" ]; then
fi
# Check if lintian is installed and exit if it is not
#if ! [ -x "$(command -v lintian)" ]; then
# echo 'Error: lintian is not installed yet. Consult your Linux version package manager...' >&2
# echo ""
# exit 1
#fi
if ! [ -x "$(command -v lintian)" ]; then
echo 'Error: lintian is not installed yet. Consult your Linux version package manager...' >&2
echo 'On Debian/Ubuntu, try "sudo apt install lintian"'
echo ""
exit 1
fi
# Check if fakeroot is installed and exit if it is not
if ! [ -x "$(command -v fakeroot)" ]; then
echo 'Error: fakeroot is not installed yet. Consult your Linux version package manager...' >&2
echo 'On Debian/Ubuntu, try "sudo apt install fakeroot"'
echo ""
exit 1
fi
## Command line options section
# Check if there are no CLI options entered and exit if so
if [ -z "$1" ] || [ -z "$2" ]; then
echo 'YOU DOING IT WRONG...' >&2
echo 'Read the Usage Examples at top of this script & TRY AGAIN' >&2
exit 1
fi
# Architecture CLI option
if [ "$1" = "--amd64" -o "$1" = "--a64" ]; then
ARCH="amd64"
elif [ "$1" = "--arm" -o "$1" = "--ARM" -o "$1" = "--aarch64" ]; then
ARCH="aarch64"
fi
# Set Version-to-build from Second CLI option
PACKAGE_VERSION=$2
echo "Let There Be Hush Lightwalletd Debian Packages!"
echo ""
@ -38,7 +74,6 @@ PACKAGE_NAME="lightwalletd"
SRC_PATH=`pwd`
SRC_DEB=$SRC_PATH/contrib/debian
SRC_DOC=$SRC_PATH/doc
ARCH="amd64"
umask 022
@ -46,7 +81,6 @@ if [ ! -d $BUILD_PATH ]; then
mkdir $BUILD_PATH
fi
PACKAGE_VERSION=0.1.3
DEBVERSION=$(echo $PACKAGE_VERSION)
BUILD_DIR="$BUILD_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH"
@ -92,7 +126,5 @@ fakeroot dpkg-deb --build $BUILD_DIR
cp $BUILD_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH.deb $SRC_PATH
shasum -a 256 $SRC_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH.deb
# Analyze with Lintian, reporting bugs and policy violations
# Arch does not have lintian, as it's a Debian package, so commenting this out
# To-DO - test on Debian/Ubuntu, create AUR lintian package
#lintian -i $SRC_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH.deb
lintian -i $SRC_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH.deb
exit 0

2
util/build.sh

@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Copyright 2021-2023 Duke Leto and The Hush Developers
# Copyright 2021-2024 Duke Leto and The Hush Developers
# Distributed under the GPLv3 software license, see the accompanying
# file LICENSE or https://www.gnu.org/licenses/gpl-3.0.en.html
# Purpose: Script to build Hush lightwalletd on x86 64-bit arch

2
walletrpc/compact_formats.pb.go

@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 Duke Leto and The Hush developers
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license

2
walletrpc/compact_formats.proto

@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 Duke Leto and The Hush developers
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license
syntax = "proto3";

3
walletrpc/generate.go

@ -1,3 +1,6 @@
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license
package walletrpc
//go:generate protoc -I . ./compact_formats.proto --go_out=plugins=grpc:.

2
walletrpc/service.pb.go

@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 Duke Leto and The Hush developers
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license

6
walletrpc/service.proto

@ -1,4 +1,4 @@
// Copyright (c) 2019-2023 Duke Leto and The Hush developers
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license
syntax = "proto3";
@ -128,9 +128,9 @@ service CompactTxStreamer {
// Return a list of consecutive compact blocks
rpc GetBlockRange(BlockRange) returns (stream CompactBlock) {}
// Return the requested full (not compact) transaction (as from zcashd)
// Return the requested full (not compact) transaction (as from hushd)
rpc GetTransaction(TxFilter) returns (RawTransaction) {}
// Submit the given transaction to the Zcash network
// Submit the given transaction to the Hush network
rpc SendTransaction(RawTransaction) returns (SendResponse) {}
// Return the txids corresponding to the given t-address within the given block range

12
walletrpc/service_grpc.pb.go

@ -1,3 +1,7 @@
// Copyright (c) 2019-2024 Duke Leto and The Hush developers
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the GPLv3 software license
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package walletrpc
@ -24,9 +28,9 @@ type CompactTxStreamerClient interface {
GetBlock(ctx context.Context, in *BlockID, opts ...grpc.CallOption) (*CompactBlock, error)
// Return a list of consecutive compact blocks
GetBlockRange(ctx context.Context, in *BlockRange, opts ...grpc.CallOption) (CompactTxStreamer_GetBlockRangeClient, error)
// Return the requested full (not compact) transaction (as from zcashd)
// Return the requested full (not compact) transaction (as from hushd)
GetTransaction(ctx context.Context, in *TxFilter, opts ...grpc.CallOption) (*RawTransaction, error)
// Submit the given transaction to the Zcash network
// Submit the given transaction to the Hush network
SendTransaction(ctx context.Context, in *RawTransaction, opts ...grpc.CallOption) (*SendResponse, error)
// Return the txids corresponding to the given t-address within the given block range
GetTaddressTxids(ctx context.Context, in *TransparentAddressBlockFilter, opts ...grpc.CallOption) (CompactTxStreamer_GetTaddressTxidsClient, error)
@ -396,9 +400,9 @@ type CompactTxStreamerServer interface {
GetBlock(context.Context, *BlockID) (*CompactBlock, error)
// Return a list of consecutive compact blocks
GetBlockRange(*BlockRange, CompactTxStreamer_GetBlockRangeServer) error
// Return the requested full (not compact) transaction (as from zcashd)
// Return the requested full (not compact) transaction (as from hushd)
GetTransaction(context.Context, *TxFilter) (*RawTransaction, error)
// Submit the given transaction to the Zcash network
// Submit the given transaction to the Hush network
SendTransaction(context.Context, *RawTransaction) (*SendResponse, error)
// Return the txids corresponding to the given t-address within the given block range
GetTaddressTxids(*TransparentAddressBlockFilter, CompactTxStreamer_GetTaddressTxidsServer) error

Loading…
Cancel
Save