func DecodeAddress(addr string, defaultNet *chaincfg.Params) (Address, error) {
	decoded, netID, err := base58.CheckDecode(addr)
	if err != nil {
		if err == base58.ErrChecksum {
			return nil, ErrChecksumMismatch
		}
		return nil, errors.New("decoded address is of unknown format")
	}
	if chaincfg.IsProvaAddrID(netID) {
		decodedLen := len(decoded)
		mininumKeyIdsCount := 2
		maximumKeyIdsCount := 19
		if decodedLen < ripemd160.Size+(mininumKeyIdsCount*btcec.KeyIDSize) {
			return nil, errors.New("decoded address is of unknown size")
		}
		if decodedLen > ripemd160.Size+(maximumKeyIdsCount*btcec.KeyIDSize) {
			return nil, errors.New("decoded address exceeds maximum size")
		}
		if (decodedLen-ripemd160.Size)%btcec.KeyIDSize != 0 {
			return nil, errors.New("decoded address has invalid size")
		}
		return newAddressProvaFromBytes(decoded, netID)
	}
	return nil, errors.New("decoded address is of unknown size")
}
DecodeAddress decodes the string encoding of an address and returns
the Address if addr is a valid encoding for a known address type.

The bitcoin network the address is associated with is extracted if possible.
When the address does not encode the network, such as in the case of a raw
public key, the address will be associated with the passed defaultNet.
package provautil
import (
	"encoding/binary"
	"encoding/hex"
	"errors"
	"github.com/bitgo/prova/btcec"
	"github.com/bitgo/prova/chaincfg"
	"github.com/bitgo/prova/provautil/base58"
	"github.com/btcsuite/golangcrypto/ripemd160"
)
var (
	ErrChecksumMismatch = errors.New("checksum mismatch")
	ErrUnknownAddressType = errors.New("unknown address type")
	ErrAddressCollision = errors.New("address collision")
)
func encodeProvaAddress(keyIDs []btcec.KeyID, hash160 []byte, netID byte) string {
	data := make([]byte, len(keyIDs)*btcec.KeyIDSize+ripemd160.Size)
	copy(data[0:], hash160)
	offset := ripemd160.Size
	for _, keyID := range keyIDs {
		binary.LittleEndian.PutUint32(data[offset:], uint32(keyID))
		offset += btcec.KeyIDSize
	}
	return base58.CheckEncode(data, netID)
}
type Address interface {
	String() string
	EncodeAddress() string
	ScriptAddress() []byte
	ScriptKeyIDs() []btcec.KeyID
	IsForNet(*chaincfg.Params) bool
}