Validate a Bitcoin Address in Go
Goal
Build a small validator that accepts an address string and an expected network.
Exercise
Parse the encoding and witness version using a maintained Bitcoin library; reject malformed checksums, wrong-network prefixes, and unsupported witness programs. Test valid and invalid vectors.
Verify your result
- Write down the expected behavior before running the exercise.
- Test one valid case and at least two invalid or unexpected cases.
- Confirm that errors are visible and that no sensitive values appear in logs.
- Save the observations so the procedure can be repeated.
Safety note
Regex matching alone is not a sufficient address validator.
Next step
Read the [related guide](/wiki/bip86-taproot) before extending the exercise.
