Skip to content

Instantly share code, notes, and snippets.

@mocon
Created September 9, 2017 22:57
Show Gist options
  • Save mocon/448e77f130f9e9bab3ae83d5d32a9af2 to your computer and use it in GitHub Desktop.
Save mocon/448e77f130f9e9bab3ae83d5d32a9af2 to your computer and use it in GitHub Desktop.
Description of my Bitcoin testing app

Bitcoin practice

A simple Node.js server, as well as React UI used for testing Bitcoin payments.

  1. Users log in with their Google or Facebook account, all requests are tied to their unique ID.
  2. The home page is a simple dashboard of basic user information, user transaction history and account balance.
  3. If there are pending payments, there will be a red notification icon

Workflow for a user sending money:

  1. The user can navigate to /payment to start a new payment to another user.
  2. The user can confirm the payment details from /review and confirm the start of the transaction.
  3. Back on /, the user will see their account balance remain the same, but their transaction history will show a new "pending" entry (the transaction is pending approval from the receiving user).
  4. After the receiving user confirms the transaction, the funds will be taken from the sending user, and the sending user's dashboard will be updated with a red notification and decreased balance.

Workflow for a user receiving money:

  1. After signing in, the user sees a notification about a pending transaction.
  2. The user can confirm the payment details from /review and confirm the end of the transaction.
  3. Back on /, the user will see their account balance updated, and the transaction history will show a new entry.

TODO

Setup:

  • Set up React with start, test, build
  • Set up Express
  • Build the server to /dist using yarn run build-server script
  • Set up a test for the server using yarn run test-server script
  • Look into Firebase for authentication and real-time database
  • Authenticate API requests with JSON Web Tokens

Dev:

  • Build server route for posting a new transaction
  • Build server route for posting confirmation or declining of an existing transaction
  • Build server route for getting user dashboard data
  • Build UI view for /
  • Build UI view for /payment?tid=12345
  • Build UI view for /review?tid=12345

Deployment:

  • Set up a domain on Route 53
  • Deploy the server to EC2 using yarn run deploy-server script
  • Deploy the UI to S3 using yarn run deploy-ui script
  • Set up staging and production environments for server
  • Set up staging and production environments for UI

Future

Use the knowledge and code from this repo to build out the Bitcoin payments system in future apps, such as Transaction Broker app, and Digital Credit app.

Develop

Start Node.js server on port 3000 with nodemon, server restarts on save:

yarn run start-server

Start UI on port 3001 with hot reloading (created with create-react-app):

yarn run start-ui

Test

Test the server:

yarn run test-server

Test the UI in interactive mode with:

yarn run test-ui

Test the UI once, useful when running tests from an automation:

CI=true yarn run test-ui

Build

Build the server to /dist:

yarn run build-server

Build the UI to /build:

yarn run build-ui

Deploy

Use the following:

  • AWS Route 53 for the domain
  • AWS EC2 for the server
  • AWS S3 for the UI (using static web hosting for the S3 bucket)

Push all code updates via aws-cli in deploy-server and deploy-ui scripts.

Deploy server:

N/A - Will be `yarn run deploy-server`

Deploy UI:

N/A - Will be `yarn run deploy-ui`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment