@@ -61,6 +61,71 @@ Each additional character increases search time by a factor of 64.
6161
6262The tool supports blind search, i.e., when the worker does not know the private key. See [ demo-blind.sh] ( demo-blind.sh ) .
6363
64+ ## Kubernetes
65+
66+ You can run the tool in a distributed manner in Kubernetes cluster using the [ demo-k8s.yaml] ( demo-k8s.yaml ) manifest
67+ to search for a vanity key without exposing the private key:
68+
69+ ``` console
70+ $ # Generate secure starting key pair
71+ $ wg genkey | tee /dev/stderr | wg pubkey
72+ YI5+UcKmyLdeRDqU8l3k53wrUZO9Mw23NpvB8tDtvWU=
73+ startkQgqI9Gv1IX7eNa2qeFhpYBRDwpz40JIAAYOSk=
74+
75+ $ # Edit demo-k8s.yaml to configure prefix, starting public key, parallelism, and resource limits 💸
76+
77+ $ # Create search job
78+ $ kubectl apply -f demo-k8s.yaml
79+ job.batch/wvk created
80+
81+ $ # Check job
82+ $ kubectl get job wvk
83+ NAME STATUS COMPLETIONS DURATION AGE
84+ wvk Running 0/10 2m53s 2m53s
85+
86+ $ # Check pods
87+ $ kubectl get pods --selector=batch.kubernetes.io/job-name=wvk
88+ NAME READY STATUS RESTARTS AGE
89+ wvk-0-8tdz5 1/1 Running 0 3m8s
90+ wvk-1-pmnkn 1/1 Running 0 3m8s
91+ wvk-2-2ls7m 1/1 Running 0 3m8s
92+ wvk-3-rd7gx 1/1 Running 0 3m8s
93+ wvk-4-jqksz 1/1 Running 0 3m8s
94+ wvk-5-vj6gd 1/1 Running 0 3m8s
95+ wvk-6-vhgmc 1/1 Running 0 3m8s
96+ wvk-7-drr98 1/1 Running 0 3m8s
97+ wvk-8-tmb6c 1/1 Running 0 3m8s
98+ wvk-9-gxlp2 1/1 Running 0 3m8s
99+
100+ $ # Check resource usage
101+ $ kubectl top pods --selector=batch.kubernetes.io/job-name=wvk
102+
103+ $ # Wait for the job to complete
104+ $ kubectl wait --for=condition=complete job/wvk --timeout=1h
105+ job.batch/wvk condition met
106+
107+ $ # Job is complete
108+ $ kubectl get job wvk
109+ NAME STATUS COMPLETIONS DURATION AGE
110+ wvk Complete 1/999999 34m 37m
111+
112+ $ # Get found offset from the logs
113+ $ kubectl logs jobs/wvk
114+ 7538451707115552752
115+
116+ $ # Generate new private vanity key by offsetting the starting private key
117+ $ echo YI5+UcKmyLdeRDqU8l3k53wrUZO9Mw23NpvB8tDtvWU= | wireguard-vanity-key add --offset=7538451707115552752 --prefix=wvk+k8s
118+ 4I4EWan32HJbRDqU8l3k53wrUZO9Mw23NpvB8tDtvWU=
119+
120+ $ # Get the vanity public key
121+ $ echo 4I4EWan32HJbRDqU8l3k53wrUZO9Mw23NpvB8tDtvWU= | wg pubkey
122+ wvk+k8shgsJcW5EKet2AkViKc7a/0Ud8/EDOy91aCQg=
123+
124+ $ # Delete the job
125+ $ kubectl delete job wvk
126+ job.batch "wvk" deleted
127+ ```
128+
64129## Similar tools
65130
66131* [ wireguard-vanity-address] ( https://github.com/warner/wireguard-vanity-address )
@@ -91,8 +156,8 @@ Inspired by [wireguard-vanity-address "faster algorithm"](https://github.com/war
91156instead of doing full scalar multiplication for each candidate, this tool applies a point increment technique that reduces the number of multiplications:
92157```
93158public_key0 = private_key0 × base_point
94- public_key1 = (private_key0 + const_offset) × base_point
95- = private_key0 × base_point + const_offset × base_point
159+ public_key1 = (private_key0 + const_offset) × base_point
160+ = private_key0 × base_point + const_offset × base_point
96161 = public_key0 + const_offset × base_point
97162 = public_key0 + const_point_offset
98163```
@@ -119,7 +184,7 @@ Other tools encode the full public key to base64 and compare the prefix. This to
119184
120185### 🏆 High-performance C implementation
121186
122- For raw speed, the C worker (` wvk ` ) uses [ awslabs/s2n-bignum] ( https://github.com/awslabs/s2n-bignum ) -
187+ For raw speed, the C worker (` wvk ` ) uses [ awslabs/s2n-bignum] ( https://github.com/awslabs/s2n-bignum ) -
123188a highly optimized field arithmetic library written in assembly.
124189The worker supports prefix lengths up to 10 base64 characters, so the prefix check becomes a single masked integer comparison.
125190These two optimizations make ` wvk ` ~ 2 times faster than the Go implementation.
0 commit comments