mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-07-03 03:12:30 +00:00

* [NOD-510] Change coinbase flags to kaspad. * [NOD-510] Removed superfluous spaces after periods in comments. * [NOD-510] Rename btcd -> kaspad in the root folder. * [NOD-510] Rename BtcEncode -> KaspaEncode and BtcDecode -> KaspaDecode. * [NOD-510] Rename BtcEncode -> KaspaEncode and BtcDecode -> KaspaDecode. * [NOD-510] Continue renaming btcd -> kaspad. * [NOD-510] Rename btcjson -> kaspajson. * [NOD-510] Rename file names inside kaspajson. * [NOD-510] Rename kaspajson -> jsonrpc. * [NOD-510] Finish renaming in addrmgr. * [NOD-510] Rename package btcec to ecc. * [NOD-510] Finish renaming stuff in blockdag. * [NOD-510] Rename stuff in cmd. * [NOD-510] Rename stuff in config. * [NOD-510] Rename stuff in connmgr. * [NOD-510] Rename stuff in dagconfig. * [NOD-510] Rename stuff in database. * [NOD-510] Rename stuff in docker. * [NOD-510] Rename stuff in integration. * [NOD-510] Rename jsonrpc to rpcmodel. * [NOD-510] Rename stuff in limits. * [NOD-510] Rename stuff in logger. * [NOD-510] Rename stuff in mempool. * [NOD-510] Rename stuff in mining. * [NOD-510] Rename stuff in netsync. * [NOD-510] Rename stuff in peer. * [NOD-510] Rename stuff in release. * [NOD-510] Rename stuff in rpcclient. * [NOD-510] Rename stuff in server. * [NOD-510] Rename stuff in signal. * [NOD-510] Rename stuff in txscript. * [NOD-510] Rename stuff in util. * [NOD-510] Rename stuff in wire. * [NOD-510] Fix failing tests. * [NOD-510] Fix merge errors. * [NOD-510] Fix go vet errors. * [NOD-510] Remove merged file that's no longer relevant. * [NOD-510] Add a comment above Op0. * [NOD-510] Fix some comments referencing Bitcoin Core. * [NOD-510] Fix some more comments referencing Bitcoin Core. * [NOD-510] Fix bitcoin -> kaspa. * [NOD-510] Fix more bitcoin -> kaspa. * [NOD-510] Fix comments, remove DisconnectBlock in addrindex. * [NOD-510] Rename KSPD to KASD. * [NOD-510] Fix comments and user agent.
47 lines
1.7 KiB
Go
47 lines
1.7 KiB
Go
// Copyright (c) 2013-2014 The btcsuite developers
|
|
// Use of this source code is governed by an ISC
|
|
// license that can be found in the LICENSE file.
|
|
|
|
/*
|
|
Package util provides kaspa-specific convenience functions and types.
|
|
|
|
Block Overview
|
|
|
|
A Block defines a kaspa block that provides easier and more efficient
|
|
manipulation of raw wire protocol 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 kaspa transaction that provides more efficient manipulation of
|
|
raw wire protocol 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 kaspa address. While the
|
|
most common type is a pay-to-pubkey-hash, kaspa already supports others and
|
|
may well support more in the future. This package currently provides
|
|
implementations for the pay-to-pubkey, pay-to-pubkey-hash, and
|
|
pay-to-script-hash address types.
|
|
|
|
To decode/encode an address:
|
|
|
|
// NOTE: The default network is only used for address types which do not
|
|
// already contain that information. At this time, that is only
|
|
// pay-to-pubkey addresses.
|
|
addrString := "04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962" +
|
|
"e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d57" +
|
|
"8a4c702b6bf11d5f"
|
|
defaultNet := &chaincfg.MainNetParams
|
|
addr, err := util.DecodeAddress(addrString, defaultNet)
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
return
|
|
}
|
|
fmt.Println(addr.EncodeAddress())
|
|
*/
|
|
package util
|