File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed
Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change 11// Package examples provides example code for various functionalities.
22package examples
33
4- // TODO - add example code here
4+ import (
5+ "fmt"
6+ "os"
7+
8+ chaincfg "github.com/bsv-blockchain/go-chaincfg"
9+ "github.com/bsv-blockchain/go-wire"
10+ )
11+
12+ // ExampleIsPubKeyHashAddrID demonstrates how to verify the legacy public key hash
13+ // (P2PKH) address identifier bytes for a specific Bitcoin SV network.
14+ //
15+ // The helper reports whether the provided identifier is valid for the supplied
16+ // network magic value. This is useful when parsing external configuration or
17+ // performing sanity checks on user-supplied address metadata.
18+ func ExampleIsPubKeyHashAddrID () {
19+ write := func (value bool ) {
20+ if _ , err := fmt .Fprintf (os .Stdout , "%t\n " , value ); err != nil {
21+ panic (err )
22+ }
23+ }
24+
25+ write (chaincfg .IsPubKeyHashAddrID (wire .MainNet , chaincfg .MainNetParams .LegacyPubKeyHashAddrID ))
26+ write (chaincfg .IsPubKeyHashAddrID (wire .MainNet , chaincfg .TestNetParams .LegacyPubKeyHashAddrID ))
27+
28+ // Output:
29+ // true
30+ // false
31+ }
You can’t perform that action at this time.
0 commit comments