func (p *Panthalassa) AddContact(pubKey string) error {
	rawPubKey, err := hex.DecodeString(pubKey)
	if err != nil {
		return err
	}
	lp2pPubKey, err := lp2pCrypto.UnmarshalEd25519PublicKey(rawPubKey)
	if err != nil {
		return err
	}
	id, err := peer.IDFromPublicKey(lp2pPubKey)
	if err != nil {
		return err
	}
	err = p.p2p.Host.Peerstore().AddPubKey(id, lp2pPubKey)
	if err != nil {
		return err
	}
	logger.Info(fmt.Sprintf("added contact: %s", pubKey))
	return p.p2p.Host.Peerstore().Put(id, "contact", true)
}
add friend to peer store
package panthalassa
import (
	"encoding/hex"
	"fmt"
	api "github.com/Bit-Nation/panthalassa/api"
	chat "github.com/Bit-Nation/panthalassa/chat"
	dapp "github.com/Bit-Nation/panthalassa/dapp"
	dAppReg "github.com/Bit-Nation/panthalassa/dapp/registry"
	db "github.com/Bit-Nation/panthalassa/db"
	dyncall "github.com/Bit-Nation/panthalassa/dyncall"
	keyManager "github.com/Bit-Nation/panthalassa/keyManager"
	p2p "github.com/Bit-Nation/panthalassa/p2p"
	storm "github.com/asdine/storm"
	lp2pCrypto "github.com/libp2p/go-libp2p-crypto"
	peer "github.com/libp2p/go-libp2p-peer"
)
type Panthalassa struct {
	km          *keyManager.KeyManager
	upStream    api.UpStream
	api         *api.API
	p2p         *p2p.Network
	dAppReg     *dAppReg.Registry
	chat        *chat.Chat
	chatDB      db.ChatStorage
	db          *storm.DB
	dAppStorage dapp.Storage
	dyncall     *dyncall.Registry
}
func (p *Panthalassa) Stop() error {
	var err error
	err = p.db.Close()
	err = p.p2p.Close()
	err = p.chat.Close()
	return err
}
func (p *Panthalassa) Export(pw, pwConfirm string) (string, error) {
	store, err := p.km.Export(pw, pwConfirm)
	if err != nil {
		return "", err
	}
	rawStore, err := store.Marshal()
	if err != nil {
		return "", err
	}
	return string(rawStore), nil
}