Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

## Unreleased

### Zetaclient Config

* Public DNS is introduced as an alternative to public IP. It will be used when public IP field is empty.

```
"PublicIP": "",
"PublicDNS": "my.zetaclient.com",
```

### Features

* [4254](https://github.com/zeta-chain/node/pull/4254) - add additional support for zetaclient public DNS name

## v36.0.0

### Features
Expand Down
5 changes: 4 additions & 1 deletion cmd/zetaclientd/initconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
type initializeConfigOptions struct {
peer string
publicIP string
publicDNS string
logFormat string
logSampler bool
preParamsPath string
Expand Down Expand Up @@ -48,10 +49,11 @@ func setupInitializeConfigOptions() {

f.StringVar(&cfg.peer, "peer", "", usagePeer)
f.StringVar(&cfg.publicIP, "public-ip", "", "public ip address")
f.StringVar(&cfg.publicDNS, "public-dns", "", "public dns name (alternative to public-ip)")
f.StringVar(&cfg.preParamsPath, "pre-params", "~/preParams.json", "pre-params file path")
f.StringVar(&cfg.chainID, "chain-id", "athens_7001-1", "chain id")
f.StringVar(&cfg.zetacoreURL, "zetacore-url", "127.0.0.1", "zetacore node URL")
f.StringVar(&cfg.authzGranter, "operator", "", "granter for the authorization , this should be operator address")
f.StringVar(&cfg.authzGranter, "operator", "", "granter for the authorization, this should be operator address")
f.StringVar(&cfg.authzHotkey, "hotkey", "hotkey", usageHotKey)
f.Int8Var(&cfg.level, "log-level", int8(zerolog.InfoLevel), usageLogLevel)
f.StringVar(&cfg.logFormat, "log-format", "json", "log format (json, test)")
Expand Down Expand Up @@ -82,6 +84,7 @@ func InitializeConfig(_ *cobra.Command, _ []string) error {
// Populate new struct with cli arguments
configData.Peer = initializeConfigOpts.peer
configData.PublicIP = opts.publicIP
configData.PublicDNS = opts.publicDNS
configData.PreParamsPath = opts.preParamsPath
configData.ChainID = opts.chainID
configData.ZetaCoreURL = opts.zetacoreURL
Expand Down
1 change: 1 addition & 0 deletions cmd/zetaclientd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ func startTelemetry(ctx context.Context, cfg config.Config) (*metrics.TelemetryS
// 3. Init telemetry server
telemetry := metrics.NewTelemetryServer()
telemetry.SetIPAddress(cfg.PublicIP)
telemetry.SetDNSName(cfg.PublicDNS)

// 4. Add services to the process
graceful.AddStarter(ctx, pprofServer)
Expand Down
8 changes: 8 additions & 0 deletions contrib/localnet/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ services:
networks:
mynetwork:
ipv4_address: 172.20.0.21
extra_hosts:
- "zetaclient0.com:172.20.0.21"
entrypoint: /root/start-zetaclientd.sh
environment:
- ETHDEV_ENDPOINT=http://eth:8545
Expand All @@ -128,6 +130,8 @@ services:
networks:
mynetwork:
ipv4_address: 172.20.0.22
extra_hosts:
- "zetaclient1.com:172.20.0.22"
entrypoint: /root/start-zetaclientd.sh
environment:
- ETHDEV_ENDPOINT=http://eth:8545
Expand All @@ -148,6 +152,8 @@ services:
networks:
mynetwork:
ipv4_address: 172.20.0.23
extra_hosts:
- "zetaclient2.com:172.20.0.23"
entrypoint: /root/start-zetaclientd.sh
environment:
- HOTKEY_BACKEND=file
Expand All @@ -166,6 +172,8 @@ services:
networks:
mynetwork:
ipv4_address: 172.20.0.24
extra_hosts:
- "zetaclient3.com:172.20.0.24"
entrypoint: /root/start-zetaclientd.sh
environment:
- HOTKEY_BACKEND=file
Expand Down
6 changes: 5 additions & 1 deletion contrib/localnet/scripts/start-zetaclientd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ if [[ $HOSTNAME != "zetaclient0" && ! -f ~/.zetacored/config/zetaclient_config.j
num=$(echo $HOSTNAME | tr -dc '0-9')
node="zetacore$num"
fi
zetaclientd init --zetacore-url "$node" --chain-id athens_101-1 --operator "$operatorAddress" --log-format=text --public-ip "$MYIP" --log-level 1 --keyring-backend "$BACKEND" --pre-params "$PREPARAMS_PATH"

# use alternative DNS name (instead of IP) for other zetaclients (DNS should work as well)
zetaclientd init --zetacore-url "$node" --chain-id athens_101-1 \
--operator "$operatorAddress" --log-format=text --public-dns "$HOSTNAME.com" \
--keyring-backend "$BACKEND" --pre-params "$PREPARAMS_PATH"

# import relayer private key for zetaclient{$num}
import_relayer_key "${num}"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ require (
github.com/showa-93/go-mask v0.6.2
github.com/test-go/testify v1.1.4
github.com/tonkeeper/tongo v1.16.4
github.com/zeta-chain/go-tss v0.6.3
github.com/zeta-chain/go-tss v0.6.4
github.com/zeta-chain/protocol-contracts-solana/go-idl v0.0.0-20250409230544-d88f214f6f46
go.uber.org/mock v0.5.2
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1963,8 +1963,8 @@ github.com/zeta-chain/evm v0.0.0-20250821154530-f0addce1e5ac h1:OQYitaQxJqWzyGvX
github.com/zeta-chain/evm v0.0.0-20250821154530-f0addce1e5ac/go.mod h1:WfvV0raMAIEEa5MX6kp8VyELvkwBTNw8JNVlAXtKAXA=
github.com/zeta-chain/go-libp2p v0.0.0-20240710192637-567fbaacc2b4 h1:FmO3HfVdZ7LzxBUfg6sVzV7ilKElQU2DZm8PxJ7KcYI=
github.com/zeta-chain/go-libp2p v0.0.0-20240710192637-567fbaacc2b4/go.mod h1:TBv5NY/CqWYIfUstXO1fDWrt4bDoqgCw79yihqBspg8=
github.com/zeta-chain/go-tss v0.6.3 h1:c/zSEvI0h7MJ+xxu42M58uBdEWrlzfD3NI1kP/FlWBE=
github.com/zeta-chain/go-tss v0.6.3/go.mod h1:xLssidNiAP/fcdcw+cUPA2VS7Td2bnPMS/8x0jnde8w=
github.com/zeta-chain/go-tss v0.6.4 h1:GuzpCyCrxKqjCQCeUH/+MDGc5MJukJ64i/YrS49lx5s=
github.com/zeta-chain/go-tss v0.6.4/go.mod h1:xLssidNiAP/fcdcw+cUPA2VS7Td2bnPMS/8x0jnde8w=
github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20250728071033-90592fb858dd h1:Nlu25LE943pGRGDzXSfyYFIB5cSswolHc56my68LQ3E=
github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20250728071033-90592fb858dd/go.mod h1:SjT7QirtJE8stnAe1SlNOanxtfSfijJm3MGJ+Ax7w7w=
github.com/zeta-chain/protocol-contracts-solana/go-idl v0.0.0-20250409230544-d88f214f6f46 h1:xbgrVDXWkZaWhMAuD3Q5A13jmRKYQbjZMPBaCkv3cns=
Expand Down
1 change: 1 addition & 0 deletions zetaclient/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ type ComplianceConfig struct {
type Config struct {
Peer string `json:"Peer"`
PublicIP string `json:"PublicIP"`
PublicDNS string `json:"PublicDNS"`
LogFormat string `json:"LogFormat"`
LogLevel int8 `json:"LogLevel"`
LogSampler bool `json:"LogSampler"`
Expand Down
22 changes: 22 additions & 0 deletions zetaclient/metrics/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type TelemetryServer struct {
lastStartTimestamp time.Time
status types.Status
ipAddress string
dnsName string
HotKeyBurnRate *BurnRate
connectedPeers []peer.AddrInfo
rtt map[peer.ID]int64
Expand Down Expand Up @@ -107,6 +108,20 @@ func (t *TelemetryServer) GetIPAddress() string {
return t.ipAddress
}

// SetDNSName sets p2p dns name
func (t *TelemetryServer) SetDNSName(dns string) {
t.mu.Lock()
defer t.mu.Unlock()
t.dnsName = dns
}

// GetDNSName gets p2p dns name
func (t *TelemetryServer) GetDNSName() string {
t.mu.Lock()
defer t.mu.Unlock()
return t.dnsName
}

// GetLastStartTimestamp returns last start timestamp
func (t *TelemetryServer) GetLastStartTimestamp() time.Time {
t.mu.Lock()
Expand Down Expand Up @@ -180,6 +195,7 @@ func (t *TelemetryServer) Handlers() http.Handler {
router.Handle("/lastcoreblock", http.HandlerFunc(t.lastCoreBlockHandler)).Methods(http.MethodGet)
router.Handle("/status", http.HandlerFunc(t.statusHandler)).Methods(http.MethodGet)
router.Handle("/ip", http.HandlerFunc(t.ipHandler)).Methods(http.MethodGet)
router.Handle("/dns", http.HandlerFunc(t.dnsHandler)).Methods(http.MethodGet)
router.Handle("/hotkeyburnrate", http.HandlerFunc(t.hotKeyFeeBurnRate)).Methods(http.MethodGet)
router.Handle("/connectedpeers", http.HandlerFunc(t.connectedPeersHandler)).Methods(http.MethodGet)
router.Handle("/pingrtt", http.HandlerFunc(t.pingRTTHandler)).Methods(http.MethodGet)
Expand Down Expand Up @@ -232,6 +248,12 @@ func (t *TelemetryServer) ipHandler(w http.ResponseWriter, _ *http.Request) {
fmt.Fprintf(w, "%s", t.GetIPAddress())
}

// dnsHandler returns the dns name
func (t *TelemetryServer) dnsHandler(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, "%s", t.GetDNSName())
}

func (t *TelemetryServer) lastScannedBlockHandler(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "application/json")

Expand Down
5 changes: 3 additions & 2 deletions zetaclient/tss/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ func NewServer(
return nil, errors.New("tss password is empty")
case privateKey == nil:
return nil, errors.New("private key is nil")
case cfg.PublicIP == "":
logger.Warn().Msg("public IP is empty")
case cfg.PublicIP == "" && cfg.PublicDNS == "":
logger.Warn().Msg("no public IP or DNS is provided")
}

tssPath, err := resolveTSSPath(cfg.TssPath, logger)
Expand All @@ -223,6 +223,7 @@ func NewServer(
PreParamTimeout: 5 * time.Minute,
},
ExternalIP: cfg.PublicIP,
ExternalDNS: cfg.PublicDNS,
Port: Port,
BootstrapPeers: bootstrapPeers,
WhitelistedPeers: whitelistPeers,
Expand Down