btc -> flo

This commit is contained in:
OstlerDev 2018-01-15 16:43:07 -08:00
parent 9db5f2bb34
commit 4a9658184a
57 changed files with 288 additions and 288 deletions

4
.gitignore vendored
View File

@ -22,12 +22,12 @@ coverage/*
**/*.creator
*.log
.DS_Store
bin/bitcoin*
bin/florincoin*
bin/SHA256SUMS.asc
regtest/data/node1/regtest
regtest/data/node2/regtest
regtest/data/node3/regtest
bitcore-node.json*
flocore-node.json*
*.bak
*.orig
lib/services/insight-api

View File

@ -22,12 +22,12 @@ coverage/*
**/*.creator
*.log
.DS_Store
bin/bitcoin*
bin/florincoin*
bin/SHA256SUMS.asc
regtest/data/node1/regtest
regtest/data/node2/regtest
regtest/data/node3/regtest
bitcore-node.json*
flocore-node.json*
*.bak
*.orig
lib/services/insight-api

View File

@ -1,7 +1,7 @@
Copyright (c) 2014-2015 BitPay, Inc.
Parts of this software are based on Bitcoin Core
Copyright (c) 2009-2015 The Bitcoin Core developers
Parts of this software are based on Florincoin Core
Copyright (c) 2009-2015 The Florincoin Core developers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,20 +1,20 @@
Bitcore Node
Flocore Node
============
A Bitcoin blockchain indexing and query service. Intended to be used with as a Bitcoin full node or in conjunction with a Bitcoin full node.
A Florincoin blockchain indexing and query service. Intended to be used with as a Florincoin full node or in conjunction with a Florincoin full node.
## Upgrading from previous versions of Bitcore Node
## Upgrading from previous versions of Flocore Node
There is no upgrade path from previous versions of Bitcore Node due to the removal of the included Bitcoin Core software. By installing this version, you must resynchronize the indexes from scratch.
There is no upgrade path from previous versions of Flocore Node due to the removal of the included Florincoin Core software. By installing this version, you must resynchronize the indexes from scratch.
## Install
```bash
npm install
./bin/bitcore-node start
./bin/flocore-node start
```
Note: A default configuration file is placed in the bitcore user's home directory (~/.bitcore/bitcore-node.json). Or, alternatively, you can copy the provided "bitcore-node.json.sample" file to the project's root directory as bitcore-node.json and edit it for your preferences. If you don't have a preferred block source (trusted peer), [Bcoin](https://github.com/bcoin-org/bcoin) will be started automatically and synchronized with the mainnet chain.
Note: A default configuration file is placed in the flocore user's home directory (~/.flocore/flocore-node.json). Or, alternatively, you can copy the provided "flocore-node.json.sample" file to the project's root directory as flocore-node.json and edit it for your preferences. If you don't have a preferred block source (trusted peer), [Bcoin](https://github.com/bcoin-org/bcoin) will be started automatically and synchronized with the mainnet chain.
## Prerequisites
@ -24,21 +24,21 @@ Note: A default configuration file is placed in the bitcore user's home director
## Configuration
The main configuration file is called "bitcore-node.json". This file instructs bitcore-node for the following options:
The main configuration file is called "flocore-node.json". This file instructs flocore-node for the following options:
- location of database files (datadir)
- tcp port for web services, if configured (port)
- bitcoin network type (e.g. mainnet, testnet3, regtest), (network)
- florincoin network type (e.g. mainnet, testnet3, regtest), (network)
- what services to include (services)
- the services' configuration (servicesConfig)
## Add-on Services
There are several add-on services available to extend the functionality of Bitcore:
There are several add-on services available to extend the functionality of Flocore:
- [Insight API](https://github.com/bitpay/insight-api)
- [Insight UI](https://github.com/bitpay/insight-ui)
- [Bitcore Wallet Service](https://github.com/bitpay/bitcore-wallet-service)
- [Flocore Wallet Service](https://github.com/bitpay/flocore-wallet-service)
## Documentation
@ -60,12 +60,12 @@ There are several add-on services available to extend the functionality of Bitco
## Contributing
Please send pull requests for bug fixes, code optimization, and ideas for improvement. For more information on how to contribute, please refer to our [CONTRIBUTING](https://github.com/bitpay/bitcore/blob/master/CONTRIBUTING.md) file.
Please send pull requests for bug fixes, code optimization, and ideas for improvement. For more information on how to contribute, please refer to our [CONTRIBUTING](https://github.com/bitpay/flocore/blob/master/CONTRIBUTING.md) file.
## License
Code released under [the MIT license](https://github.com/bitpay/bitcore-node/blob/master/LICENSE).
Code released under [the MIT license](https://github.com/bitpay/flocore-node/blob/master/LICENSE).
Copyright 2013-2017 BitPay, Inc.
- bitcoin: Copyright (c) 2009-2015 Bitcoin Core Developers (MIT License)
- florincoin: Copyright (c) 2009-2015 Florincoin Core Developers (MIT License)

View File

@ -1,4 +1,4 @@
#!/usr/bin/env node
var bitcore = require('../lib/cli/bitcore');
bitcore();
var flocore = require('../lib/cli/flocore');
flocore();

View File

@ -3,8 +3,8 @@
var levelup = require('levelup');
var leveldown = require('leveldown');
var Encoding = require('../lib/services/address/encoding');
var dbPath = '/Users/chrisk/.bwdb/bitcore-node.db';
var bitcore = require('bitcore-lib');
var dbPath = '/Users/chrisk/.bwdb/flocore-node.db';
var flocore = require('flocore-lib');
var db = levelup(dbPath, {keyEncoding: 'binary', valueEncoding: 'binary'});
var prefix = new Buffer('0002', 'hex');
@ -33,7 +33,7 @@ stream.on('data', function(data) {
for(var i = 0; i < inputValuesLength / 8; i++) {
inputValues.push(buffer.readDoubleBE(i * 8 + 14));
}
var transaction = new bitcore.Transaction(data.value.slice(inputValues.length * 8 + 14));
var transaction = new flocore.Transaction(data.value.slice(inputValues.length * 8 + 14));
transaction.__height = height;
transaction.__inputValues = inputValues;
transaction.__timestamp = timestamp;

View File

@ -6,6 +6,6 @@
# e.g. ./contrib/restart_bwdb.sh && tail -f /tmp/bwdb-out
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pkill -2 -x bitcore
pkill -2 -x flocore
wait
exec $DIR/../bin/bitcore-node start >> /tmp/bwdb-out 2>&1 &
exec $DIR/../bin/flocore-node start >> /tmp/bwdb-out 2>&1 &

View File

@ -4,14 +4,14 @@ Requires=network.target
[Service]
Type=simple
WorkingDirectory=/usr/opt/bitcore
WorkingDirectory=/usr/opt/flocore
ExecStart=/usr/bin/bwdb
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartSec=15
User=bitcore
User=flocore
ExecStartPre=/bin/mkdir -p /run/bwdb
ExecStartPre=/bin/chown bitcore:bitcore /run/bwdb
ExecStartPre=/bin/chown flocore:flocore /run/bwdb
ExecStartPre=/bin/chmod 755 /run/bwdb
PermissionsStartOnly=true
TimeoutStopSec=300

View File

@ -1,5 +1,5 @@
# Bus
The bus provides a way to subscribe to events from any of the services running. It's implemented abstract from transport specific implementation. The primary use of the bus in Bitcore Node is for subscribing to events via a web socket.
The bus provides a way to subscribe to events from any of the services running. It's implemented abstract from transport specific implementation. The primary use of the bus in Flocore Node is for subscribing to events via a web socket.
## Opening/Closing
@ -20,11 +20,11 @@ bus.close();
```javascript
// subscribe to all transaction events
bus.subscribe('bitcoind/rawtransaction');
bus.subscribe('florincoind/rawtransaction');
// to subscribe to new block hashes
bus.subscribe('bitcoind/hashblock');
bus.subscribe('florincoind/hashblock');
// unsubscribe
bus.unsubscribe('bitcoind/rawtransaction');
bus.unsubscribe('florincoind/rawtransaction');
```

View File

@ -10,22 +10,22 @@ nvm install v4
## Fork and Download Repositories
To develop bitcore-node:
To develop flocore-node:
```bash
cd ~
git clone git@github.com:<yourusername>/bitcore-node.git
git clone git@github.com:<yourusername>/bitcore-lib.git
git clone git@github.com:<yourusername>/flocore-node.git
git clone git@github.com:<yourusername>/flocore-lib.git
```
To develop bitcoin or to compile from source:
To develop florincoin or to compile from source:
```bash
git clone git@github.com:<yourusername>/bitcoin.git
git clone git@github.com:<yourusername>/florincoin.git
git fetch origin <branchname>:<branchname>
git checkout <branchname>
```
**Note**: See bitcoin documentation for building bitcoin on your platform.
**Note**: See florincoin documentation for building florincoin on your platform.
## Install Development Dependencies
@ -46,27 +46,27 @@ brew install zeromq
## Install and Symlink
```bash
cd bitcore-lib
cd flocore-lib
npm install
cd ../bitcore-node
cd ../flocore-node
npm install
```
**Note**: If you get a message about not being able to download bitcoin distribution, you'll need to compile bitcoind from source, and setup your configuration to use that version.
**Note**: If you get a message about not being able to download florincoin distribution, you'll need to compile florincoind from source, and setup your configuration to use that version.
We now will setup symlinks in `bitcore-node` *(repeat this for any other modules you're planning on developing)*:
We now will setup symlinks in `flocore-node` *(repeat this for any other modules you're planning on developing)*:
```bash
cd node_modules
rm -rf bitcore-lib
ln -s ~/bitcore-lib
rm -rf bitcoind-rpc
ln -s ~/bitcoind-rpc
rm -rf flocore-lib
ln -s ~/flocore-lib
rm -rf florincoind-rpc
ln -s ~/florincoind-rpc
```
And if you're compiling or developing bitcoin:
And if you're compiling or developing florincoin:
```bash
cd ../bin
ln -sf ~/bitcoin/src/bitcoind
ln -sf ~/florincoin/src/florincoind
```
## Run Tests
@ -78,19 +78,19 @@ npm install mocha -g
To run all test suites:
```bash
cd bitcore-node
cd flocore-node
npm run regtest
npm run test
```
To run a specific unit test in watch mode:
```bash
mocha -w -R spec test/services/bitcoind.unit.js
mocha -w -R spec test/services/florincoind.unit.js
```
To run a specific regtest:
```bash
mocha -R spec regtest/bitcoind.js
mocha -R spec regtest/florincoind.js
```
## Running a Development Node
@ -102,27 +102,27 @@ cd ~
mkdir devnode
cd devnode
mkdir node_modules
touch bitcore-node.json
touch flocore-node.json
touch package.json
```
Edit `bitcore-node.json` with something similar to:
Edit `flocore-node.json` with something similar to:
```json
{
"network": "livenet",
"port": 3001,
"services": [
"bitcoind",
"florincoind",
"web",
"insight-api",
"insight-ui",
"<additional_service>"
],
"servicesConfig": {
"bitcoind": {
"florincoind": {
"spawn": {
"datadir": "/home/<youruser>/.bitcoin",
"exec": "/home/<youruser>/bitcoin/src/bitcoind"
"datadir": "/home/<youruser>/.florincoin",
"exec": "/home/<youruser>/florincoin/src/florincoind"
}
}
}
@ -135,13 +135,13 @@ Setup symlinks for all of the services and dependencies:
```bash
cd node_modules
ln -s ~/bitcore-lib
ln -s ~/bitcore-node
ln -s ~/flocore-lib
ln -s ~/flocore-node
ln -s ~/insight-api
ln -s ~/insight-ui
```
Make sure that the `<datadir>/bitcoin.conf` has the necessary settings, for example:
Make sure that the `<datadir>/florincoin.conf` has the necessary settings, for example:
```
server=1
whitelist=127.0.0.1
@ -152,11 +152,11 @@ spentindex=1
zmqpubrawtx=tcp://127.0.0.1:28332
zmqpubhashblock=tcp://127.0.0.1:28332
rpcallowip=127.0.0.1
rpcuser=bitcoin
rpcuser=florincoin
rpcpassword=local321
```
From within the `devnode` directory with the configuration file, start the node:
```bash
../bitcore-node/bin/bitcore-node start
../flocore-node/bin/flocore-node start
```

View File

@ -14,17 +14,17 @@ A node represents a collection of services that are loaded together. For more in
```js
var index = require('bitcore-node');
var Bitcoin = index.services.Bitcoin;
var index = require('flocore-node');
var Florincoin = index.services.Florincoin;
var Node = index.Node;
var configuration = {
datadir: '/home/user/.bitcoin',
datadir: '/home/user/.florincoin',
network: 'testnet',
services: [
{
name: 'bitcoind',
module: Bitcoin,
name: 'florincoind',
module: Florincoin,
config: {}
}
]
@ -37,7 +37,7 @@ node.start(function() {
});
node.on('ready', function() {
console.log('Bitcoin Node Ready');
console.log('Florincoin Node Ready');
});
node.on('error', function(err) {

View File

@ -1,10 +1,10 @@
# Release Process
Binaries for bitcoind are distributed for convenience and built deterministically with Gitian, signatures for bitcoind are located at the [gitian.sigs](https://github.com/bitpay/gitian.sigs) respository.
Binaries for florincoind are distributed for convenience and built deterministically with Gitian, signatures for florincoind are located at the [gitian.sigs](https://github.com/bitpay/gitian.sigs) respository.
## How to Release
When publishing to npm, the .gitignore file is used to exclude files from the npm publishing process. Be sure that the bitcore-node directory has only the directories and files that you would like to publish to npm. You might need to run the commands below on each platform that you intend to publish (e.g. Mac and Linux).
When publishing to npm, the .gitignore file is used to exclude files from the npm publishing process. Be sure that the flocore-node directory has only the directories and files that you would like to publish to npm. You might need to run the commands below on each platform that you intend to publish (e.g. Mac and Linux).
To make a release, bump the `version` of the `package.json`:

View File

@ -1,20 +1,20 @@
# Scaffold
A collection of functions for creating, managing, starting, stopping and interacting with a Bitcore node.
A collection of functions for creating, managing, starting, stopping and interacting with a Flocore node.
## Install
This function will add a service to a node by installing the necessary dependencies and modifying the `bitcore-node.json` configuration.
This function will add a service to a node by installing the necessary dependencies and modifying the `flocore-node.json` configuration.
## Start
This function will load a configuration file `bitcore-node.json` and instantiate and start a node based on the configuration.
This function will load a configuration file `flocore-node.json` and instantiate and start a node based on the configuration.
## Find Config
This function will recursively find a configuration `bitcore-node.json` file in parent directories and return the result.
This function will recursively find a configuration `flocore-node.json` file in parent directories and return the result.
## Default Config
This function will return a default configuration with the default services based on environment variables, and will default to using the standard `/home/user/.bitcoin` data directory.
This function will return a default configuration with the default services based on environment variables, and will default to using the standard `/home/user/.florincoin` data directory.
## Uninstall
This function will remove a service from a node by uninstalling the necessary dependencies and modifying the `bitcore-node.json` configuration.
This function will remove a service from a node by uninstalling the necessary dependencies and modifying the `flocore-node.json` configuration.
## Call Method
This function will call an API method on a node via the JSON-RPC interface.

View File

@ -1,16 +1,16 @@
# Services
Bitcore Node has a service module system that can start up additional services that can include additional:
Flocore Node has a service module system that can start up additional services that can include additional:
- Blockchain indexes (e.g. querying balances for addresses)
- API methods
- HTTP routes
- Event types to publish and subscribe
The `bitcore-node.json` file describes which services will load for a node:
The `flocore-node.json` file describes which services will load for a node:
```json
{
"services": [
"bitcoind", "web"
"florincoind", "web"
]
}
```
@ -20,36 +20,36 @@ Services correspond with a Node.js module as described in 'package.json', for ex
```json
{
"dependencies": {
"bitcore-lib": "^0.13.7",
"bitcore-node": "^0.2.0",
"flocore-lib": "^0.13.7",
"flocore-node": "^0.2.0",
"insight-api": "^3.0.0"
}
}
```
_Note:_ If you already have a bitcore-node database, and you want to query data from previous blocks in the blockchain, you will need to reindex. Reindexing right now means deleting your bitcore-node database and resyncing.
_Note:_ If you already have a flocore-node database, and you want to query data from previous blocks in the blockchain, you will need to reindex. Reindexing right now means deleting your flocore-node database and resyncing.
## Using Services Programmatically
If, instead, you would like to run a custom node, you can include services by including them in your configuration object when initializing a new node.
```js
//Require bitcore
var bitcore = require('bitcore-node');
//Require flocore
var flocore = require('flocore-node');
//Services
var Bitcoin = bitcore.services.Bitcoin;
var Web = bitcore.services.Web;
var Florincoin = flocore.services.Florincoin;
var Web = flocore.services.Web;
var myNode = new bitcore.Node({
var myNode = new flocore.Node({
network: 'regtest'
services: [
{
name: 'bitcoind',
module: Bitcoin,
name: 'florincoind',
module: Florincoin,
config: {
spawn: {
datadir: '/home/<username>/.bitcoin',
exec: '/home/<username>/bitcore-node/bin/bitcoind'
datadir: '/home/<username>/.florincoin',
exec: '/home/<username>/flocore-node/bin/florincoind'
}
}
},
@ -67,7 +67,7 @@ var myNode = new bitcore.Node({
Now that you've loaded your services you can access them via `myNode.services.<service-name>.<method-name>`. For example if you wanted to check the balance of an address, you could access the address service like so.
```js
myNode.services.bitcoind.getAddressBalance('1HB5XMLmzFVj8ALj6mfBsbifRoD4miY36v', false, function(err, total) {
myNode.services.florincoind.getAddressBalance('1HB5XMLmzFVj8ALj6mfBsbifRoD4miY36v', false, function(err, total) {
console.log(total.balance); //Satoshi amount of this address
});
```
@ -82,7 +82,7 @@ A new service can be created by inheriting from `Node.Service` and implementing
- `Service.prototype.getPublishEvents()` - Describes which events can be subscribed to for this service, useful to subscribe to events over the included web socket API.
- `Service.prototype.setupRoutes()` - A service can extend HTTP routes on an express application by implementing this method.
The `package.json` for the service module can either export the `Node.Service` directly, or specify a specific module to load by including `"bitcoreNode": "lib/bitcore-node.js"`.
The `package.json` for the service module can either export the `Node.Service` directly, or specify a specific module to load by including `"flocoreNode": "lib/flocore-node.js"`.
Please take a look at some of the existing services for implementation specifics.

View File

@ -1,13 +1,13 @@
# Address Service
The address service provides an address index for the Bitcoin blockchain. Specifically, it builds and maintains the following information about every address ever used on the Bitcoin network:
The address service provides an address index for the Florincoin blockchain. Specifically, it builds and maintains the following information about every address ever used on the Florincoin network:
- block heights the address appeared in
- transaction ids and the index in the transaction
- whether the address appeared in an input or output
- the timestamp for the block
Additionally, the address index also maintains the unspent transaction output index for the Bitcoin blockchain. Example queries for this type of data is provided by 'getAddressUnspentOutputs', 'getAddressSummary', and 'getAddressHistory'.
Additionally, the address index also maintains the unspent transaction output index for the Florincoin blockchain. Example queries for this type of data is provided by 'getAddressUnspentOutputs', 'getAddressSummary', and 'getAddressHistory'.
This service is generally used to support other services and is not used externally.

View File

@ -1,6 +1,6 @@
# Block Service
The block service provides a block index for the Bitcoin blockchain. Specifically, there are two data points this service tracks:
The block service provides a block index for the Florincoin blockchain. Specifically, there are two data points this service tracks:
- block hash
- raw block

View File

@ -1,6 +1,6 @@
# Db Service
The db service provides an abstraction over the underlying database used to store the indexes in bitcore-node.
The db service provides an abstraction over the underlying database used to store the indexes in flocore-node.
## Service Configuration

View File

@ -1,6 +1,6 @@
# Fee Service
The fee service is a requirement of the insight-api service (not a bitcore-node built-in service). Its primary purpose is to query a bitcoin full node for the most up-to-date miner fees for transactions. A bitcoin full node such as [BTC1](https://github.com/btc1/bitcoin) or [bcoin](https://github.com/bcoin-org/bcoin) with an available RPC interface is required.
The fee service is a requirement of the insight-api service (not a flocore-node built-in service). Its primary purpose is to query a florincoin full node for the most up-to-date miner fees for transactions. A florincoin full node such as [BTC1](https://github.com/btc1/florincoin) or [bcoin](https://github.com/bcoin-org/bcoin) with an available RPC interface is required.
## Service Configuration

View File

@ -1,6 +1,6 @@
# Header Service
The header service provides a header index for the Bitcoin blockchain. Specifically, it builds and maintains the following information about every bitcoin block header:
The header service provides a header index for the Florincoin blockchain. Specifically, it builds and maintains the following information about every florincoin block header:
- block hash
- block height

View File

@ -1,6 +1,6 @@
# Mempool Service
The mempool service provides a mempool transaction index for the Bitcoin blockchain. Specifically, it maintains a larger index of mempool transactions than a typical full node can manage on its own.
The mempool service provides a mempool transaction index for the Florincoin blockchain. Specifically, it maintains a larger index of mempool transactions than a typical full node can manage on its own.
- transaction id
- transaction

View File

@ -1,9 +1,9 @@
# P2P Service
The p2p service provides a peer-to-peer interface for the Bitcoin blockchain. This service abstracts the connection and commnuication interface between the Bitcoin and the rest of bitcore node.
The p2p service provides a peer-to-peer interface for the Florincoin blockchain. This service abstracts the connection and commnuication interface between the Florincoin and the rest of flocore node.
This service also provides the publisher interface on bitcore-node bus architecture. The P2P service will publish header, block and transaction events.
This service also provides the publisher interface on flocore-node bus architecture. The P2P service will publish header, block and transaction events.
## Service Configuration

View File

@ -1,6 +1,6 @@
# Timestamp Service
The timestamp service provides a block timestamp index for the Bitcoin blockchain. The only reason this index needs to exist is to ensure that block timestamps are always strictly greater than all the previous block timestamps. In the native block timestamps, this is not always the case. Without this index, accounting systems that are based on time spans (pretty much all of them), there will be issues accounting for transactions accurately.
The timestamp service provides a block timestamp index for the Florincoin blockchain. The only reason this index needs to exist is to ensure that block timestamps are always strictly greater than all the previous block timestamps. In the native block timestamps, this is not always the case. Without this index, accounting systems that are based on time spans (pretty much all of them), there will be issues accounting for transactions accurately.
- block timestamp
- block hash

View File

@ -1,6 +1,6 @@
# Transaction Service
The transaction service provides a transaction index for the Bitcoin blockchain. Specifically, it builds and maintains the following information about every transaction on the Bitcoin network:
The transaction service provides a transaction index for the Florincoin blockchain. Specifically, it builds and maintains the following information about every transaction on the Florincoin network:
- transaction ids and transactions
- input values for every transaction

View File

@ -1,5 +1,5 @@
# Web Service
The web service creates an express app which can be used by services for setting up web routes for API's, static content, web applications, etc. This allows users to interact with various bitcore node services over one http or https port.
The web service creates an express app which can be used by services for setting up web routes for API's, static content, web applications, etc. This allows users to interact with various flocore node services over one http or https port.
In order for your service to add routes, it must implement the `setupRoutes()` and `getRoutePrefix()` methods.
@ -22,7 +22,7 @@ MyService.prototype.getRoutePrefix = function() {
```
## Configuring Web Service for HTTPS
You can run the web service over https by editing your bitcore node config, setting https to true and adding httpsOptions:
You can run the web service over https by editing your flocore node config, setting https to true and adding httpsOptions:
```json
{

View File

@ -1,14 +1,14 @@
# Upgrade Notes
## From Bitcore 3.0.0 to 4.0.0
## From Flocore 3.0.0 to 4.0.0
`bitcore-node@2.1.1` to `bitcore-node@3.0.0`
`flocore-node@2.1.1` to `flocore-node@3.0.0`
This major upgrade includes changes to indexes, API methods and services. Please review below details before upgrading.
### Indexes
Indexes include *more information* and are now also *faster*. Because of this a **reindex will be necessary** when upgrading as the address and database indexes are now a part of bitcoind with three new `bitcoin.conf` options:
Indexes include *more information* and are now also *faster*. Because of this a **reindex will be necessary** when upgrading as the address and database indexes are now a part of florincoind with three new `florincoin.conf` options:
- `-addressindex`
- `-timestampindex`
- `-spentindex`
@ -17,18 +17,18 @@ To start reindexing add `reindex=1` during the **first startup only**.
### Configuration Options
- The `bitcoin.conf` file in will need to be updated to include additional indexes *(see below)*.
- The `datadir` option is now a part of `bitcoind` spawn configuration, and there is a new option to connect to multiple bitcoind processes (Please see [Bitcoin Service Docs](services/bitcoind.md) for more details). The services `db` and `address` are now a part of the `bitcoind` service. Here is how to update `bitcore-node.json` configuration options:
- The `florincoin.conf` file in will need to be updated to include additional indexes *(see below)*.
- The `datadir` option is now a part of `florincoind` spawn configuration, and there is a new option to connect to multiple florincoind processes (Please see [Florincoin Service Docs](services/florincoind.md) for more details). The services `db` and `address` are now a part of the `florincoind` service. Here is how to update `flocore-node.json` configuration options:
**Before**:
```json
{
"datadir": "/home/<username>/.bitcoin",
"datadir": "/home/<username>/.florincoin",
"network": "livenet",
"port": 3001,
"services": [
"address",
"bitcoind",
"florincoind",
"db",
"web"
]
@ -41,21 +41,21 @@ To start reindexing add `reindex=1` during the **first startup only**.
"network": "livenet",
"port": 3001,
"services": [
"bitcoind",
"florincoind",
"web"
],
"servicesConfig": {
"bitcoind": {
"florincoind": {
"spawn": {
"datadir": "/home/<username>/.bitcoin",
"exec": "/home/<username>/bitcore-node/bin/bitcoind"
"datadir": "/home/<username>/.florincoin",
"exec": "/home/<username>/flocore-node/bin/florincoind"
}
}
}
}
```
It will also be necessary to update `bitcoin.conf` settings, to include these fields:
It will also be necessary to update `florincoin.conf` settings, to include these fields:
```
server=1
whitelist=127.0.0.1
@ -70,8 +70,8 @@ rpcuser=<user>
rpcpassword=<password>
```
**Important**: Once changes have been made you'll also need to add the `reindex=1` option **only for the first startup** to regenerate the indexes. Once this is complete you should be able to remove the `bitcore-node.db` directory with the old indexes.
**Important**: Once changes have been made you'll also need to add the `reindex=1` option **only for the first startup** to regenerate the indexes. Once this is complete you should be able to remove the `flocore-node.db` directory with the old indexes.
### API and Service Changes
- Many API methods that were a part of the `db` and `address` services are now a part of the `bitcoind` service. Please see [Bitcoin Service Docs](services/bitcoind.md) for more details.
- The `db` and `address` services are deprecated, most of the functionality still exists. Any services that were extending indexes with the `db` service, will need to manage chain state itself, or build the indexes within `bitcoind`.
- Many API methods that were a part of the `db` and `address` services are now a part of the `florincoind` service. Please see [Florincoin Service Docs](services/florincoind.md) for more details.
- The `db` and `address` services are deprecated, most of the functionality still exists. Any services that were extending indexes with the `db` service, will need to manage chain state itself, or build the indexes within `florincoind`.

View File

@ -20,7 +20,7 @@ module.exports.scaffold.defaultConfig = require('./lib/scaffold/default-config')
module.exports.cli = {};
module.exports.cli.main = require('./lib/cli/main');
module.exports.cli.daemon = require('./lib/cli/daemon');
module.exports.cli.bitcore = require('./lib/cli/bitcore');
module.exports.cli.bitcored = require('./lib/cli/bitcored');
module.exports.cli.flocore = require('./lib/cli/flocore');
module.exports.cli.flocored = require('./lib/cli/flocored');
module.exports.lib = require('bitcore-lib');
module.exports.lib = require('flocore-lib');

View File

@ -5,10 +5,10 @@ var Liftoff = require('liftoff');
function main(parentServicesPath, additionalServices) {
var liftoff = new Liftoff({
name: 'bitcore',
moduleName: 'bitcore-node',
configName: 'bitcore-node',
processTitle: 'bitcore'
name: 'flocore',
moduleName: 'flocore-node',
configName: 'flocore-node',
processTitle: 'flocore'
}).on('require', function (name) {
console.log('Loading:', name);
}).on('requireFail', function (name, err) {

View File

@ -5,10 +5,10 @@ var Liftoff = require('liftoff');
function main(parentServicesPath, additionalServices) {
var liftoff = new Liftoff({
name: 'bitcored',
moduleName: 'bitcore-node',
configName: 'bitcore-node',
processTitle: 'bitcored'
name: 'flocored',
moduleName: 'flocore-node',
configName: 'flocore-node',
processTitle: 'flocored'
}).on('require', function (name) {
console.log('Loading:', name);
}).on('requireFail', function (name, err) {

View File

@ -2,20 +2,20 @@
var program = require('commander');
var path = require('path');
var bitcore = require('..');
var flocore = require('..');
function main(servicesPath, additionalServices) {
/* jshint maxstatements: 100 */
var version = bitcore.version;
var start = bitcore.scaffold.start;
var findConfig = bitcore.scaffold.findConfig;
var defaultConfig = bitcore.scaffold.defaultConfig;
var version = flocore.version;
var start = flocore.scaffold.start;
var findConfig = flocore.scaffold.findConfig;
var defaultConfig = flocore.scaffold.defaultConfig;
program
.version(version)
.description('Start the current node')
.option('-c, --config <dir>', 'Specify the directory with Bitcore Node configuration');
.option('-c, --config <dir>', 'Specify the directory with Flocore Node configuration');
program.parse(process.argv);

View File

@ -2,20 +2,20 @@
var program = require('commander');
var path = require('path');
var bitcorenode = require('..');
var flocorenode = require('..');
var utils = require('../utils');
function main(servicesPath, additionalServices) {
/* jshint maxstatements: 100 */
var version = bitcorenode.version;
var create = bitcorenode.scaffold.create;
var add = bitcorenode.scaffold.add;
var start = bitcorenode.scaffold.start;
var remove = bitcorenode.scaffold.remove;
var callMethod = bitcorenode.scaffold.callMethod;
var findConfig = bitcorenode.scaffold.findConfig;
var defaultConfig = bitcorenode.scaffold.defaultConfig;
var version = flocorenode.version;
var create = flocorenode.scaffold.create;
var add = flocorenode.scaffold.add;
var start = flocorenode.scaffold.start;
var remove = flocorenode.scaffold.remove;
var callMethod = flocorenode.scaffold.callMethod;
var findConfig = flocorenode.scaffold.findConfig;
var defaultConfig = flocorenode.scaffold.defaultConfig;
program
.version(version);
@ -23,7 +23,7 @@ function main(servicesPath, additionalServices) {
program
.command('create <directory>')
.description('Create a new node')
.option('-d, --datadir <dir>', 'Specify the bitcoin database directory')
.option('-d, --datadir <dir>', 'Specify the florincoin database directory')
.option('-t, --testnet', 'Enable testnet as the network')
.action(function(dirname, cmd){
if (cmd.datadir) {
@ -49,7 +49,7 @@ function main(servicesPath, additionalServices) {
program
.command('start')
.description('Start the current node')
.option('-c, --config <dir>', 'Specify the directory with Bitcore Node configuration')
.option('-c, --config <dir>', 'Specify the directory with Flocore Node configuration')
.action(function(cmd){
if (cmd.config) {
cmd.config = path.resolve(process.cwd(), cmd.config);
@ -72,7 +72,7 @@ function main(servicesPath, additionalServices) {
.action(function(services){
var configInfo = findConfig(process.cwd());
if (!configInfo) {
throw new Error('Could not find configuration, see `bitcore-node create --help`');
throw new Error('Could not find configuration, see `flocore-node create --help`');
}
var opts = {
path: configInfo.path,
@ -87,8 +87,8 @@ function main(servicesPath, additionalServices) {
}).on('--help', function() {
console.log(' Examples:');
console.log();
console.log(' $ bitcore-node add wallet-service');
console.log(' $ bitcore-node add insight-api');
console.log(' $ flocore-node add wallet-service');
console.log(' $ flocore-node add insight-api');
console.log();
});
@ -98,7 +98,7 @@ function main(servicesPath, additionalServices) {
.action(function(services){
var configInfo = findConfig(process.cwd());
if (!configInfo) {
throw new Error('Could not find configuration, see `bitcore-node create --help`');
throw new Error('Could not find configuration, see `flocore-node create --help`');
}
var opts = {
path: configInfo.path,
@ -113,8 +113,8 @@ function main(servicesPath, additionalServices) {
}).on('--help', function() {
console.log(' Examples:');
console.log();
console.log(' $ bitcore-node remove wallet-service');
console.log(' $ bitcore-node remove insight-api');
console.log(' $ flocore-node remove wallet-service');
console.log(' $ flocore-node remove insight-api');
console.log();
});

View File

@ -2,11 +2,11 @@
var createError = require('errno').create;
var BitcoreNodeError = createError('BitcoreNodeError');
var FlocoreNodeError = createError('FlocoreNodeError');
var RPCError = createError('RPCError', BitcoreNodeError);
var RPCError = createError('RPCError', FlocoreNodeError);
module.exports = {
Error: BitcoreNodeError,
Error: FlocoreNodeError,
RPCError: RPCError
};

View File

@ -1,7 +1,7 @@
'use strict';
var bitcore = require('bitcore-lib');
var _ = bitcore.deps._;
var flocore = require('flocore-lib');
var _ = flocore.deps._;
var colors = require('colors/safe');
/**

View File

@ -4,8 +4,8 @@ var util = require('util');
var EventEmitter = require('events').EventEmitter;
var async = require('async');
var assert = require('assert');
var bitcore = require('bitcore-lib');
var _ = bitcore.deps._;
var flocore = require('flocore-lib');
var _ = flocore.deps._;
var index = require('./');
var log = index.log;
var Bus = require('./bus');

View File

@ -4,10 +4,10 @@ var async = require('async');
var fs = require('fs');
var path = require('path');
var spawn = require('child_process').spawn;
var bitcore = require('bitcore-lib');
var flocore = require('flocore-lib');
var utils = require('../utils');
var $ = bitcore.util.preconditions;
var _ = bitcore.deps._;
var $ = flocore.util.preconditions;
var _ = flocore.deps._;
/**
* @param {String} configFilePath - The absolute path to the configuration file
@ -62,7 +62,7 @@ function addService(configDir, service, done) {
/**
* @param {String} options.cwd - The current working directory
* @param {String} options.dirname - The bitcore-node configuration directory
* @param {String} options.dirname - The flocore-node configuration directory
* @param {Array} options.services - An array of strings of service names
* @param {Function} done - A callback function called when finished
*/
@ -78,12 +78,12 @@ function add(options, done) {
var configPath = options.path;
var services = options.services;
var bitcoreConfigPath = path.resolve(configPath, 'bitcore-node.json');
var flocoreConfigPath = path.resolve(configPath, 'flocore-node.json');
var packagePath = path.resolve(configPath, 'package.json');
if (!fs.existsSync(bitcoreConfigPath) || !fs.existsSync(packagePath)) {
if (!fs.existsSync(flocoreConfigPath) || !fs.existsSync(packagePath)) {
return done(
new Error('Directory does not have a bitcore-node.json and/or package.json file.')
new Error('Directory does not have a flocore-node.json and/or package.json file.')
);
}
@ -108,8 +108,8 @@ function add(options, done) {
oldPackage = updatedPackage;
var serviceName = newDependencies[0];
// add service to bitcore-node.json
addConfig(bitcoreConfigPath, serviceName, next);
// add service to flocore-node.json
addConfig(flocoreConfigPath, serviceName, next);
});
}, done
);

View File

@ -1,10 +1,10 @@
'use strict';
var spawn = require('child_process').spawn;
var bitcore = require('bitcore-lib');
var flocore = require('flocore-lib');
var async = require('async');
var $ = bitcore.util.preconditions;
var _ = bitcore.deps._;
var $ = flocore.util.preconditions;
var _ = flocore.deps._;
var path = require('path');
var packageFile = require('../../package.json');
var mkdirp = require('mkdirp');
@ -14,22 +14,22 @@ var defaultConfig = require('./default-config');
var version = '^' + packageFile.version;
var BASE_PACKAGE = {
description: 'A full Bitcoin node build with Bitcore',
description: 'A full Florincoin node build with Flocore',
repository: 'https://github.com/user/project',
license: 'MIT',
readme: 'README.md',
dependencies: {
'bitcore-lib': '^' + bitcore.version,
'bitcore-node': version
'flocore-lib': '^' + flocore.version,
'flocore-node': version
}
};
/**
* Will create a directory and bitcoin.conf file for Bitcoin.
* Will create a directory and florincoin.conf file for Florincoin.
* @param {String} dataDir - The absolute path
* @param {Function} done - The callback function called when finished
*/
function createBitcoinDirectory(datadir, done) {
function createFlorincoinDirectory(datadir, done) {
mkdirp(datadir, function(err) {
if (err) {
throw err;
@ -42,10 +42,10 @@ function createBitcoinDirectory(datadir, done) {
}
/**
* Will create a base Bitcore Node configuration directory and files.
* Will create a base Flocore Node configuration directory and files.
* @param {Object} options
* @param {String} options.network - "testnet" or "livenet"
* @param {String} options.datadir - The bitcoin database directory
* @param {String} options.datadir - The florincoin database directory
* @param {String} configDir - The absolute path
* @param {Boolean} isGlobal - If the configuration depends on globally installed node services.
* @param {Function} done - The callback function called when finished
@ -61,7 +61,7 @@ function createConfigDirectory(options, configDir, isGlobal, done) {
var configJSON = JSON.stringify(config, null, 2);
var packageJSON = JSON.stringify(BASE_PACKAGE, null, 2);
try {
fs.writeFileSync(configDir + '/bitcore-node.json', configJSON);
fs.writeFileSync(configDir + '/flocore-node.json', configJSON);
if (!isGlobal) {
fs.writeFileSync(configDir + '/package.json', packageJSON);
}
@ -74,13 +74,13 @@ function createConfigDirectory(options, configDir, isGlobal, done) {
}
/**
* Will setup a directory with a Bitcore Node directory, configuration file,
* bitcoin configuration, and will install all necessary dependencies.
* Will setup a directory with a Flocore Node directory, configuration file,
* florincoin configuration, and will install all necessary dependencies.
*
* @param {Object} options
* @param {String} options.cwd - The current working directory
* @param {String} options.dirname - The name of the bitcore node configuration directory
* @param {String} options.datadir - The path to the bitcoin datadir
* @param {String} options.dirname - The name of the flocore node configuration directory
* @param {String} options.datadir - The path to the florincoin datadir
* @param {Function} done - A callback function called when finished
*/
function create(options, done) {
@ -103,7 +103,7 @@ function create(options, done) {
async.series([
function(next) {
// Setup the the bitcore-node directory and configuration
// Setup the the flocore-node directory and configuration
if (!fs.existsSync(absConfigDir)) {
var createOptions = {
network: options.network,
@ -115,9 +115,9 @@ function create(options, done) {
}
},
function(next) {
// Setup the bitcoin directory and configuration
// Setup the florincoin directory and configuration
if (!fs.existsSync(absDataDir)) {
createBitcoinDirectory(absDataDir, next);
createFlorincoinDirectory(absDataDir, next);
} else {
next();
}

View File

@ -10,8 +10,8 @@ function getMajorVersion(versionString) {
}
/**
* Will return the path and default bitcore-node configuration. It will search for the
* configuration file in the "~/.bitcore" directory, and if it doesn't exist, it will create one
* Will return the path and default flocore-node configuration. It will search for the
* configuration file in the "~/.flocore" directory, and if it doesn't exist, it will create one
* based on default settings.
* @param {Object} [options]
* @param {Array} [options.additionalServices] - An optional array of services.
@ -22,8 +22,8 @@ function getDefaultConfig(options) {
options = {};
}
var defaultPath = path.resolve(process.env.HOME, './.bitcore');
var defaultConfigFile = path.resolve(defaultPath, './bitcore-node.json');
var defaultPath = path.resolve(process.env.HOME, './.flocore');
var defaultConfigFile = path.resolve(defaultPath, './flocore-node.json');
if (!fs.existsSync(defaultPath)) {
mkdirp.sync(defaultPath);
@ -40,11 +40,11 @@ function getDefaultConfig(options) {
};
}
console.log(`The configuration file at '${defaultConfigFile}' is incompatible with this version of Bitcore.`);
console.log(`The configuration file at '${defaultConfigFile}' is incompatible with this version of Flocore.`);
var now = new Date();
// bitcore-node.YYYY-MM-DD.UnixTimestamp.json
var backupFileName = `bitcore-node.${now.getUTCFullYear()}-${now.getUTCMonth()}-${now.getUTCDate()}.${now.getTime()}.json`;
// flocore-node.YYYY-MM-DD.UnixTimestamp.json
var backupFileName = `flocore-node.${now.getUTCFullYear()}-${now.getUTCMonth()}-${now.getUTCDate()}.${now.getTime()}.json`;
var backupFile = path.resolve(defaultPath, backupFileName);
fs.renameSync(defaultConfigFile, backupFile);
console.log(`The previous configuration file has been moved to: ${backupFile}.`);

View File

@ -1,21 +1,21 @@
'use strict';
var bitcore = require('bitcore-lib');
var $ = bitcore.util.preconditions;
var _ = bitcore.deps._;
var flocore = require('flocore-lib');
var $ = flocore.util.preconditions;
var _ = flocore.deps._;
var path = require('path');
var fs = require('fs');
var utils = require('../utils');
/**
* Will return the path and bitcore-node configuration
* Will return the path and flocore-node configuration
* @param {String} cwd - The absolute path to the current working directory
*/
function findConfig(cwd) {
$.checkArgument(_.isString(cwd), 'Argument should be a string');
$.checkArgument(utils.isAbsolutePath(cwd), 'Argument should be an absolute path');
var directory = String(cwd);
while (!fs.existsSync(path.resolve(directory, 'bitcore-node.json'))) {
while (!fs.existsSync(path.resolve(directory, 'flocore-node.json'))) {
directory = path.resolve(directory, '../');
if (directory === '/') {
return false;
@ -23,7 +23,7 @@ function findConfig(cwd) {
}
return {
path: directory,
config: require(path.resolve(directory, 'bitcore-node.json'))
config: require(path.resolve(directory, 'flocore-node.json'))
};
}

View File

@ -4,13 +4,13 @@ var async = require('async');
var fs = require('fs');
var path = require('path');
var spawn = require('child_process').spawn;
var bitcore = require('bitcore-lib');
var $ = bitcore.util.preconditions;
var _ = bitcore.deps._;
var flocore = require('flocore-lib');
var $ = flocore.util.preconditions;
var _ = flocore.deps._;
var utils = require('../utils');
/**
* Will remove a service from bitcore-node.json
* Will remove a service from flocore-node.json
* @param {String} configFilePath - The absolute path to the configuration file
* @param {String} service - The name of the module
* @param {Function} done
@ -82,9 +82,9 @@ function removeService(configDir, service, done) {
}
/**
* Will remove the Node.js service and from the bitcore-node configuration.
* Will remove the Node.js service and from the flocore-node configuration.
* @param {String} options.cwd - The current working directory
* @param {String} options.dirname - The bitcore-node configuration directory
* @param {String} options.dirname - The flocore-node configuration directory
* @param {Array} options.services - An array of strings of service names
* @param {Function} done - A callback function called when finished
*/
@ -100,12 +100,12 @@ function remove(options, done) {
var configPath = options.path;
var services = options.services;
var bitcoreConfigPath = path.resolve(configPath, 'bitcore-node.json');
var flocoreConfigPath = path.resolve(configPath, 'flocore-node.json');
var packagePath = path.resolve(configPath, 'package.json');
if (!fs.existsSync(bitcoreConfigPath) || !fs.existsSync(packagePath)) {
if (!fs.existsSync(flocoreConfigPath) || !fs.existsSync(packagePath)) {
return done(
new Error('Directory does not have a bitcore-node.json and/or package.json file.')
new Error('Directory does not have a flocore-node.json and/or package.json file.')
);
}
@ -117,8 +117,8 @@ function remove(options, done) {
if (err) {
return next(err);
}
// remove service to bitcore-node.json
removeConfig(bitcoreConfigPath, service, next);
// remove service to flocore-node.json
removeConfig(flocoreConfigPath, service, next);
});
}, done
);

View File

@ -1,10 +1,10 @@
'use strict';
var path = require('path');
var BitcoreNode = require('../node');
var FlocoreNode = require('../node');
var index = require('../');
var bitcore = require('bitcore-lib');
var _ = bitcore.deps._;
var flocore = require('flocore-lib');
var _ = flocore.deps._;
var log = index.log;
var shuttingDown = false;
var fs = require('fs');
@ -20,17 +20,17 @@ function start(options) {
servicesPath = options.path;
}
fullConfig.path = path.resolve(options.path, './bitcore-node.json');
fullConfig.path = path.resolve(options.path, './flocore-node.json');
fullConfig.services = start.setupServices(require, servicesPath, options.config);
var node = new BitcoreNode(fullConfig);
var node = new FlocoreNode(fullConfig);
// setup handlers for uncaught exceptions and ctrl+c
start.registerExitHandlers(process, node);
node.on('ready', function() {
log.info('Bitcore Node ready');
log.info('Flocore Node ready');
});
node.on('error', function(err) {
@ -113,8 +113,8 @@ function lookInModuleManifest(req, service) {
try {
var servicePackage = req(service.name + '/package.json');
var serviceModule = service.name;
if (servicePackage.bitcoreNode) {
serviceModule = serviceModule + '/' + servicePackage.bitcoreNode;
if (servicePackage.flocoreNode) {
serviceModule = serviceModule + '/' + servicePackage.flocoreNode;
return req(serviceModule);
}
} catch(e) {
@ -139,7 +139,7 @@ function loadModule(req, service) {
}
//fourth, see if there is directory in our module search path that has a
//package.json file, if so, then see if there is a bitcoreNode field, if so
//package.json file, if so, then see if there is a flocoreNode field, if so
//use this as the path to the service module
if(!serviceCode) {
serviceCode = lookInModuleManifest(req, service);
@ -149,7 +149,7 @@ function loadModule(req, service) {
throw new Error('Attempted to load the ' + service.name + ' service from: ' +
'the requirePath in the services\' config, then "' +
process.cwd() + '" then from: "' + __dirname + '/../lib/services' + '" finally from: "' +
process.cwd() + '/package.json" - bitcoreNode field. All paths failed to find valid nodeJS code.');
process.cwd() + '/package.json" - flocoreNode field. All paths failed to find valid nodeJS code.');
}
service.module = serviceCode;
@ -160,9 +160,9 @@ function loadModule(req, service) {
* specified modules, and assemble an array in this format:
* [
* {
* name: 'bitcoind',
* name: 'florincoind',
* config: {},
* module: BitcoinService
* module: FlorincoinService
* }
* ]
* @param {Function} req - The require function to use

View File

@ -72,7 +72,7 @@ Service.prototype.start = function(done) {
};
/**
* Function to be called when bitcore-node is stopped
* Function to be called when flocore-node is stopped
*/
Service.prototype.stop = function(done) {
setImmediate(done);

View File

@ -5,9 +5,9 @@ var inherits = require('util').inherits;
var async = require('async');
var index = require('../../');
var log = index.log;
var bitcore = require('bitcore-lib');
var Unit = bitcore.Unit;
var _ = bitcore.deps._;
var flocore = require('flocore-lib');
var Unit = flocore.Unit;
var _ = flocore.deps._;
var lodash = require('lodash');
var Encoding = require('./encoding');
var Transform = require('stream').Transform;

View File

@ -91,7 +91,7 @@ BlockService.prototype.getInfo = function(callback) {
errors: '',
network: self.node.network,
relayFee: 0,
version: 'bitcore-1.1.2',
version: 'flocore-1.1.2',
protocolversion: 700001,
difficulty: self._header.getCurrentDifficulty()
});
@ -1126,7 +1126,7 @@ BlockService.prototype._sync = function() {
self._getBlocksTimer.unref();
// TODO; research how different bitcoin implementation handle block
// TODO; research how different florincoin implementation handle block
// locator objects. If you pass a block locator object that has one
// block hash and that block hash is not on the main chain, then will
// the peer send an inv for block 1 or no inv at all?

View File

@ -1,6 +1,6 @@
'use strict';
var bitcore = require('bitcore-lib');
var BufferUtil = bitcore.util.buffer;
var flocore = require('flocore-lib');
var BufferUtil = flocore.util.buffer;
var async = require('async');
function Reorg(node, block) {

View File

@ -56,11 +56,11 @@ DB.prototype._onError = function(err) {
DB.prototype._setDataPath = function() {
assert(fs.existsSync(this.node.datadir), 'Node is expected to have a "datadir" property');
if (this.node.network === 'livenet' || this.node.network === 'mainnet') {
this.dataPath = this.node.datadir + '/bitcorenode.db';
this.dataPath = this.node.datadir + '/flocorenode.db';
} else if (this.node.network === 'regtest') {
this.dataPath = this.node.datadir + '/regtest/bitcorenode.db';
this.dataPath = this.node.datadir + '/regtest/flocorenode.db';
} else if (this.node.network === 'testnet') {
this.dataPath = this.node.datadir + '/testnet/bitcorenode.db';
this.dataPath = this.node.datadir + '/testnet/flocorenode.db';
} else {
throw new Error('Unknown network: ' + this.network);
}

View File

@ -2,18 +2,18 @@
var BaseService = require('../../service');
var inherits = require('util').inherits;
var BitcoreRPC = require('bitcoind-rpc');
var FlocoreRPC = require('florincoind-rpc');
var FeeService = function(options) {
this._config = options.rpc || {
user: 'bitcoin',
user: 'florincoin',
pass: 'local321',
host: 'localhost',
protocol: 'http',
port: 8332
};
BaseService.call(this, options);
this._client = new BitcoreRPC(this._config);
this._client = new FlocoreRPC(this._config);
};
inherits(FeeService, BaseService);

View File

@ -1,6 +1,6 @@
'use strict';
var p2p = require('bitcore-p2p');
var p2p = require('flocore-p2p');
var LRU = require('lru-cache');
var util = require('util');
var index = require('../../');
@ -9,7 +9,7 @@ var BaseService = require('../../service');
var assert = require('assert');
var Bcoin = require('./bcoin');
var BcoinTx = require('bcoin').tx;
var Networks = require('bitcore-lib').Networks;
var Networks = require('flocore-lib').Networks;
var LRU = require('lru-cache');
var P2P = function(options) {

View File

@ -9,8 +9,8 @@ var socketio = require('socket.io');
var inherits = require('util').inherits;
var BaseService = require('../../service');
var bitcore = require('bitcore-lib');
var _ = bitcore.deps._;
var flocore = require('flocore-lib');
var _ = flocore.deps._;
var index = require('../../');
var log = index.log;

16
package-lock.json generated
View File

@ -1,5 +1,5 @@
{
"name": "bitcore-node",
"name": "flocore-node",
"version": "5.0.0-beta.44",
"lockfileVersion": 1,
"requires": true,
@ -330,14 +330,14 @@
"safe-buffer": "5.1.1"
}
},
"bitcoind-rpc": {
"florincoind-rpc": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/bitcoind-rpc/-/bitcoind-rpc-0.6.0.tgz",
"resolved": "https://registry.npmjs.org/florincoind-rpc/-/florincoind-rpc-0.6.0.tgz",
"integrity": "sha1-sRMsBNzc5tNT1SDI8C3a+PmB+zQ="
},
"bitcore-lib": {
"flocore-lib": {
"version": "5.0.0-beta.1",
"resolved": "https://registry.npmjs.org/bitcore-lib/-/bitcore-lib-5.0.0-beta.1.tgz",
"resolved": "https://registry.npmjs.org/flocore-lib/-/flocore-lib-5.0.0-beta.1.tgz",
"integrity": "sha512-y8aCkNJQieCPacLpW9wdg6Un2iAC/5Nt7g/lRHhK6PwrXw7dxXwc7eZOd87oPGn6bAd4jBd8YTCqIqwpf3UQsA==",
"requires": {
"bn.js": "2.0.4",
@ -376,13 +376,13 @@
}
}
},
"bitcore-p2p": {
"flocore-p2p": {
"version": "5.0.0-beta.1",
"resolved": "https://registry.npmjs.org/bitcore-p2p/-/bitcore-p2p-5.0.0-beta.1.tgz",
"resolved": "https://registry.npmjs.org/flocore-p2p/-/flocore-p2p-5.0.0-beta.1.tgz",
"integrity": "sha512-PePFFuPmrHIr4G7IHWAcFge8jo0PvXvaDS9DYGP3EYLeoYT0SQ5d4UtHIGCOrc4xdn7XaibiuMkHlv6PNCpLaw==",
"requires": {
"bcoin": "1.0.0-beta.12",
"bitcore-lib": "5.0.0-beta.1",
"flocore-lib": "5.0.0-beta.1",
"bloom-filter": "0.2.0",
"buffers": "github:bitpay/node-buffers#04f4c4264e0d105db2b99b786843ed64f23230d8",
"socks5-client": "0.3.6"

View File

@ -1,38 +1,38 @@
{
"name": "bitcore-node",
"description": "Full node with extended capabilities using Bitcore and Bitcoin Core",
"name": "flocore-node",
"description": "Full node with extended capabilities using Flocore and Florincoin Core",
"engines": {
"node": ">=8.0.0"
},
"author": "BitPay <dev@bitpay.com>",
"version": "5.0.0-beta.44",
"main": "./index.js",
"repository": "git://github.com/bitpay/bitcore-node.git",
"homepage": "https://github.com/bitpay/bitcore-node",
"repository": "git://github.com/bitpay/flocore-node.git",
"homepage": "https://github.com/bitpay/flocore-node",
"bugs": {
"url": "https://github.com/bitpay/bitcore-node/issues"
"url": "https://github.com/bitpay/flocore-node/issues"
},
"bin": {
"bitcore-node": "./bin/bitcore-node"
"flocore-node": "./bin/flocore-node"
},
"scripts": {
"test": "NODE_ENV=test mocha -R spec --recursive test"
},
"tags": [
"bitcoin",
"bitcoind",
"florincoin",
"florincoind",
"bcoin",
"bitcoin full node",
"bitcoin index",
"florincoin full node",
"florincoin index",
"block explorer",
"wallet backend"
],
"dependencies": {
"async": "^2.5.0",
"bcoin": "bitpay/bcoin#v1.0.0-beta.14+cash",
"bitcoind-rpc": "^0.6.0",
"bitcore-lib": "5.0.0-beta.1",
"bitcore-p2p": "5.0.0-beta.1",
"florincoind-rpc": "^0.6.0",
"flocore-lib": "5.0.0-beta.1",
"flocore-p2p": "5.0.0-beta.1",
"bn.js": "^4.11.8",
"body-parser": "^1.13.3",
"colors": "^1.1.2",

View File

@ -3,10 +3,10 @@
var should = require('chai').should();
describe('Index Exports', function() {
it('will export bitcore-lib', function() {
var bitcore = require('../');
should.exist(bitcore.lib);
should.exist(bitcore.lib.Transaction);
should.exist(bitcore.lib.Block);
it('will export flocore-lib', function() {
var flocore = require('../');
should.exist(flocore.lib);
should.exist(flocore.lib.Transaction);
should.exist(flocore.lib.Block);
});
});

View File

@ -25,7 +25,7 @@ describe('#add', function() {
throw err;
}
fs.writeFile(
testDir + '/s0/s1/bitcore-node.json',
testDir + '/s0/s1/flocore-node.json',
JSON.stringify(startConfig),
function(err) {
if (err) {
@ -90,12 +90,12 @@ describe('#add', function() {
});
});
it('will update bitcore-node.json services', function(done) {
it('will update flocore-node.json services', function(done) {
var callCount = 0;
var oldPackage = {
dependencies: {
'bitcore-lib': '^v0.13.7',
'bitcore-node': '^v0.2.0'
'flocore-lib': '^v0.13.7',
'flocore-node': '^v0.2.0'
}
};
var spawn = sinon.stub().returns({
@ -130,7 +130,7 @@ describe('#add', function() {
services: ['a', 'b', 'c']
}, function(err) {
should.not.exist(err);
var configPath = path.resolve(testDir, 's0/s1/bitcore-node.json');
var configPath = path.resolve(testDir, 's0/s1/flocore-node.json');
var config = JSON.parse(fs.readFileSync(configPath));
config.services.should.deep.equal(['a','b','c']);
done();

View File

@ -33,7 +33,7 @@ describe('#create', function() {
if (err) {
throw err;
}
mkdirp(testDir + '/.bitcoin', function(err) {
mkdirp(testDir + '/.florincoin', function(err) {
if (err) {
throw err;
}
@ -64,14 +64,14 @@ describe('#create', function() {
throw err;
}
var configPath = testDir + '/mynode/bitcore-node.json';
var configPath = testDir + '/mynode/flocore-node.json';
var packagePath = testDir + '/mynode/package.json';
should.equal(fs.existsSync(configPath), true);
should.equal(fs.existsSync(packagePath), true);
var config = JSON.parse(fs.readFileSync(configPath));
config.services.should.deep.equal(['bitcoind', 'db', 'address', 'web']);
config.services.should.deep.equal(['florincoind', 'db', 'address', 'web']);
config.datadir.should.equal('./data');
config.network.should.equal('livenet');
@ -104,7 +104,7 @@ describe('#create', function() {
dirname: 'mynode3',
name: 'My Node 3',
isGlobal: true,
datadir: '../.bitcoin'
datadir: '../.florincoin'
}, function(err) {
if (err) {
throw err;
@ -139,7 +139,7 @@ describe('#create', function() {
dirname: 'mynode4',
name: 'My Node 4',
isGlobal: false,
datadir: '../.bitcoin'
datadir: '../.florincoin'
}, function(err) {
should.exist(err);
err.message.should.equal('There was an error installing dependencies.');

View File

@ -25,7 +25,7 @@ describe('#remove', function() {
throw err;
}
fs.writeFile(
testDir + '/s0/s1/bitcore-node.json',
testDir + '/s0/s1/flocore-node.json',
JSON.stringify(startConfig),
function(err) {
if (err) {
@ -64,7 +64,7 @@ describe('#remove', function() {
});
});
it('will update bitcore-node.json services', function(done) {
it('will update flocore-node.json services', function(done) {
var spawn = sinon.stub().returns({
stdout: {
on: sinon.stub()
@ -92,7 +92,7 @@ describe('#remove', function() {
services: ['b']
}, function(err) {
should.not.exist(err);
var configPath = path.resolve(testDir, 's0/s1/bitcore-node.json');
var configPath = path.resolve(testDir, 's0/s1/flocore-node.json');
var config = JSON.parse(fs.readFileSync(configPath));
config.services.should.deep.equal(['a', 'c']);
done();

View File

@ -1,6 +1,6 @@
'use strict';
var bitcore = require('bitcore-lib');
var flocore = require('flocore-lib');
var should = require('chai').should();
var Encoding = require('../../../lib/services/address/encoding');
@ -38,7 +38,7 @@ describe('Address service encoding', function() {
new Buffer(txid, 'hex'),
new Buffer('00000005', 'hex')]);
var txHex = '0100000001cc3ffe0638792c8b39328bb490caaefe2cf418f2ce0144956e0c22515f29724d010000006a473044022030ce9fa68d1a32abf0cd4adecf90fb998375b64fe887c6987278452b068ae74c022036a7d00d1c8af19e298e04f14294c807ebda51a20389ad751b4ff3c032cf8990012103acfcb348abb526526a9f63214639d79183871311c05b2eebc727adfdd016514fffffffff02f6ae7d04000000001976a9144455183e407ee4d3423858c8a3275918aedcd18e88aca99b9b08010000001976a9140beceae2c29bfde08d2b6d80b33067451c5887be88ac00000000';
var tx = new bitcore.Transaction(txHex);
var tx = new flocore.Transaction(txHex);
var sats = tx.outputs[0].satoshis;
var satsBuf = new Buffer(8);
satsBuf.writeDoubleBE(sats);

View File

@ -77,7 +77,7 @@ describe('DB', function() {
it('should set the data path', function() {
dbService._setDataPath();
dbService.dataPath.should.equal('/tmp/regtest/bitcorenode.db');
dbService.dataPath.should.equal('/tmp/regtest/flocorenode.db');
});
});

View File

@ -13,7 +13,7 @@ describe('#Fee Service', function() {
sandbox = sinon.sandbox.create();
feeService = new FeeService({
rpc: {
user: 'bitcoin',
user: 'florincoin',
pass: 'local321',
host: 'localhost',
protocol: 'http',

View File

@ -7,7 +7,7 @@ var assert = chai.assert;
var expect = chai.expect;
var Encoding = require('../../../lib/services/header/encoding');
var utils = require('../../../lib/utils');
var Block = require('bitcore-lib').Block;
var Block = require('flocore-lib').Block;
var BN = require('bn.js');
var Emitter = require('events').EventEmitter;
var bcoin = require('bcoin');