https://github.com/rootstrap/btc-users-poc
https://github.com/rootstrap/btc-users-poc
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/rootstrap/btc-users-poc
- Owner: rootstrap
- Created: 2017-12-29T21:53:08.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-20T17:04:39.000Z (over 8 years ago)
- Last Synced: 2025-01-10T14:21:32.391Z (over 1 year ago)
- Language: Ruby
- Size: 33.2 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Bitcoin payment processing
A proof of concept for accepting bitcoin payments. It consists on
a bitcoind node for receiving transactions, a worker which queues
the received transactions and link them to the users, and the web
service, which provides the user with an UI for interacting with
the platform.
When a user wants to make a deposit, a new address is created and
presented to them to make the transfer. Once the transfer is sent,
the bitcoind node detects it and queues a job in the worker to get
the transaction details and update the balance.
When a block is created including a transaction, we update the
confirmations number on that transaction, and update the amount
as confirmed (for this example, we only require one confirmation
for marking the transaction complete).
Bitcoind doesn't send additional notifications for new confirmations
on old transactions, so an additional implementation must be done
for incrementing the confirmation on old transactions when a new
block is created (when a transaction has 6 confirmations can be
considered as permanent.)
## Environment setup
Docker is required to be installed.
Setup local dockerized environment with:
`bin/dock setup`
## Starting the server
The server can be started with:
`docker-compose up`
Or, if the database service is running (`docker-compose up -d db`)
`bin/dock server`
## Migrations
Create a migration using:
`bin/dock generate-migration `
To migrate database:
`bin/dock migrate`
To migrate database to a version:
`bin/dock migrate -M `
To migrate test database:
`bin/dock migrate-test`
## Specs
Run spec suite with:
`bin/dock rspec`
## Heroku deployment
Push to the heroku instance:
`$ heroku git:remote -a -r `
Run the migrations:
`$ heroku run --remote= bin/migrate-db`
Create a user:
```
$ heroku run --remote= bundle exec rack-console
> Services::Users::Create.perform(username: '...', password: '...')
```