func PubKeyToAddres(pubKey []byte) (string, error) {
	pubKeyHash, err := HashPubKey(pubKey)
	if err != nil {
		return "", err
	}
	versionedPayload := append([]byte{lib.Version}, pubKeyHash...)
	checksum := Checksum(versionedPayload)
	fullPayload := append(versionedPayload, checksum...)
	address := Base58Encode(fullPayload)
	return fmt.Sprintf("%s", address), nil
}
Makes string adres from pub key
package utils
import (
	"bytes"
	"crypto/sha256"
	"encoding/binary"
	"errors"
	"fmt"
	"io/ioutil"
	"log"
	"math/rand"
	"os"
	"strings"
	"golang.org/x/crypto/ripemd160"
	"github.com/gelembjuk/democoin/lib"
)
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
type LoggerMan struct {
	State   map[string]bool
	loggers map[string]*os.File
	Trace   *log.Logger
	Info    *log.Logger
	Warning *log.Logger
	Error   *log.Logger
}
func CreateLogger() *LoggerMan {
	logger := LoggerMan{}
	logger.loggers = map[string]*os.File{"trace": nil, "error": nil, "info": nil, "warning": nil}
	logger.State = map[string]bool{"trace": false, "error": false, "info": false, "warning": false}
	logger.Trace = log.New(ioutil.Discard,
		"TRACE: ",
		log.Ldate|log.Ltime|log.Lshortfile)
	logger.Info = log.New(ioutil.Discard,
		"INFO: ",
		log.Ldate|log.Ltime|log.Lshortfile)
	logger.Warning = log.New(ioutil.Discard,
		"WARNING: ",
		log.Ldate|log.Ltime|log.Lshortfile)
	logger.Error = log.New(ioutil.Discard,
		"ERROR: ",
		log.Ldate|log.Ltime|log.Lshortfile)
	return &logger
}
func (logger *LoggerMan) EnableLogs(logs string) {
	l := strings.Split(logs, ",")
	for _, lv := range l {
		logger.State[lv] = true
	}
}
func (logger *LoggerMan) GetState() string {
	list := []string{}
	for l, state := range logger.State {
		if state {
			list = append(list, l)
		}
	}
	return strings.Join(list, ",")
}
func (logger *LoggerMan) DisableLogging() {
	logger.Trace.SetOutput(ioutil.Discard)
	logger.Info.SetOutput(ioutil.Discard)
	logger.Warning.SetOutput(ioutil.Discard)
	logger.Error.SetOutput(ioutil.Discard)
	for t, p := range logger.loggers {
		if p != nil {
			p.Close()
		}
		logger.loggers[t] = nil
	}
}
func (logger *LoggerMan) LogToFiles(datadir, trace, info, warning, errorname string) error {
	if logger.State["trace"] {
		f1, err1 := os.OpenFile(datadir+trace, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
		if err1 == nil {
			logger.loggers["trace"] = f1
			logger.Trace.SetOutput(f1)
		}
	}
	if logger.State["info"] {
		f2, err2 := os.OpenFile(datadir+info, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
		if err2 == nil {
			logger.loggers["info"] = f2
			logger.Info.SetOutput(f2)
		}
	}
	if logger.State["warning"] {
		f3, err3 := os.OpenFile(datadir+warning, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
		if err3 == nil {
			logger.loggers["warning"] = f3
			logger.Warning.SetOutput(f3)
		}
	}
	if logger.State["error"] {
		f4, err4 := os.OpenFile(datadir+errorname, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
		if err4 == nil {
			logger.loggers["error"] = f4
			logger.Error.SetOutput(f4)
		}
	}
	return nil
}
func (logger *LoggerMan) LogToStdout() error {
	if logger.State["trace"] {
		logger.Trace.SetOutput(os.Stdout)
	}
	if logger.State["info"] {
		logger.Info.SetOutput(os.Stdout)
	}
	if logger.State["warning"] {
		logger.Warning.SetOutput(os.Stdout)
	}
	if logger.State["error"] {
		logger.Error.SetOutput(os.Stdout)
	}
	return nil
}
func IntToHex(num int64) []byte {
	buff := new(bytes.Buffer)
	err := binary.Write(buff, binary.BigEndian, num)
	if err != nil {
		log.Panic(err)
	}
	return buff.Bytes()
}
func ReverseBytes(data []byte) {
	for i, j := 0, len(data)-1; i < j; i, j = i+1, j-1 {
		data[i], data[j] = data[j], data[i]
	}
}
func AddresToPubKeyHash(address string) ([]byte, error) {
	pubKeyHash := Base58Decode([]byte(address))
	if len(pubKeyHash) < 10 {
		return nil, errors.New("Wrong address")
	}
	pubKeyHash = pubKeyHash[1 : len(pubKeyHash)-4]
	return pubKeyHash, nil
}
func PubKeyHashToAddres(pubKeyHash []byte) (string, error) {
	versionedPayload := append([]byte{lib.Version}, pubKeyHash...)
	checksum := Checksum(versionedPayload)
	fullPayload := append(versionedPayload, checksum...)
	address := Base58Encode(fullPayload)
	return fmt.Sprintf("%s", address), nil
}