Bitcoin Address Sync is a repository used to sync all Bitcoin addresses and save balances inside a MySQL database. It also provides a Swagger API documentation for using the provided APIs.
Set the following environment variables in your system or hosting environment:
-
DB_HOST
: The IP address of your MySQL database (e.g., 127.0.0.1). -
DB_USER
: The username for accessing the MySQL database. -
DB_PASSWORD
: The password for accessing the MySQL database. -
DB_DATABASE
: The name of the MySQL database to be used for storing Bitcoin address balances. -
SERVER_PORT
: The port number on which the server will run (e.g., 8000). -
SYNC_END_BLOCK_NUMBER
: The block number until which the Bitcoin addresses should be synced. -
EXPLORER_API_ENDPOINT
: The endpoint of the Bitcoin explorer API to retrieve address balances.
Follow the instructions below to install the necessary dependencies and set up the environment.
To install MySQL on Ubuntu 20.04, you can refer to the following guide: How To Install MySQL on Ubuntu 20.04.
To install Node.js on Ubuntu 20.04, you can refer to the following guide: How To Install Node.js on Ubuntu 20.04.
Yarn is a package manager for Node.js. You can install it globally by running the following command:
npm install -g yarn
To install the project dependencies, navigate to the project directory and run the following command:
yarn install
Follow the instructions below to run the Bitcoin Address Sync application.
To run the application in debug mode, use the following command:
yarn run debug
To run the application in production mode, use the following command:
yarn start
To publish a release, follow the steps below:
- Log in to the npm registry:
yarn npm:login
- Publish the release:
yarn npm:publish
Please note that you should have the necessary permissions and credentials to publish the release.
For any further assistance or queries, feel free to contact us.
- Create a .env file based on the provided .env.example file.
- Install the bitcoin-address-sync package:
npm install bitcoin-address-sync
- Require bitcoin-address-sync in your code:
require('bitcoin-address-sync');