Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Open-Source Cloud-Native Digital Asset & Cryptocurrency Exchange Platform

License

NotificationsYou must be signed in to change notification settings

openware/opendax

Repository files navigation

Cryptocurrency Exchange Platform - OpenDAX

OpenDAX

OpenDAX is an open-source cloud-native multi-service platform for building a Blockchain/FinTech exchange of digital assets, cryptocurrency and security tokens.

Getting started with OpenDAX

1. Get a VM

Minimum VM requirements for OpenDAX:

  • 8GB of RAM (12GB recommended)
  • 4 cores vCPU (6 cores recommended)
  • 300GB disk space (SSD recommended)

A VM from any cloud provider like DigitalOcean, Vultr, GCP, AWS as well as any dedicated server with Ubuntu, Debian or Centos would work

2. Prepare the VM

2.1 Create Unix user

SSH using root user, then create new user for the application

useradd -g users -s`which bash` -m app

2.2 Install Docker and docker compose

We highly recommend using docker and compose from docker.com install guide instead of the system provided package, which would most likely be deprecated.

Docker follow instruction here:dockerDocker compose follow steps:docker compose

2.3 Install ruby in user app

2.3.1 Change user using
su - app
2.3.2 Clone OpenDAX
git clone https://github.com/openware/opendax.git
2.3.3 Install RVM
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDBcurl -sSL https://get.rvm.io| bash -s stablecd opendaxrvm install.

3. Bundle install dependencies

bundle installrake -T# To see if ruby and lib works

Usingrake -T you can see all available commands, and can create new ones inlib/tasks

4. Run everything

4.1 Configure your domain

If using a VM you can point your domain name to the VM ip address before this stage.Recommended if you enabled SSL, for local development edit the/etc/hosts

Insert in file/etc/hosts

0.0.0.0 www.app.local

4.2 Bring everything up

rake service:all

You can login onwww.app.local with the following default users from seeds.yaml

Seeded users:Email: admin@barong.io, password: 0lDHd9ufs9t@Email: john@barong.io, password: Am8icnzEI3d!

[Optional] KYCAID

In order to accelerate customer interaction, reduce risks and simplify business processes you can use KYC Verification Service from KYCaid.KYC goal is to prevent fraud and to decline users that don’t fulfill certain standards of credibility.To learn more about KYCaid and pricing you can visit their website -kycaid.com

How to configure KYCAID on the platform?

KYCAID is already integrated into our stack, to use it you'd need to create an account onkycaid.com, and set up authentification creds there and the callback url:https://example.com/api/v2/barong/public/kyc

After that all you have to do is to change several lines inconfig/app.yml:

kyc:provider:kycaidauthorization_token:changeme# your production API token from the 'Settings' section of kycaid.comsandbox_mode:true# 'true' for test environments - documents will be verified/rejected automatically, without payment for verificationapi_endpoint:https://api.kycaid.com/
Additional settings for KYCAID
  • Be sure to checkBARONG_REQUIRED_DOCS_EXPIRE ENV value insideconfig/barong.env to befalse if you want to includeaddress verification in your KYC process. You can set it totrue if you need the document check only.
  • Check if you have the correct list ofdocument_types in theconfig/barong/barong.yml file:
    • Passport
    • Identity card
    • Driver license
    • Address
  • Frontend KYC steps can be configured intemplates/config/frontend/env.js.erb via thekycSteps field
  • Tower KYC labels can be configured intemplates/config/frontend/tower.js.erb via thelabelSwitcher field

Usage

Initial configuration

All the OpenDAX deployment files have their confguration stored inconfig/app.yml.

app.yml

The following table lists the configurable parameters of the config/app.yml configuration file and its default values.

ParameterDescriptionDefault
app.nameglobal application name"OpenDax"
app.domainbase domain nameapp.local
app.subdomainsubdomainwww
app.show_landingenable/disable landing page display for the frontend applicationtrue
render_protectenable read-only mode for rendered filesfalse
csrfEnabledenable CSRF protection on Barongfalse
ssl.enabledenable SSL certificate generationfalse
ssl.emailemail address used for SSL certificate issuing"support@example.com"
updateVersionsupdate all image tags by fetching global ones for OpenDAXfalse
imagesDocker image tags per component
vendor.frontendoptional Git URL for a development frontend repogit@github.com:openware/baseapp.git
kyc.providerKYC provider, can bekycaid orlocalkycaid
kyc.authorization_tokenoptional API token for KYCAID usechangeme
kyc.sandboxenable KYCAID test modetrue
kyc.api_endpointAPI endpoint for KYCAIDhttps://api.kycaid.com/
vault.root_tokenRoot Vault authentication tokenchangeme
vault.peatio_rails_tokenPeatio Server Vault authentication tokenchangeme
vault.peatio_crypto_tokenPeatio Daemons (cron_job, deposit, deposit_coin_address, withdraw_coin) Vault authentication tokenchangeme
vault.peatio_upstream_tokenPeatio Upstream Daemon Vault authentication tokenchangeme
vault.peatio_matching_tokenPeatio Daemons (matching, order_processor, trade_executor) Vault authentication tokenchangeme
vault.barong_tokenBarong Vault authentication tokenchangeme
vault.finex_engine_tokenFinex Engine Vault authentication tokenchangeme
database.adapterdatabase adapter kind eithermysql orpostgresqlmysql
database.hostdatabase host namedb
database.portdatabase port3306
database.userdatabase usernameroot
database.passworddatabase root passwordchangeme
storage.providerobject storage provider"Google"
storage.bucketnamestorage bucket name"opendax-barong-docs-bucket"
storage.endpointS3-compatible storage API endpoint"https://fra1.digitaloceanspaces.com"
storage.regionstorage region"fra1"
storage.signatureVersionS3-compatible storage API signature version(2 or 4)"fra1"
storage.secretkey,storage.accesskeystorage access keys"changeme"
twilioTwilio SMS provider configs
gaTrackerKeyGoogle Analytics tracker key inserted into the frontend app
smtpSMTP configs used for sending platform emails
captchacaptcha configuration(Recaptcha orGeetest)
walletsconfigs for wallets seeded during the initial deployment of Peatio
parityParity cryptonode configuration
bitcoindBitcoind cryptonode configuration
litecoindLitecoind cryptonode configuration
terraform.credentialslocal path to a GCP service account JSON key"~/safe/opendax.json"
terraform.projectGCP project name"example-opendax"

utils.yml

The following table lists configurable parameters of theconfig/utils.yml file:

ParameterDescriptionDefault
imagesDocker image tags per component
supersetSuperset BI tool configs
arkeArke liquidity bot configs

Once you're done with the configuration, render the files usingrake render:config. You can easily apply your changes at any time by running this command.

Note: be sure to append all the subdomains based on app.domain to your/etc/hosts file if you're running OpenDax locally

Bringing up the stack

The OpenDAX stack can be brought up using two ways:

  1. Bootstrap all the components at once usingrake service:all[start]
  2. Start every component one-by-one usingrake service:*component*[start]

The components included in the stack are:

  • proxy -Traefik, a robust cloud-native edge router/reverse proxy written in Go
  • backend -Vault,MySQL,Redis andRabbitMQ grouped together
  • cryptonodes - cryptocurrency nodes such asparity[Optional]
  • daemons - Peatio and Ranger daemons[Optional]
  • setup - setup hooks for Peatio and Barong to run before the application starts (DB migration etc.)
  • app - Peatio is thecrypto exchange software,Barong and theAmbassador API gateway
  • frontend - the frontend application located atvendor/frontend
  • tower - the Tower admin panel application located atvendor/tower
  • monitoring -cAdvisor andNode Exporter monitoring tools[Optional]

For example, to start thebackend services, you'll simply need to runrake service:backend[start]

Note: all the components marked as [Optional] need to be installed usingrake service:*component*[start] explicitly

Go ahead and try your own OpenDAX exchange deployment!

Stopping and restarting components

Any component from the stack can be easily stopped or restarted usingrake service:*component*[stop] andrake service:*component*[restart].

For example,rake service:frontend[stop] would stop the frontend application container andrake service:proxy[restart] would completely restart the reverse proxy container.

Managing component deployments

Each component has a config file (ex.config/frontend/tower.js) and a compose file (ex.compose/frontend.yaml).

All config files are mounted into respective component container, except fromconfig/app.yml - this file contains all the neccessary configuration of opendax deployment

Compose files contain component images, environment configuration etc.

These files get rendered from their respective templates that are located undertemplates directory.

How to update component image?

Modifyconfig/app.yml with correct image and runrake service:allThis will rerender all the files fromtemplates directory and restart all the running services.

Alternitavely you can update the following files:

  • config/app.yml
  • templates/compose/*component*.yml
  • compose/*component*.ymlAnd runrake service:component[start]

How to update component config?

Modifyconfig/*component*/*config* and runrake service:component[start],if you want the changes to be persistent, you also need to updatetemplates/config/*components*/*config*

Render compose file

# Delete all generated filesgit clean -fdx# Re-generate config from config/app.yml valuesrake render:config# Restart the container you need to reload configdocker-compose up frontend -Vd

Clone the vendors and start

source ./bin/set-env.shrake vendor:clonedocker-compose -f compose/vendor.yaml up -d

Vault management

Opendax usesVault Policies to restrict components' access to sensitive data. Each component has its own Vault token which allows granular access only to the data required.

OpenDAX has 2 rake tasks for Vault management:

rake vault:setup# Initial Vault configuration (root token generation, unseal, endpoints configuration)rake vault:load_policies# Components' Vault token generation

Troubleshooting

Vault is sealed

In case of such error:

  1. Runrake vault:setup
  2. Restart the component

Make sure you're not using an existing Docker volume for Vault(i.e. one left after a different Vault container deployment):

docker volume ls| grep vault

In case there are existing volumes, remove the running Vault container viadocker rm -f *id* and rundocker volume rm -f *volume name*Afterward, rundocker-compose up -Vd vault and re-runrake vault:setup.

Vault permission denied

Usually, this means that one of your Vault tokens has expired.

To fix the issue:

  1. Runrake vault:load_policies

  2. Runrake render:config

  3. Restart Vault dependant components:

    docker-compose up -Vd barong peatio cron_job deposit deposit_coin_address withdraw_coin upstream# If you are using Finexdocker-compose up -Vd finex-engine# If you are using Peatio Matching Enginedocker-compose up -Vd matching order_processor trade_executor

Terraform Infrastructure as Code Provisioning

You can easily deploy OpenDAX from scratch on Google Cloud Platform usingTerraform!

To do this, just follow these simple steps:

  • Fillapp.yml with correct values
  • Runrake terraform:apply
  • Access your VM from the GCP Cloud Console

To destroy the provisioned infrastructure, just runrake terraform:destroy

Installer tool

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/openware/opendax/master/bin/install)"

Using an OpenDAX deployment for local frontend development

If you'd like to use a real API from an existing OpenDAX deployment when developing frontend components(e.g.baseapp), modifytemplates/config/gateway/envoy.yaml.erb file the following way:

  1. Setallow_origin as"*"

  2. Configure all the needed HTTP methods inallow_methods. For example:allow_methods: "PUT, GET, POST, DELETE, PATCH"

  3. Add'total, page, x-csrf-token' toallow_headers value

  4. Configureexpose_headers in a similar wayexpose_headers: "total, page, x-csrf-token"

  5. Addallow_credentials: true to your CORS configuration

After completing these steps, you should have the following config:

cors:  allow_origin:  - "*"  allow_methods: "PUT, GET, POST, DELETE, PATCH"  allow_headers: "content-type, x-grpc-web, total, page, x-csrf-token"  expose_headers: "total, page, x-csrf-token"  allow_credentials: true

Afterwards, apply the config onto your deployment:

rake render:configdocker-compose up -Vd gateway

Happy trading with OpenDAX!

If you have any comments, feedback and suggestions, we are happy to hear from you here at GitHub or here:crypto exchange software

2.6 Migration guide

To migrate from 2.5 to 2.6, do the following:

  1. Pull 2-6-stable branchWhile rebasing, rename yourvault.token tovault.root_token inconfig/app.yml
  2. Runrake render:config
  3. Rundc up -Vd vault
  4. Runrake service:all

[8]ページ先頭

©2009-2025 Movatter.jp