Skip to content

Commit

Permalink
Merge pull request #7 from seegno/enhancement/minor-process-improvements
Browse files Browse the repository at this point in the history
Minor process improvements
  • Loading branch information
ruimarinho committed Feb 21, 2016
2 parents b665e42 + b283718 commit 1bbd3e4
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Changelog.md
CHANGELOG.md
coverage
dist
node_modules
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist -diff
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: bash

script:
- docker-compose run --rm sut

services:
- docker

sudo: false
18 changes: 7 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
FROM mhart/alpine-node:5
FROM mhart/alpine-node:4

RUN apk add --update make gcc g++ python git && rm -rf /var/cache/apk/*
RUN adduser -S node

RUN adduser -S bitcoin
WORKDIR /home/node/app

WORKDIR /home/bitcoin/app

COPY package.json /home/bitcoin/app/
COPY package.json /home/node/app/

RUN npm install --ignore-scripts

COPY . /home/bitcoin/app/

RUN chown -R bitcoin /home/bitcoin
COPY . /home/node/app/

USER bitcoin
RUN chown -R node /home/node

RUN npm rebuild
USER node

RUN npm run transpile

Expand Down
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,22 +189,22 @@ These configuration values may also be set on the `bitcoin.conf` file of your pl
### getTransactionByHash()
Given a transaction hash, returns a transaction in binary, hex-encoded binary, or JSON formats.

##### Arguments
#### Arguments
1. `hash` _(string)_: the transaction hash.
2. `[summary=false]` _(boolean)_: whether to return just the transaction hash, thus saving memory.
3. `[extension=json]` _(string)_: return in binary (`bin`), hex-encoded binary (`hex`), or JSON format.

### getBlockByHash()
Given a block hash, returns a block, in binary, hex-encoded binary or JSON formats.

##### Arguments
#### Arguments
1. `hash` _(string)_: the block hash.
2. `[extension=json]` _(string)_: return in binary (`bin`), hex-encoded binary (`hex`), or JSON format.

### getBlockHeadersByHash()
Given a block hash, returns amount of block headers in upward direction.

##### Arguments
#### Arguments
1. `hash` _(string)_: the block hash.
2. `count` _(number)_: the number of blocks to count in upward direction.
3. `[extension=json]` _(string)_: return in binary (`bin`), hex-encoded binary (`hex`), or JSON format.
Expand All @@ -215,7 +215,7 @@ Returns various state info regarding block chain processing.
### getUnspentTransactionOutputs()
Query unspent transaction outputs (UTXO) for a given set of outpoints. See [BIP64](https://github.com/bitcoin/bips/blob/master/bip-0064.mediawiki) for input and output serialisation.

##### Arguments
#### Arguments
1. `outpoints` _(array\<Object\>|Object)_: the outpoint to query in the format `{ id: "<txid>", index: "<index>" }`.
2. `[extension=json]` _(string)_: return in binary (`bin`), hex-encoded binary (`hex`), or JSON format.

Expand Down Expand Up @@ -282,11 +282,27 @@ const client = new Client({
```

## Tests
Currently the test suite is tailored for Docker (including `docker-compose`) due to the multitude of different `bitcoind` configurations that are required in order to get the test suite passing.

To test using a local installation of `node.js` but with dependencies (e.g. `bitcoind`) running inside Docker:

```sh
npm run dependencies
npm test
```

To test using Docker exclusively (similarly to what is done in Travis CI):

```sh
npm run testdocker
```

## Release

```sh
npm version [<newversion> | major | minor | patch] -m "Release %s"
```

## License
MIT

Expand Down
4 changes: 1 addition & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ sut:
bitcoind:
image: seegno/bitcoind:0.12
command:
-datadir=/var/lib/bitcoind
-printtoconsole
-regtest=1
-rest
Expand All @@ -26,12 +25,12 @@ bitcoind:
bitcoind-ssl:
image: seegno/bitcoind:0.11
command:
-datadir=/var/lib/bitcoind
-printtoconsole
-regtest=1
-rest
-rpcallowip=10.211.0.0/16
-rpcallowip=172.17.0.0/16
-rpcallowip=192.168.0.0/16
-rpcpassword=bar
-rpcssl
-rpcsslcertificatechainfile=/etc/ssl/bitcoind/cert.pem
Expand All @@ -46,7 +45,6 @@ bitcoind-ssl:
bitcoind-username-only:
image: seegno/bitcoind:0.11
command:
-datadir=/var/lib/bitcoind
-printtoconsole
-regtest=1
-rest
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@
"scripts": {
"changelog": "github_changelog_generator --no-issues --header-label='# Changelog'",
"cover": "babel-node node_modules/.bin/isparta cover --report html _mocha -- $npm_package_options_mocha",
"dependencies": "docker-compose up -d bitcoind bitcoind-ssl bitcoind-username-only",
"lint": "eslint src test && jscs src test",
"prepublish": "npm run transpile",
"testdocker": "docker-compose run --rm sut",
"test": "NODE_ENV=test mocha $npm_package_options_mocha",
"transpile": "rm -rf dist/* && babel src --out-dir dist"
"test": "mocha $npm_package_options_mocha",
"transpile": "rm -rf dist/* && babel src --out-dir dist",
"version": "npm run changelog -- --future-release=$npm_package_version && sed -i '' -e :a -e '$d;N;2,3ba' -e 'P;D' CHANGELOG.md && npm run transpile && git add -A CHANGELOG.md dist"
},
"dependencies": {
"bluebird": "^3.1.1",
Expand Down

0 comments on commit 1bbd3e4

Please sign in to comment.