Skip to content

Commit

Permalink
Merge pull request #976 from himynameismartin/patch-1
Browse files Browse the repository at this point in the history
Added JavaScript syntax highlighting
  • Loading branch information
Braydon Fuller committed Jan 18, 2015
2 parents c494938 + ae80f28 commit f28609a
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions docs/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,27 @@ description: Sample code for the most common task in any bitcoin application.

## Create a Private Key

```
```javascript
var privKey = new bitcore.PrivateKey();
```

## Create an Address
```

```javascript
var privKey = new bitcore.PrivateKey();
var address = privKey.toAddress();
```

## Create a Multisig Address
```

```javascript
// Build a 2-of-3 address from public keys
var P2SHAddress = new bitcore.Address([publicKey1, publicKey2, publicKey3], 2);
```

## Request a Payment
```

```javascript
var paymentInfo = {
address: '1DNtTk4PUCGAdiNETAzQFWZiy2fCHtGnPx',
amount: 120000 //satoshis
Expand All @@ -31,7 +34,8 @@ var uri = new bitcore.URI(paymentInfo).toString();
```

## Create a Transaction
```

```javascript
var transaction = new Transaction()
.from(utxos) // Feed information about what unspend outputs one can use
.to(address, amount) // Add an output with the given amount of satoshis
Expand All @@ -40,7 +44,8 @@ var transaction = new Transaction()
```

## Connect to the Network
```

```javascript
var peer = new Peer('5.9.85.34');

peer.on('inv', function(message) {
Expand Down

0 comments on commit f28609a

Please sign in to comment.