Skip to content

A full stack for Ravencoin blockchain-based applications

License

Notifications You must be signed in to change notification settings

underdarkskies/ravencore

 
 

Repository files navigation

Ravencore

This is Under's fork of Bitpay's Bitcore that uses Ravencoin 2.5.1 It has a limited segwit support.

It is HIGHLY recommended to use https://github.com/underdarkskies/ravencore-deb to build and deploy packages for production use.


Getting Started

Deploying Ravencore full-stack manually:

sudo apt-get update
sudo apt-get -y install curl git python3 make build-essential libzmq3-dev python2.7
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

#restart your shell/os

nvm install 10.5.0
nvm use 10.5.0

#install mongodb
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo systemctl enable mongod.service

#install ravencore
sudo ln -s /usr/bin/python2.7 /usr/bin/python
git clone https://github.com/underdarkskies/ravencore.git
cd ravencore && git checkout lightweight
npm install -g --production

Copy the following into a file named ravencore-node.json and place it in ~/.ravencore/ (be sure to customize username values(without angle brackets<>) and/or ports)

{
  "network": "livenet",
  "port": 3001,
  "services": [
    "ravend",
    "web",
    "insight-api",
    "insight-ui"
  ],
  "allowedOriginRegexp": "^https://<yourdomain>\\.<yourTLD>$",
  "messageLog": "",
  "servicesConfig": {
    "web": {
      "disablePolling": true,
      "enableSocketRPC": false
    },
    "insight-ui": {
      "routePrefix": "",
      "apiPrefix": "api"
    },
    "insight-api": {
      "routePrefix": "api",
      "coinTicker" : "https://api.coinmarketcap.com/v1/ticker/ravencoin/?convert=USD",
      "coinShort": "RVN",
	    "db": {
		  "host": "127.0.0.1",
		  "port": "27017",
		  "database": "raven-api-livenet",
		  "user": "",
		  "password": ""
	  }
    },
    "ravend": {
      "sendTxLog": "/home/<yourusername>/.ravencore/pushtx.log",
      "spawn": {
        "datadir": "/home/<yourusername>/.ravencore/data",
        "exec": "/home/<yourusername>/ravencore/node_modules/ravencore-node/bin/ravend",
        "rpcqueue": 1000,
        "rpcport": 8766,
        "zmqpubrawtx": "tcp://127.0.0.1:28332",
        "zmqpubhashblock": "tcp://127.0.0.1:28332"
      }
    }
  }
}

Quick note on allowing socket.io from other services.

  • If you would like to have a seperate services be able to query your api with live updates, remove the "allowedOriginRegexp": setting and change "disablePolling": to false.
  • "enableSocketRPC" should remain false unless you can control who is connecting to your socket.io service.
  • The allowed OriginRegexp does not follow standard regex rules. If you have a subdomain, the format would be(without angle brackets<>):
"allowedOriginRegexp": "^https://<yoursubdomain>\\.<yourdomain>\\.<yourTLD>$",

To setup unique mongo credentials:

mongo
>use raven-api-livenet
>db.createUser( { user: "test", pwd: "test1234", roles: [ "readWrite" ] } )
>exit

(then add these unique credentials to your ravencore-node.json)

Copy the following into a file named raven.conf and place it in ~/.ravencore/data

server=1
whitelist=127.0.0.1
txindex=1
addressindex=1
timestampindex=1
spentindex=1
zmqpubrawtx=tcp://127.0.0.1:28332
zmqpubhashblock=tcp://127.0.0.1:28332
rpcport=8766
rpcallowip=127.0.0.1
rpcuser=ravencoin
rpcpassword=local321 #change to something unique
uacomment=ravencore-sl

mempoolexpiry=72 # Default 336
rpcworkqueue=1100
maxmempool=2000
dbcache=1000
maxtxfee=1.0
dbmaxfilesize=64

Launch your copy of ravencore:

ravencored

You can then view the Ravencoin block explorer at the location: http://localhost:3001

Create an Nginx proxy to forward port 80 and 443(with a snakeoil ssl cert)traffic:

IMPORTANT: this "nginx-ravencore" config is not meant for production use see this guide here for production usage

sudo apt-get install -y nginx ssl-cert

copy the following into a file named "nginx-ravencore" and place it in /etc/nginx/sites-available/

server {
    listen 80;
    listen 443 ssl;
        
    include snippets/snakeoil.conf;
    root /home/ravencore/www;
    access_log /var/log/nginx/ravencore-access.log;
    error_log /var/log/nginx/ravencore-error.log;
    location / {
        proxy_pass http://127.0.0.1:3001;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_connect_timeout 10;
        proxy_send_timeout 10;
        proxy_read_timeout 100; # 100s is timeout of Cloudflare
        send_timeout 10;
    }
    location /robots.txt {
       add_header Content-Type text/plain;
       return 200 "User-agent: *\nallow: /\n";
    }
    location /ravencore-hostname.txt {
        alias /var/www/html/ravencore-hostname.txt;
    }
}

Then enable your site:

sudo ln -s /etc/nginx/sites-available/nginx-ravencore /etc/nginx/sites-enabled
sudo rm -f /etc/nginx/sites-enabled/default /etc/nginx/sites-available/default
sudo mkdir /etc/systemd/system/nginx.service.d
sudo printf "[Service]\nExecStartPost=/bin/sleep 0.1\n" | sudo tee /etc/systemd/system/nginx.service.d/override.conf
sudo systemctl daemon-reload
sudo systemctl restart nginx

Upgrading Ravencore full-stack manually:

  • This will leave the local blockchain copy intact: Shutdown the ravencored application first, and backup your unique raven.conf and ravencore-node.json
cd ~/
rm -rf .npm .node-gyp ravencore
rm .ravencore/data/raven.conf .ravencore/ravencore-node.json

#reboot

git clone https://github.com/underdarkskies/ravencore.git
cd ravencore && git checkout lightweight
npm install -g --production

(recreate your unique raven.conf and ravencore-node.json)

  • This will redownload a new blockchain copy: (Some updates may require you to reindex the blockchain data. If this is the case, redownloading the blockchain only takes 20 minutes) Shutdown the ravencored application first, and backup your unique raven.conf and ravencore-node.json
cd ~/
rm -rf .npm .node-gyp ravencore
rm -rf .ravencore

#reboot

git clone https://github.com/underdarkskies/ravencore.git
cd ravencore && git checkout lightweight
npm install -g --production

(recreate your unique raven.conf and ravencore-node.json)

Undeploying Ravencore full-stack manually:

nvm deactivate
nvm uninstall 10.5.0
rm -rf .npm .node-gyp ravencore
rm .ravencore/data/raven.conf .ravencore/ravencore-node.json
mongo
>use raven-api-livenet
>db.dropDatabase()
>exit

Applications

  • Node - A full node with extended capabilities using Ravencoin Core
  • Insight API - A blockchain explorer HTTP API
  • Insight UI - A blockchain explorer web user interface
  • (to-do) Wallet Service - A multisig HD service for wallets
  • (to-do) Wallet Client - A client for the wallet service
  • (to-do) CLI Wallet - A command-line based wallet client
  • (to-do) Angular Wallet Client - An Angular based wallet client
  • (to-do) Copay - An easy-to-use, multiplatform, multisignature, secure ravencoin wallet

Libraries

  • Lib - All of the core Ravencoin primatives including transactions, private key management and others
  • (to-do) Payment Protocol - A protocol for communication between a merchant and customer
  • P2P - The peer-to-peer networking protocol
  • (to-do) Mnemonic - Implements mnemonic code for generating deterministic keys
  • (to-do) Channel - Micropayment channels for rapidly adjusting ravencoin transactions
  • Message - Ravencoin message verification and signing
  • (to-do) ECIES - Uses ECIES symmetric key negotiation from public keys to encrypt arbitrarily long data streams.

Security

We're using Ravencore in production, but please use common sense when doing anything related to finances! We take no responsibility for your implementation decisions.

Contributing

Please send pull requests for bug fixes, code optimization, and ideas for improvement. For more information on how to contribute, please refer to our CONTRIBUTING file.

To verify signatures, use the following PGP keys:

License

Code released under the MIT license.

About

A full stack for Ravencoin blockchain-based applications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%