Commit Graph

19 Commits

Author SHA1 Message Date
Ryan X. Charles 76804bef45 Fix checksum comparison error. Closes #402 2014-07-03 09:17:54 -07:00
Manan Patel d83fc6e4b5 Resolves #373
Move TransactionBuilder.scriptForAddress to Address#getScriptPubKey (instance method)
2014-06-19 08:40:30 -07:00
Ryan X. Charles c2e5a14eed throw error when using invalid length hash in Address
I have often made the error of using a public key rather than the hash of the
public key when creating an address, leading to invalid addresses. I'm sure I'm
not the only one. This commit follows the principle of "fail early, fail often"
and simply throws an error if you try to insert something other than 20 bytes
long when creating an address, which would be the case when using a public key.
This way that common mistake should be reduced.
2014-06-11 18:13:39 -07:00
Manuel Araoz ce00b77de0 name change forKey -> fromKey 2014-04-29 11:49:42 -03:00
Manuel Araoz a1a844c1e6 add Address.forKey convenience method and example vanity address generator 2014-04-29 11:49:42 -03:00
Matias Alejo Garcia 5a1d572a8d add new constructor to Address (fromScriptPubKey) 2014-04-18 16:51:40 -03:00
Ryan X. Charles a7c8cf49b3 update fromPubKeys to use fromScript
This means fewer code-duplication. Also added another test for fromScript to
make sure it is thoroughly tested. Also pass through opts to createMultisig so
that you can choose to lot let it be sorted if you want.
2014-04-09 14:07:56 -03:00
Ryan X. Charles ae14c4aaa0 new convenient interface for creating addresses
To create an address from a public key or script, you used to have to do the
hashing yourself, and find the version yourself. For example:

var hash = bitcore.util.sha256ripe160(pubkey);
var version = bitcore.networks['livenet'].addressVersion;
var addr = new Address(version, hash);

But with this interface, things are much simpler:

var addr = Address.fromPubKey(pubkey);

The new convenience methods are:

Address.fromPubKey (for regular pubkeyhash addresses)
Address.fromPubKeys (for p2sh multisig addresses)
Address.fromScript (for any p2sh address)
2014-04-09 13:11:24 -03:00
Manuel Araoz 3cd4e31c31 fix Address validation issue 2014-03-19 18:44:24 -03:00
Manuel Araoz 1324974c4d add isScript to Address 2014-03-19 16:20:41 -03:00
Matias Alejo Garcia 7d1df2602c add test for #network in Address 2014-03-15 18:39:51 -03:00
Manuel Araoz 13b1431c56 change default way of validating Addresses 2014-03-11 11:27:29 -03:00
Manuel Araoz ad34fd191d starting Address idiom changes 2014-03-11 10:21:26 -03:00
Matias Alejo Garcia 089fbab719 support soop with browser all test passing 2014-03-08 18:42:08 -03:00
Matias Alejo Garcia c0c325dabd all classes working with soop and test passing 2014-03-05 16:11:16 -03:00
Manuel Araoz e295e33800 starting with Transaction class 2014-02-06 12:57:47 -03:00
Manuel Araoz fc93218c56 Address working in the browser 2014-02-05 18:15:10 -03:00
Manuel Araoz 0a6ddaffa3 EncodedData working in the browser 2014-02-05 18:15:10 -03:00
Manuel Araoz 304fdc013d starting address migration 2014-02-05 18:15:10 -03:00