From 4a9658184a5d1bb9d8317cb22af9dfd007742ba9 Mon Sep 17 00:00:00 2001 From: OstlerDev Date: Mon, 15 Jan 2018 16:43:07 -0800 Subject: [PATCH] btc -> flo --- .gitignore | 4 +- .npmignore | 4 +- LICENSE | 4 +- README.md | 26 +++++------ bin/bitcore-node | 4 +- contrib/printKeys.js | 6 +-- contrib/restart_bitcore_node.js | 4 +- contrib/systemd_bitcore.service | 6 +-- docs/bus.md | 8 ++-- docs/development.md | 60 +++++++++++++------------- docs/node.md | 12 +++--- docs/release.md | 4 +- docs/scaffold.md | 12 +++--- docs/services.md | 34 +++++++-------- docs/services/address.md | 4 +- docs/services/block.md | 2 +- docs/services/db.md | 2 +- docs/services/fee.md | 2 +- docs/services/header.md | 2 +- docs/services/mempool.md | 2 +- docs/services/p2p.md | 4 +- docs/services/timestamp.md | 2 +- docs/services/transaction.md | 2 +- docs/services/web.md | 4 +- docs/upgrade.md | 30 ++++++------- index.js | 6 +-- lib/cli/bitcore.js | 8 ++-- lib/cli/bitcored.js | 8 ++-- lib/cli/daemon.js | 12 +++--- lib/cli/main.js | 34 +++++++-------- lib/errors.js | 6 +-- lib/logger.js | 4 +- lib/node.js | 4 +- lib/scaffold/add.js | 18 ++++---- lib/scaffold/create.js | 36 ++++++++-------- lib/scaffold/default-config.js | 14 +++--- lib/scaffold/find-config.js | 12 +++--- lib/scaffold/remove.js | 22 +++++----- lib/scaffold/start.js | 24 +++++------ lib/service.js | 2 +- lib/services/address/index.js | 6 +-- lib/services/block/index.js | 4 +- lib/services/block/reorg.js | 4 +- lib/services/db/index.js | 6 +-- lib/services/fee/index.js | 6 +-- lib/services/p2p/index.js | 4 +- lib/services/web/index.js | 4 +- package-lock.json | 16 +++---- package.json | 26 +++++------ test/index.unit.js | 10 ++--- test/scaffold/add.integration.js | 10 ++--- test/scaffold/create.integration.js | 10 ++--- test/scaffold/remove.integration.js | 6 +-- test/services/address/encoding.unit.js | 4 +- test/services/db/index.unit.js | 2 +- test/services/fee/index.unit.js | 2 +- test/services/header/index.unit.js | 2 +- 57 files changed, 288 insertions(+), 288 deletions(-) diff --git a/.gitignore b/.gitignore index 6709219a..72e9dc6d 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/.npmignore b/.npmignore index 6709219a..72e9dc6d 100644 --- a/.npmignore +++ b/.npmignore @@ -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 diff --git a/LICENSE b/LICENSE index 3f3b4df3..ff34901f 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/README.md b/README.md index 3655a867..4bcfc0e7 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/bin/bitcore-node b/bin/bitcore-node index 96291d28..a242efca 100755 --- a/bin/bitcore-node +++ b/bin/bitcore-node @@ -1,4 +1,4 @@ #!/usr/bin/env node -var bitcore = require('../lib/cli/bitcore'); -bitcore(); +var flocore = require('../lib/cli/flocore'); +flocore(); diff --git a/contrib/printKeys.js b/contrib/printKeys.js index 368acc91..e70254cd 100644 --- a/contrib/printKeys.js +++ b/contrib/printKeys.js @@ -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; diff --git a/contrib/restart_bitcore_node.js b/contrib/restart_bitcore_node.js index 07a41f9a..49b93b32 100755 --- a/contrib/restart_bitcore_node.js +++ b/contrib/restart_bitcore_node.js @@ -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 & diff --git a/contrib/systemd_bitcore.service b/contrib/systemd_bitcore.service index 16c9dd31..76e39712 100644 --- a/contrib/systemd_bitcore.service +++ b/contrib/systemd_bitcore.service @@ -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 diff --git a/docs/bus.md b/docs/bus.md index 8746d682..d08e5291 100644 --- a/docs/bus.md +++ b/docs/bus.md @@ -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'); ``` diff --git a/docs/development.md b/docs/development.md index 39683df6..045cfa6b 100644 --- a/docs/development.md +++ b/docs/development.md @@ -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:/bitcore-node.git -git clone git@github.com:/bitcore-lib.git +git clone git@github.com:/flocore-node.git +git clone git@github.com:/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:/bitcoin.git +git clone git@github.com:/florincoin.git git fetch origin : git checkout ``` -**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", "" ], "servicesConfig": { - "bitcoind": { + "florincoind": { "spawn": { - "datadir": "/home//.bitcoin", - "exec": "/home//bitcoin/src/bitcoind" + "datadir": "/home//.florincoin", + "exec": "/home//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 `/bitcoin.conf` has the necessary settings, for example: +Make sure that the `/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 ``` \ No newline at end of file diff --git a/docs/node.md b/docs/node.md index 77e265bc..759e30c7 100644 --- a/docs/node.md +++ b/docs/node.md @@ -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) { diff --git a/docs/release.md b/docs/release.md index b2aa0a30..892322d3 100644 --- a/docs/release.md +++ b/docs/release.md @@ -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`: diff --git a/docs/scaffold.md b/docs/scaffold.md index 3b0fa7ae..4241d3cb 100644 --- a/docs/scaffold.md +++ b/docs/scaffold.md @@ -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. diff --git a/docs/services.md b/docs/services.md index 02eb1117..e2f29ad2 100644 --- a/docs/services.md +++ b/docs/services.md @@ -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//.bitcoin', - exec: '/home//bitcore-node/bin/bitcoind' + datadir: '/home//.florincoin', + exec: '/home//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..`. 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. diff --git a/docs/services/address.md b/docs/services/address.md index 48a6d4d3..2f6170c6 100644 --- a/docs/services/address.md +++ b/docs/services/address.md @@ -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. diff --git a/docs/services/block.md b/docs/services/block.md index 9cf6255b..d34e9466 100644 --- a/docs/services/block.md +++ b/docs/services/block.md @@ -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 diff --git a/docs/services/db.md b/docs/services/db.md index 8a4105f2..26195a2e 100644 --- a/docs/services/db.md +++ b/docs/services/db.md @@ -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 diff --git a/docs/services/fee.md b/docs/services/fee.md index eeadeedf..978a5aa0 100644 --- a/docs/services/fee.md +++ b/docs/services/fee.md @@ -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 diff --git a/docs/services/header.md b/docs/services/header.md index 7abb55c2..de221eb9 100644 --- a/docs/services/header.md +++ b/docs/services/header.md @@ -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 diff --git a/docs/services/mempool.md b/docs/services/mempool.md index 066594a0..5f2e9912 100644 --- a/docs/services/mempool.md +++ b/docs/services/mempool.md @@ -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 diff --git a/docs/services/p2p.md b/docs/services/p2p.md index 140f9a95..46f620af 100644 --- a/docs/services/p2p.md +++ b/docs/services/p2p.md @@ -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 diff --git a/docs/services/timestamp.md b/docs/services/timestamp.md index 9039ec3e..e529268d 100644 --- a/docs/services/timestamp.md +++ b/docs/services/timestamp.md @@ -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 diff --git a/docs/services/transaction.md b/docs/services/transaction.md index c7d0020b..b243350d 100644 --- a/docs/services/transaction.md +++ b/docs/services/transaction.md @@ -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 diff --git a/docs/services/web.md b/docs/services/web.md index 61360711..8c807f48 100644 --- a/docs/services/web.md +++ b/docs/services/web.md @@ -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 { diff --git a/docs/upgrade.md b/docs/upgrade.md index fcc2cba1..a556c0b3 100644 --- a/docs/upgrade.md +++ b/docs/upgrade.md @@ -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//.bitcoin", + "datadir": "/home//.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//.bitcoin", - "exec": "/home//bitcore-node/bin/bitcoind" + "datadir": "/home//.florincoin", + "exec": "/home//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= rpcpassword= ``` -**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`. diff --git a/index.js b/index.js index c4bd277d..52de2f29 100644 --- a/index.js +++ b/index.js @@ -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'); diff --git a/lib/cli/bitcore.js b/lib/cli/bitcore.js index bcbaa5ee..c798447c 100644 --- a/lib/cli/bitcore.js +++ b/lib/cli/bitcore.js @@ -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) { diff --git a/lib/cli/bitcored.js b/lib/cli/bitcored.js index 4462a8ea..7f8f27a4 100644 --- a/lib/cli/bitcored.js +++ b/lib/cli/bitcored.js @@ -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) { diff --git a/lib/cli/daemon.js b/lib/cli/daemon.js index a28fa8ae..ffb74792 100644 --- a/lib/cli/daemon.js +++ b/lib/cli/daemon.js @@ -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 ', 'Specify the directory with Bitcore Node configuration'); + .option('-c, --config ', 'Specify the directory with Flocore Node configuration'); program.parse(process.argv); diff --git a/lib/cli/main.js b/lib/cli/main.js index 3f0a760b..d32d1997 100644 --- a/lib/cli/main.js +++ b/lib/cli/main.js @@ -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 ') .description('Create a new node') - .option('-d, --datadir ', 'Specify the bitcoin database directory') + .option('-d, --datadir ', '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 ', 'Specify the directory with Bitcore Node configuration') + .option('-c, --config ', '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(); }); diff --git a/lib/errors.js b/lib/errors.js index c534d0a2..d0dc9acc 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -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 }; diff --git a/lib/logger.js b/lib/logger.js index 78c84525..b621f9d3 100644 --- a/lib/logger.js +++ b/lib/logger.js @@ -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'); /** diff --git a/lib/node.js b/lib/node.js index 3f90cfc9..845e1e1a 100644 --- a/lib/node.js +++ b/lib/node.js @@ -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'); diff --git a/lib/scaffold/add.js b/lib/scaffold/add.js index 76f24bdb..691b01e6 100644 --- a/lib/scaffold/add.js +++ b/lib/scaffold/add.js @@ -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 ); diff --git a/lib/scaffold/create.js b/lib/scaffold/create.js index 49cee1e6..a02f52d5 100644 --- a/lib/scaffold/create.js +++ b/lib/scaffold/create.js @@ -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(); } diff --git a/lib/scaffold/default-config.js b/lib/scaffold/default-config.js index c6b833aa..fb5ca3f3 100644 --- a/lib/scaffold/default-config.js +++ b/lib/scaffold/default-config.js @@ -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}.`); diff --git a/lib/scaffold/find-config.js b/lib/scaffold/find-config.js index a4306e8b..879e6140 100644 --- a/lib/scaffold/find-config.js +++ b/lib/scaffold/find-config.js @@ -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')) }; } diff --git a/lib/scaffold/remove.js b/lib/scaffold/remove.js index 0471255c..275eca49 100644 --- a/lib/scaffold/remove.js +++ b/lib/scaffold/remove.js @@ -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 ); diff --git a/lib/scaffold/start.js b/lib/scaffold/start.js index 802a8776..a6dd00a5 100644 --- a/lib/scaffold/start.js +++ b/lib/scaffold/start.js @@ -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 diff --git a/lib/service.js b/lib/service.js index f95d3653..2493bd88 100644 --- a/lib/service.js +++ b/lib/service.js @@ -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); diff --git a/lib/services/address/index.js b/lib/services/address/index.js index 71901e4c..849be206 100644 --- a/lib/services/address/index.js +++ b/lib/services/address/index.js @@ -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; diff --git a/lib/services/block/index.js b/lib/services/block/index.js index 58cbd832..7450bd9d 100644 --- a/lib/services/block/index.js +++ b/lib/services/block/index.js @@ -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? diff --git a/lib/services/block/reorg.js b/lib/services/block/reorg.js index ced5ece4..be6ffae5 100644 --- a/lib/services/block/reorg.js +++ b/lib/services/block/reorg.js @@ -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) { diff --git a/lib/services/db/index.js b/lib/services/db/index.js index ecda6d08..e9412299 100644 --- a/lib/services/db/index.js +++ b/lib/services/db/index.js @@ -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); } diff --git a/lib/services/fee/index.js b/lib/services/fee/index.js index 28434b28..5e1dd71b 100644 --- a/lib/services/fee/index.js +++ b/lib/services/fee/index.js @@ -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); diff --git a/lib/services/p2p/index.js b/lib/services/p2p/index.js index 84ec2a74..7d5c35c4 100644 --- a/lib/services/p2p/index.js +++ b/lib/services/p2p/index.js @@ -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) { diff --git a/lib/services/web/index.js b/lib/services/web/index.js index 443c913b..d9a5b48f 100644 --- a/lib/services/web/index.js +++ b/lib/services/web/index.js @@ -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; diff --git a/package-lock.json b/package-lock.json index d8f28caa..64cec67c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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" diff --git a/package.json b/package.json index 74dfa803..b159f14c 100644 --- a/package.json +++ b/package.json @@ -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 ", "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", diff --git a/test/index.unit.js b/test/index.unit.js index 8c72f47d..645b5c19 100644 --- a/test/index.unit.js +++ b/test/index.unit.js @@ -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); }); }); diff --git a/test/scaffold/add.integration.js b/test/scaffold/add.integration.js index 21ef4ad7..dcbfdbb2 100644 --- a/test/scaffold/add.integration.js +++ b/test/scaffold/add.integration.js @@ -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(); diff --git a/test/scaffold/create.integration.js b/test/scaffold/create.integration.js index f2c61523..fce0f46b 100644 --- a/test/scaffold/create.integration.js +++ b/test/scaffold/create.integration.js @@ -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.'); diff --git a/test/scaffold/remove.integration.js b/test/scaffold/remove.integration.js index 1607ed64..5880e1ed 100644 --- a/test/scaffold/remove.integration.js +++ b/test/scaffold/remove.integration.js @@ -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(); diff --git a/test/services/address/encoding.unit.js b/test/services/address/encoding.unit.js index fa598846..6dbc6852 100644 --- a/test/services/address/encoding.unit.js +++ b/test/services/address/encoding.unit.js @@ -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); diff --git a/test/services/db/index.unit.js b/test/services/db/index.unit.js index 3172386f..ec7b323e 100644 --- a/test/services/db/index.unit.js +++ b/test/services/db/index.unit.js @@ -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'); }); }); diff --git a/test/services/fee/index.unit.js b/test/services/fee/index.unit.js index 50ccf96e..0d9c5b67 100644 --- a/test/services/fee/index.unit.js +++ b/test/services/fee/index.unit.js @@ -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', diff --git a/test/services/header/index.unit.js b/test/services/header/index.unit.js index 5a02a193..fcf3b350 100644 --- a/test/services/header/index.unit.js +++ b/test/services/header/index.unit.js @@ -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');