项目作者: darchnetwork

项目描述 :
Decentralized Digital Market Place User Interface
高级语言: HTML
项目地址: git://github.com/darchnetwork/ddmp.git
创建时间: 2019-03-21T11:24:49Z
项目社区:https://github.com/darchnetwork/ddmp

开源协议:

下载


Wellcome to DDMP User Interface.

It is the most popular and original DDMP python script. The code is exceptionally portable and has been used successfully on a very broad range of ubuntu systems and hardware.

Contact

Gitter
GitHub Issues

Getting Started

The DDMP UI Documentation site hosts the DDMP homepage, which
has a Quick Start section.

Operating system Status
Ubuntu 16.04 TravisCI
  1. sudo apt-get update -y && sudo apt-get upgrade -y && sudo apt-get install vim -y && sudo apt-get install python-dev -y && sudo apt-get install libevent-dev -y && sudo apt-get install python-virtualenv -y && apt-get install git -y
  2. sudo apt-get install python3.7-dev

Install python3.7

  1. sudo apt-get install --reinstall language-pack-en -y
  2. export LC_ALL="en_US.UTF-8"
  3. export LC_CTYPE="en_US.UTF-8"
  4. sudo add-apt-repository ppa:deadsnakes/ppa
  5. sudo apt-get update
  6. sudo apt-get install python3.7
  7. sudo apt-get install python3-pip
  8. apt install python-pip
  9. pip install --upgrade virtualenv

Other configurations..

  1. cd opt
  2. virtualenv -p python3 venv
  3. cd venv
  4. . bin/activate
  5. git clone https://github.com/darchnetwork/ddmp.git
  6. cd ddmp
  7. pip install -r requirements.txt
  8. pipenv install requests

EDCSA Eliptic Curve algorithm and generate pubkey from private key

  1. sudo apt-get install build-essential python3-dev
  2. pip install pycryptodomex
  3. python3 -m Cryptodome.SelfTest
  4. pip install ethereum
  5. pip install ecdsa
  1. import codecs, ecdsa
  2. from Crypto.Hash import keccak
  3. private_key_bytes = codecs.decode('F37E27F4C7CA36E3CCE9042F42C6EA32FA231673E2FA90D92D348276460BE488', 'hex')
  4. key = ecdsa.SigningKey.from_string(private_key_bytes,curve=ecdsa.SECP256k1).verifying_key
  5. key_bytes = key.to_string()
  6. key_hex = codecs.encode(key_bytes, 'hex')
  7. public_key_bytes = codecs.decode(key_hex, 'hex')
  8. keccak_hash = keccak.new(digest_bits=256)
  9. keccak_hash.update(public_key_bytes)
  10. keccak_digest = keccak_hash.hexdigest()
  11. # Take the last 20 bytes
  12. wallet_len = 40
  13. wallet = '0x' + keccak_digest[-wallet_len:]

deployment

  1. sudo apt-get update
  2. sudo apt-get install python3-pip python3-dev libpq-dev postgresql postgresql-contrib nginx
  3. sudo ufw allow 8000
  4. gunicorn --bind 0.0.0.0:8000 ddmp.wsgi
  5. sudo nano /etc/systemd/system/gunicorn.service

if do not have opt/venv/run folder please create RUN folder. with mkdir cmd.

/etc/systemd/system/gunicorn.service

  1. [Unit]
  2. Description=hello
  3. After=network.target
  4. [Service]
  5. User=root
  6. Group=root
  7. WorkingDirectory=/opt/venv/ddmp
  8. ExecStart=/opt/venv/bin/gunicorn --access-logfile - --workers 3 --bind unix:/opt/venv/run/ddmp.sock ddmp.wsgi:application
  9. [Install]
  10. WantedBy=multi-user.target

Useful Gunicorn commands

  1. sudo systemctl start gunicorn
  2. sudo systemctl enable gunicorn
  3. sudo systemctl status gunicorn
  4. sudo systemctl daemon-reload
  5. sudo systemctl restart gunicorn

Create csr for https.

  1. openssl req -new -newkey rsa:2048 -nodes -keyout anonymsale.com.key -out anonymsale.com.csr

Nginx config.

  1. upstream hello_app_server {
  2. # fail_timeout=0 means we always retry an upstream even if it failed
  3. # to return a good HTTP response (in case the Unicorn master nukes a
  4. # single worker for timing out).
  5. server unix:/opt/venv/run/darchweb.sock fail_timeout=0;
  6. }
  7. server {
  8. listen 80;
  9. server_name 167.99.70.31;
  10. client_max_body_size 4G;
  11. access_log /opt/venv/logs/nginx-access.log;
  12. error_log /opt/venv/logs/nginx-error.log;
  13. location /static/ {
  14. alias /opt/venv/ddmp/ddmp/templates/static/;
  15. }
  16. location /media/ {
  17. alias /opt/venv/ddmp/ddmp/templates/media_cdn/;
  18. }
  19. location / {
  20. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  21. proxy_set_header Host $http_host;
  22. proxy_redirect off;
  23. if (!-f $request_filename) {
  24. proxy_pass http://hello_app_server;
  25. break;
  26. }
  27. }
  28. # Error pages
  29. error_page 500 502 503 504 /500.html;
  30. location = /500.html {
  31. root /opt/venv/ddmp/ddmp/templates/static/;
  32. }
  33. }