Files
zeekay 3183dab89c Make the whole module build and test again after the port
go list ./... returned nothing, so no package here could be built or tested and
the failure was invisible: one directory held a Go test beside fifteen .cpp
files, which makes it a Go package the toolchain then refuses. The generator
moves to the golden/ subdirectory the other two C++ chains already use.

That silence was hiding a package that does not compile. host/ calls
EnsureIdentity and identity.go defines LoadIdentity — a rename that happened on
one side — and it has no importers, because the Go host is cmd/luxd now. Deleted
rather than repaired: the thing it was a stand-in for arrived.

The operator tools came across too (backup, blscheck, ceremony, config,
genesishash, keytoaddr, pqkeygen, repair-proposervm, wire) plus benchmarks and
examples, so the package set now differs from the retired repo by exactly one
name: main/ is cmd/luxd.

Two tests were right and are now satisfied rather than silenced. The purity test
looked for ./main; it looks where the daemon lives. The chain-address test found
conformance/dex spelling /v1/chain by hand — but that is its own module on
purpose, since it links an EVM ABI and a signer the node must not carry, so it
cannot call Chain. The rule is about this module, and the walk now says so.
2026-09-07 17:16:26 -07:00

43 lines
765 B
Go

package main
import (
"encoding/hex"
"fmt"
"os"
"github.com/luxfi/address"
"github.com/luxfi/crypto/secp256k1"
)
func main() {
if len(os.Args) < 2 {
fmt.Println("Usage: keytoaddr <hex_private_key>")
os.Exit(1)
}
keyHex := os.Args[1]
keyBytes, err := hex.DecodeString(keyHex)
if err != nil {
fmt.Printf("Error decoding hex: %v\n", err)
os.Exit(1)
}
sk, err := secp256k1.ToPrivateKey(keyBytes)
if err != nil {
fmt.Printf("Error creating key: %v\n", err)
os.Exit(1)
}
pk := sk.PublicKey()
addr := pk.Address()
// Format as P-chain address with "lux" HRP (network ID 96369)
pAddr, err := address.Format("P", "lux", addr[:])
if err != nil {
fmt.Printf("Error formatting address: %v\n", err)
os.Exit(1)
}
fmt.Println(pAddr)
}