From 58d76cfd842b96928f38d6a2e7cbd99483e654cf Mon Sep 17 00:00:00 2001 From: anchaj Date: Mon, 17 Jun 2019 20:48:21 +0200 Subject: [PATCH 1/7] Update Phore coin type to BIP44 --- Godeps/Godeps.json | 2 +- vendor/github.com/phoreproject/wallet-interface/datastore.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 5f0662bde2..6e5611d48b 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -21,7 +21,7 @@ }, { "ImportPath": "github.com/phoreproject/wallet-interface", - "Rev": "5d298be53cb82503253965ac47565bd861629b2c" + "Rev": "294114ebb86acfe5ab349ffa6adfea9b4f2e03d8" }, { "ImportPath": "github.com/boltdb/bolt", diff --git a/vendor/github.com/phoreproject/wallet-interface/datastore.go b/vendor/github.com/phoreproject/wallet-interface/datastore.go index 03614d6529..132e03d941 100644 --- a/vendor/github.com/phoreproject/wallet-interface/datastore.go +++ b/vendor/github.com/phoreproject/wallet-interface/datastore.go @@ -21,14 +21,14 @@ const ( Zcash = 133 BitcoinCash = 145 Ethereum = 60 - Phore = 1177 + Phore = 444 TestnetBitcoin = 1000000 TestnetLitecoin = 1000001 TestnetZcash = 1000133 TestnetBitcoinCash = 1000145 TestnetEthereum = 1000060 - TestnetPhore = 1001177 + TestnetPhore = 1000444 ) func (c *CoinType) String() string { From 4e02c308a8ad9f292c11682d470078afa70c6a8b Mon Sep 17 00:00:00 2001 From: anchaj Date: Mon, 17 Jun 2019 23:14:28 +0200 Subject: [PATCH 2/7] Add coin type into key manager --- bitcoin/phored/wallet.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitcoin/phored/wallet.go b/bitcoin/phored/wallet.go index 7dd8251f07..bee1a9700d 100644 --- a/bitcoin/phored/wallet.go +++ b/bitcoin/phored/wallet.go @@ -87,7 +87,7 @@ func NewRPCWallet(mnemonic string, params *chaincfg.Params, repoPath string, DB return nil, err } - keyManager, err := spvwallet.NewKeyManager(DB.Keys(), params, mPrivKey) + keyManager, err := spvwallet.NewKeyManager(DB.Keys(), params, mPrivKey, wallet.Phore) if err != nil { return nil, err } From 1637b59cae6e3cc6601990a07530f3fe95f63684 Mon Sep 17 00:00:00 2001 From: anchaj Date: Mon, 17 Jun 2019 23:21:03 +0200 Subject: [PATCH 3/7] Use BIP44 key generation --- Godeps/Godeps.json | 4 ++-- vendor/github.com/phoreproject/spvwallet/keys.go | 10 +++++----- vendor/github.com/phoreproject/spvwallet/wallet.go | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 6e5611d48b..01fd9c5ade 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -13,11 +13,11 @@ }, { "ImportPath": "github.com/phoreproject/spvwallet", - "Rev": "38d8ae391f5e77d3f13bc3ec869751281d25aca9" + "Rev": "8b0243c2b0fc86ded05bb85d9e18e9eca82ae690" }, { "ImportPath": "github.com/phoreproject/spvwallet/exchangerates", - "Rev": "38d8ae391f5e77d3f13bc3ec869751281d25aca9" + "Rev": "8b0243c2b0fc86ded05bb85d9e18e9eca82ae690" }, { "ImportPath": "github.com/phoreproject/wallet-interface", diff --git a/vendor/github.com/phoreproject/spvwallet/keys.go b/vendor/github.com/phoreproject/spvwallet/keys.go index 745755bfa2..962c05a7d8 100644 --- a/vendor/github.com/phoreproject/spvwallet/keys.go +++ b/vendor/github.com/phoreproject/spvwallet/keys.go @@ -17,8 +17,8 @@ type KeyManager struct { externalKey *hd.ExtendedKey } -func NewKeyManager(db wallet.Keys, params *chaincfg.Params, masterPrivKey *hd.ExtendedKey) (*KeyManager, error) { - internal, external, err := Bip44Derivation(masterPrivKey) +func NewKeyManager(db wallet.Keys, params *chaincfg.Params, masterPrivKey *hd.ExtendedKey, coinType wallet.CoinType) (*KeyManager, error) { + internal, external, err := Bip44Derivation(masterPrivKey, coinType) if err != nil { return nil, err } @@ -35,14 +35,14 @@ func NewKeyManager(db wallet.Keys, params *chaincfg.Params, masterPrivKey *hd.Ex } // m / purpose' / coin_type' / account' / change / address_index -func Bip44Derivation(masterPrivKey *hd.ExtendedKey) (internal, external *hd.ExtendedKey, err error) { +func Bip44Derivation(masterPrivKey *hd.ExtendedKey, coinType wallet.CoinType) (internal, external *hd.ExtendedKey, err error) { // Purpose = bip44 fourtyFour, err := masterPrivKey.Child(hd.HardenedKeyStart + 44) if err != nil { return nil, nil, err } - // Cointype = bitcoin - bitcoin, err := fourtyFour.Child(hd.HardenedKeyStart + 0) + // Cointype + bitcoin, err := fourtyFour.Child(hd.HardenedKeyStart + uint32(coinType)) if err != nil { return nil, nil, err } diff --git a/vendor/github.com/phoreproject/spvwallet/wallet.go b/vendor/github.com/phoreproject/spvwallet/wallet.go index 8490ceffbd..add8267e7f 100644 --- a/vendor/github.com/phoreproject/spvwallet/wallet.go +++ b/vendor/github.com/phoreproject/spvwallet/wallet.go @@ -98,7 +98,7 @@ func NewSPVWallet(config *Config) (*SPVWallet, error) { mutex: new(sync.RWMutex), } - w.keyManager, err = NewKeyManager(config.DB.Keys(), w.params, w.masterPrivateKey) + w.keyManager, err = NewKeyManager(config.DB.Keys(), w.params, w.masterPrivateKey, wallet.Phore) w.txstore, err = NewTxStore(w.params, config.DB, w.keyManager) if err != nil { From c013032302c786e24374d6c3f20da53c5b92d448 Mon Sep 17 00:00:00 2001 From: anchaj Date: Thu, 6 Jun 2019 16:10:38 +0200 Subject: [PATCH 4/7] Change email default header --- api/notifier.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/notifier.go b/api/notifier.go index 5d4abb05bf..4938c92622 100644 --- a/api/notifier.go +++ b/api/notifier.go @@ -85,7 +85,7 @@ func (notifier *smtpNotifier) notify(n repo.Notifier) error { "To: %s", "MIME-Version: 1.0", "Content-Type: text/html; charset=UTF-8", - "Subject: [OpenBazaar] %s\r\n", + "Subject: [Phore Marketplace] %s\r\n", "%s\r\n", }, "\r\n") head, body, ok := n.GetSMTPTitleAndBody() From 536c732a32f32f0002e9a9d12a5c0f0fcf5fadbf Mon Sep 17 00:00:00 2001 From: anchaj Date: Fri, 21 Jun 2019 00:56:14 +0200 Subject: [PATCH 5/7] Phore addresss generation changed, because of BIP44 implementation --- api/jsonapi_data_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/jsonapi_data_test.go b/api/jsonapi_data_test.go index a2c2ed17d5..94ca0863e0 100644 --- a/api/jsonapi_data_test.go +++ b/api/jsonapi_data_test.go @@ -302,7 +302,7 @@ const moderatorValidJSON = `{ const walletMneumonicJSONResponse = `{"mnemonic": "pulp open fabric travel possible slogan sense piano fog knock weird merge"}` -const walletAddressJSONResponse = `{"address": "PCNz5VN3ddp4EdfdiZBZhhxFRazuGwT3Wg"}` +const walletAddressJSONResponse = `{"address": "PUne5vo5PuMujpV6usfbJ7QSeKKUJaZ3g2"}` //const walletBalanceJSONResponse = `{"confirmed": 0, "unconfirmed": 0, "height": 0}` From 29bf3a1ee36916847e12ce54d99c5d4261717e08 Mon Sep 17 00:00:00 2001 From: anchaj Date: Sun, 23 Jun 2019 22:33:17 +0200 Subject: [PATCH 6/7] Increate seed word size for better security --- bitcoin/phored/wallet.go | 2 +- repo/init.go | 2 +- schema/manager.go | 2 +- vendor/github.com/phoreproject/spvwallet/wallet.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bitcoin/phored/wallet.go b/bitcoin/phored/wallet.go index bee1a9700d..3220f5e515 100644 --- a/bitcoin/phored/wallet.go +++ b/bitcoin/phored/wallet.go @@ -61,7 +61,7 @@ type RPCWallet struct { // NewRPCWallet creates a new wallet given func NewRPCWallet(mnemonic string, params *chaincfg.Params, repoPath string, DB wallet.Datastore, host string) (*RPCWallet, error) { if mnemonic == "" { - ent, _ := b39.NewEntropy(128) + ent, _ := b39.NewEntropy(256) mnemonic, _ = b39.NewMnemonic(ent) } diff --git a/repo/init.go b/repo/init.go index b6d23b704c..3f2117389d 100644 --- a/repo/init.go +++ b/repo/init.go @@ -273,7 +273,7 @@ func addConfigExtensions(repoRoot string) error { } func createMnemonic(newEntropy func(int) ([]byte, error), newMnemonic func([]byte) (string, error)) (string, error) { - entropy, err := newEntropy(128) + entropy, err := newEntropy(256) if err != nil { return "", err } diff --git a/schema/manager.go b/schema/manager.go index 29737a335d..5b428d310f 100644 --- a/schema/manager.go +++ b/schema/manager.go @@ -450,7 +450,7 @@ func CreateIdentityKey(mnemonic string) ([]byte, error) { // NewMnemonic will return a randomly-generated BIP-39 compliant mnemonic func NewMnemonic() (string, error) { - entropy, err := bip39.NewEntropy(128) + entropy, err := bip39.NewEntropy(256) if err != nil { return "", fmt.Errorf("creating entropy: %s", err.Error()) } diff --git a/vendor/github.com/phoreproject/spvwallet/wallet.go b/vendor/github.com/phoreproject/spvwallet/wallet.go index add8267e7f..5fe4ca111d 100644 --- a/vendor/github.com/phoreproject/spvwallet/wallet.go +++ b/vendor/github.com/phoreproject/spvwallet/wallet.go @@ -57,7 +57,7 @@ func NewSPVWallet(config *Config) (*SPVWallet, error) { log.SetBackend(logging.AddModuleLevel(config.Logger)) if config.Mnemonic == "" { - ent, err := b39.NewEntropy(128) + ent, err := b39.NewEntropy(256) if err != nil { return nil, err } From bd69ee3f0f3dd22c8a5e5bed653862b27f1f4d90 Mon Sep 17 00:00:00 2001 From: anchaj Date: Thu, 27 Jun 2019 01:27:10 +0200 Subject: [PATCH 7/7] Change version to 2.0.0 --- core/core.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/core.go b/core/core.go index ab0a584755..1ee1cd9e91 100644 --- a/core/core.go +++ b/core/core.go @@ -29,7 +29,7 @@ import ( ) var ( - VERSION = "1.3.4" + VERSION = "2.0.0" USERAGENT = "/Phore-Marketplace-go:" + VERSION + "/" )