Skip to content

Commit

Permalink
Added BTCP and ZCL support for Ledger Nano S. *Not complete. Place ho…
Browse files Browse the repository at this point in the history
…lder params, no testing, do not use.*

Added BTCP and ZCL support for Ledger Nano S.
*Not ready, functional or tested. *
ZCL Needs:
-Correct pubkeyhash and scrypt hash:
Replace
pubKeyHash: 0x1CB8
scriptHash: 0x1CBD
BTCP Needs:
-Slip registration https://github.com/satoshilabs/slips/blob/master/slip-0044.md
-Correct pubkeyhash and scrypt hash and active blockchain explorer
Replace
pubKeyHash: 0
scriptHash: 5
Using current / invalid params from BitcoinPrivate/contrib/testgen/gen_base58_test_vectors.py
https://github.com/BTCPrivate/BitcoinPrivate
  • Loading branch information
KirkBallou committed Jan 7, 2018
1 parent 7499600 commit 877fad9
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 0 deletions.
91 changes: 91 additions & 0 deletions app/src/bitcoin/networks.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ bitcoin.networks.zcash =
pubKeyHash: 0x1CB8
scriptHash: 0x1CBD

bitcoin.networks.zclassic =
magicPrefix: '\x16Zclassic Signed Message:\n'
bip32:
public: 0x0488B21E,
private: 0x05358394
pubKeyHash: 0x1CB8
scriptHash: 0x1CBD

bitcoin.networks.clubcoin =
magicPrefix: '\x19ClubCoin Signed Message:\n'
bip32:
Expand Down Expand Up @@ -118,6 +126,14 @@ bitcoin.networks.digibyte =
pubKeyHash: 30
scriptHash: 5

bitcoin.networks.btcprivate =
magicPrefix: '\x18BitcoinPrivate Signed Message:\n'
bip32:
public: 0x0488B21E,
private: 0x05358394
pubKeyHash: 0
scriptHash: 5

ledger.bitcoin ||= {}
ledger.bitcoin.Networks =
bitcoin:
Expand Down Expand Up @@ -570,6 +586,81 @@ ledger.bitcoin.Networks =
dust: 10000
handleFeePerByte: no

zclassic:
name: 'zclassic'
display_name: 'zclassic'
plural: 'zclassic'
scheme: 'zclassic:'
bolosAppName: 'Zclassic'
ticker: 'zcl'
tickerKey:
from: 'fromZCL'
to: 'toZCL'
bip44_coin_type: '147'
handleSegwit: no
isSegwitSupported: no
version:
regular: 0x1CB8
P2SH: 0x1CBD
XPUB: 0x0488B21E
bitcoinjs: bitcoin.networks.zclassic
dust: 10000
handleFeePerByte: no

# not tested, verified or ready for prime time
bitcoin_private_unsplit:
name: 'bitcoin_private_unsplit'
display_name: 'bitcoin private'
chain: 'Bitcoin Private (Main)'
bolosAppName: 'Bitcoin Private'
plural: 'bitcoin private'
ticker: 'btcp'
scheme: 'bitcoin private:'
tickerKey:
from: 'fromBTCP'
to: 'toBTCP'
bip44_coin_type: '0'
handleSegwit: no
isSegwitSupported: no
version:
regular: 0
P2SH: 5
XPUB: 0x0488B21E
bitcoinjs: bitcoin.networks.btcprivate
ws_chain: 'bitcoin'
dust: 5430
handleFeePerByte: yes
notCompatible: yes
greyed: no
message: yes

bitcoin_private_split:
name: 'bitcoin_private_split'
display_name: 'bitcoin'
chain: 'Bitcoin Private (Split)'
bolosAppName: 'Bitcoin Private'
plural: 'bitcoin private'
ticker: 'abc'
scheme: 'bitcoin private:'
tickerKey:
from: 'fromBTCP'
to: 'toBTCP'
bip44_coin_type: '' # <- needs slip registry https://github.com/satoshilabs/slips/blob/master/slip-0044.md
handleSegwit: no
isSegwitSupported: no
version:
regular: 0
P2SH: 5
XPUB: 0x0488B21E
bitcoinjs: bitcoin.networks.btcprivate
ws_chain: 'bitcoin'
dust: 5430
handleFeePerByte: yes
notCompatible: yes
greyed: yes
message: yes


clubcoin:
name: 'clubcoin'
display_name: 'clubcoin'
Expand Down
37 changes: 37 additions & 0 deletions app/src/preferences/defaults.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,21 @@ ledger.preferences.zcash =
address: 'https://explorer.zcha.in/transactions/%s'
discoveryGap: 20

ledger.preferences.zclassic =
Display:
units:
bitcoin:
symbol: 'ZCL'
unit: 8

# Coin preferences
Coin:
explorers:
zchain:
name: 'Zclassicexplorer.com'
address: 'http://149.56.129.104/insight/tx/%s'
discoveryGap: 20

ledger.preferences.dash =
Display:
units:
Expand Down Expand Up @@ -670,6 +685,8 @@ ledger.preferences.viacoin =
address: 'https://prohashing.com/explorer/Viacoin/%s'
discoveryGap: 20



ledger.preferences.viacoin_segwit = ledger.preferences.viacoin

ledger.preferences.qtum =
Expand Down Expand Up @@ -717,4 +734,24 @@ ledger.preferences.digibyte =
address: 'https://digiexplorer.info/tx/%s'
discoveryGap: 20


ledger.preferences.btcprivate =
Display:
units:
bitcoin:
symbol: 'BTCP'
unit: 8
milibitcoin:
symbol: 'mBTCP'
unit: 5

# Coin preferences
# // todo : no active block explorer for BTCP yet
Coin:
explorers:
cryptoID:
name: 'CryptoID'
address: 'https://chainz.cryptoid.info/btcp/tx.dws?%s.htm'
discoveryGap: 20

ledger.preferences.common.setCoin("bitcoin")

13 comments on commit 877fad9

@interbiznw
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you need to for the Zclassic to be completed?

@KirkBallou
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think just the correct params for these two:

  • pubKeyHash: 0x1CB8
  • scriptHash: 0x1CBD
    Current values are placeholders. Same as Zcash.

Then need Zclassic team to test, verify and submit to LedgerHQ.
BTCP probably needs to be commented out until the chain is live.

@interbiznw
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am part of the team so I will take this to them and get you what you need if you haven't already been in contact! Thanks for your work on this!

@interbiznw
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like the zclassic ones are unchanged, reference here: https://github.com/BTCP-community/zclassicjs/blob/master/lib/config.js

pubKeyHash: '1cb8', scriptHash: '1cbd',

@KirkBallou
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@interbiznw thanks. Looks like just the bip32 was off. I put in the correct bip32 hash from that link and commented out BTCP code for now.
Give it a try and let me know. Latest commit here:
beb7f2d

@wznoinski
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi Kirk
do you need a tester from ZCL/BTCP community to test the latest commit and support of ZCL on their nano s ?

@interbiznw
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wznoinski This is just for the chrome app. It by itself does not add integration on the ledger nano s.

@interbiznw
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wznoinski By the way, I have updated and created a pull request with ledger here LedgerHQ#82

@wznoinski
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@interbiznw my understanding was

  1. flash hardware wallet
  2. start Bitcoin app on hw wallet
  3. start the main (bitcoin) chrome wallet with ZCL support
  4. 2&3 will synchronize and chrome wallet will see ZCL similar to what current options you have for Bitcoin/Bitcoin Cash or SYGWIN/noSYGWIT

Correct me if I'm wrong.

@interbiznw
Copy link

@interbiznw interbiznw commented on 877fad9 Feb 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wznoinski

  1. What are you flashing the hardware wallet with? This is what I'm talking about that this specific thing is only the chrome ledger app.

Once the nano s bitcoin app is updated, yes you will use the ledger bitcoin chrome app with Zcl support, and open it such as its bitcoin/bch/ or any of the other bitcoin variants that use the same app.

But as you can notice, on the hardware side there is still a specific app for each, bitcoin, bch, vertcoin, and all the other variants(and will need to be a separate one for ZCL and eventually BTCP also) even though they can share the same Chrome app.

So to sum it up, the Bitcoin app for the Hardware side of the Ledger Nano S, needs the integration also to work hand in hand with the ledger bitcoin chrome wallet.

I also have a pull request for the nano-s app here: LedgerHQ/app-bitcoin#20

@interbiznw
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wznoinski Now this one, LedgerHQ/app-bitcoin#20 You can setup the build environment and flash your nano s with this version to test if you would like

@wznoinski
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@interbiznw thanks for clarifying

@douglasdeodato
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@interbiznw when we will be able to see this working fully on Ledger nano S? thanks man for the help.

Please sign in to comment.