Skip to content

Commit ff98130

Browse files
committed
Updates README.md to stricter ECKey API
1 parent b4f70dc commit ff98130

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ These examples assume you are running bitcoinjs-lib in the browser.
4949

5050
```javascript
5151

52-
key = new Bitcoin.ECKey()
52+
key = Bitcoin.ECKey.makeRandom()
5353

5454
// Print your private key (a hex string)
5555
console.log(key.toString())
5656
// => 8c112cf628362ecf4d482f68af2dbb50c8a2cb90d226215de925417aa9336a48
5757

5858
// Print your public key (defaults to a Bitcoin address)
59-
console.log(key.getPub().getAddress())
59+
console.log(key.pub.getAddress())
6060
// => 14bZ7YWde4KdRb5YN7GYkToz3EHVCvRxkF
6161
```
6262

@@ -72,7 +72,7 @@ tx.addInput("aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31",
7272
tx.addOutput("1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK", 15000)
7373

7474
// Initialize a private key using hex
75-
key = new Bitcoin.ECKey("8c112cf628362ecf4d482f68af2dbb50c8a2cb90d226215de925417aa9336a48")
75+
key = Bitcoin.ECKey.fromHex("8c112cf628362ecf4d482f68af2dbb50c8a2cb90d226215de925417aa9336a48")
7676

7777
// Sign the first input with the new key
7878
tx.sign(0, key)

0 commit comments

Comments
 (0)