Skip to content

Conversation

@dcousens
Copy link
Contributor

This pull request updates network.js to use the same naming scheme for version constants as seen in #125.

It also adds the constants as they appear on https://en.bitcoin.it/wiki/List_of_address_prefixes for Dogecoin and Litecoin respectively.
This does not signify support for these other networks, but was added to show how it should take place.

@kyledrake
Copy link
Contributor

I love this pull request.

I am a very huge fan of the idea of providing support for altcoins with bitcoinjs-lib. It's just changing the network class and being able to specify it, so why not make it easy for people to do?

What would a user need to do to create an ECKey with Dogecoin here, for example? To use a Dogecoin address with Address?

@kyledrake
Copy link
Contributor

BTW, this and BIP38 support, and we've got an excellent paper wallet generation solution!

@dcousens
Copy link
Contributor Author

@kyledrake an ECKey is agnostic of the network it is used for to begin with; so there is no such thing as a Dogecoin ECKey.

The functionality that requires these version parameters are WIF, base58check encoded addresses (pubKeyHash and scriptHash) and finally HDWallet serialization.

Therefore, to get a Dogecoin address right now, you would simply do p = new ECKey() (or p = ECKey.makeRandom() in the near future) then p.getAddress(network.dogecoin.pubKeyHash) (or Address.fromPublicKey(p.pub, network.dogecoin.pubKeyHash) in the near future).

It is up for discussion whether network.dogecoin is all that should be provided, and .pubKeyHash implied by the function.

kyledrake added a commit that referenced this pull request Apr 16, 2014
Updates network.js constant names
@kyledrake kyledrake merged commit 95b3fd3 into bitcoinjs:master Apr 16, 2014
@dcousens dcousens deleted the network branch April 17, 2014 09:48
@dcousens
Copy link
Contributor Author

Related to #84 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants