forked from kaspanet/kaspad
-
Notifications
You must be signed in to change notification settings - Fork 7
/
doc.go
37 lines (29 loc) · 1.23 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
Package util provides hoosat-specific convenience functions and types.
# Block Overview
A Block defines a hoosat block that provides easier and more efficient
manipulation of raw blocks. It also memoizes hashes for the
block and its transactions on their first access so subsequent accesses don't
have to repeat the relatively expensive hashing operations.
# Tx Overview
A Tx defines a hoosat transaction that provides more efficient manipulation of
raw transactions. It memoizes the hash for the transaction on its
first access so subsequent accesses don't have to repeat the relatively
expensive hashing operations.
# Address Overview
The Address interface provides an abstraction for a hoosat address. While the
most common type is a pay-to-pubkey, hoosat already supports others and
may well support more in the future. This package currently provides
implementations for the pay-to-pubkey, and pay-to-script-hash address
types.
To decode/encode an address:
addrString := "hoosat:qqj9fg59mptxkr9j0y53j5mwurcmda5mtza9n6v9pm9uj8h0wgk6uma5pvumr"
defaultPrefix := util.Bech32PrefixHoosat
addr, err := util.DecodeAddress(addrString, defaultPrefix)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(addr.EncodeAddress())
*/
package util