diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2bd624b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build_* diff --git a/README.md b/README.md index cf24d4f..376d578 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # DAppnodePackage-raiden + [![DAppNodeStore Available](https://img.shields.io/badge/DAppNodeStore-Available-brightgreen.svg)](http://my.admin.dnp.dappnode.eth/#/installer/raiden.dnp.dappnode.eth) This is a package to deploy a [Raiden node](https://raiden.network/) in a DAppNode. @@ -9,130 +10,20 @@ See the [documentation](https://raiden-network.readthedocs.io/en/stable/index.ht # Build prerequisites -- git - - Install [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) commandline tool. - - docker - Install [docker](https://docs.docker.com/engine/installation). The community edition (docker-ce) will work. In Linux make sure you grant permissions to the current user to use docker by adding current user to docker group, `sudo usermod -aG docker $USER`. Once you update the users group, exit from the current terminal and open a new one to make effect. + Install [docker](https://docs.docker.com/engine/installation). The community edition (docker-ce) will work. In Linux make sure you grant permissions to the current user to use docker by adding current user to docker group, `sudo usermod -aG docker $USER`. Once you update the users group, exit from the current terminal and open a new one to make effect. - docker-compose - Install [docker-compose](https://docs.docker.com/compose/install) - -**Note**: Make sure you can run `git`, `docker ps`, `docker-compose` without any issue and without sudo command. + Install [docker-compose](https://docs.docker.com/compose/install) +**Note**: Make sure you can run `git`, `docker ps`, `docker-compose` without any issue and without sudo command. ## Building `docker-compose build` -## Running - - ## License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details - -## Note - -This is early stage software - -# Raiden mainet keystore uploading doc - - -Raiden is available in DAppNode in mainet and the different testnets, but in mainet you have to upload your own keystore. - -## Running Raiden in mainet - -In mainet you will have to install the mainet package and take into account that your Ethereum node should be running with this flags. - - ```--jsonrpc-apis=eth,net,web3,parity``` and the flag ```--no-ancient-blocks``` should not be activated. - - ![](https://i.imgur.com/X1bJCJF.png) - -If you do not have a keystore file, you can create a new wallet in My Ether Wallet or MyCrypto, and then fund it with a bit of ETH / WETH (only token supported in mainet at the moment). - -Please be aware that the online creation of wallets via a keystore file is not such a good security practice. This can be mitigated if you download the MyCrypto local app and create the wallet offline. - -Do not leave significant value in wallets created through this method. - - -## Keystore uploading - -Go to packages and enter the Raiden package - -![](https://i.imgur.com/p0IVsPn.png) - - -* In the "File manager" tab upload your keystore file (please note that in the current version, WETH is the only token supported) - -![](https://i.imgur.com/29GFRHk.png) - -No need to select any path in this case, you can leave this field as it is, and the keystore file will be uploaded in the correct path once you hit the "Upload" button. - -* In "Environment Variables", fill the options with: - - * The password of the uploaded keystore - * Its address - - -Here you have an example screenshot! - -![](https://i.imgur.com/DPbu66n.png) - - -If all the steps have been performed correctly you will see these logs within the Raiden package (at the bottom of the screen) - -![](https://i.imgur.com/2SQ802h.png) - - -Now you can access the [Raiden UI](http://raiden.dappnode) and start doing instant payments. - -## Backup of your account - -When you install the Raiden mainet package the keystore is stored in your DAppNNode. - -If you want to have a backup of that account follow these steps. - -* Enter the Raiden Package in the packages tab and scroll down to File Manager -* Write "keystore" in the "Download from DNP" field -* Hit download - -![](https://i.imgur.com/PoALyud.png) - - -A compressed file called "keystore" will be dowloaded containing both the keystore file and the password (the latter as a hidden file) - -## Using Raiden with different accounts - -If you have different keystores with WETH and you want to switch the account, you can do so by uploading your keystore file to the Raiden DAppNode Package (DNP) and by writing the address and password of your keystore in the environment variables field. - -* Go to File manager -* Hit browse and select your keystore file -* Click upload without need to write anything in the path field - -![](https://i.imgur.com/2NK4EV2.png) - - -Your keystore is now uploaded. Now we need to tell the package that you want to use that keystore - -* Go to Environment Variables -* Type the password of your newly uploaded keystore (address is not necessary, it will be automatically detected) -* Hit update environment variables - -![](https://i.imgur.com/sjKiw1s.png) - - -You are done! - -When you go to the [Raiden ADMIN UI](http://raiden.dappnode) you will see your custom account. - -As long as you have the keystore uploaded to the package you can use any account just by typing its password in the Environment variables field of the package and hitting Update, just the password, you do not need to write the address, the account will be recognized and you will be using that account when accessing the UI. - -Now you are ready to enjoy fast, cheap, and scalable token transfers for Ethereum. - - - - diff --git a/avatar-raiden.png b/avatar-raiden.png new file mode 100644 index 0000000..4c90cc7 Binary files /dev/null and b/avatar-raiden.png differ diff --git a/build/Dockerfile b/build/Dockerfile index 6f29644..e510b89 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,35 +1,32 @@ -FROM alpine:latest +FROM python:3.6-alpine -ENV RAIDEN_VERSION 0.100.3 ENV LANG en_US.UTF-8 -ENV RAIDEN_ACCEPT_DISCLAIMER=True -ENV RAIDEN_ENVIRONMENT_TYPE=production -ENV RAIDEN_API_ADDRESS=0.0.0.0:80 -ENV RAIDEN_ETH_RPC_ENDPOINT=http://my.ethchain.dnp.dappnode.eth:8545 -RUN apk update && apk add --no-cache wget expect +RUN apk update && apk add --no-cache wget jq gettext +ARG RAIDEN_VERSION +RUN echo "Downloading Raiden version: $RAIDEN_VERSION" RUN wget https://github.com/raiden-network/raiden/releases/download/v${RAIDEN_VERSION}/raiden-v${RAIDEN_VERSION}-linux-x86_64.tar.gz \ -qO- | tar -C /usr/bin -xzvf - RUN mv /usr/bin/raiden-v${RAIDEN_VERSION}-linux-x86_64 /usr/bin/raiden -ARG ALPINE_GLIBC_PACKAGE_VERSION="2.29-r0" +ARG ALPINE_GLIBC_PACKAGE_VERSION="2.31-r0" RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" && \ ALPINE_GLIBC_BASE_PACKAGE_FILENAME="glibc-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \ ALPINE_GLIBC_BIN_PACKAGE_FILENAME="glibc-bin-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \ ALPINE_GLIBC_I18N_PACKAGE_FILENAME="glibc-i18n-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \ apk add --no-cache --virtual=.build-dependencies wget ca-certificates && \ wget \ - "https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub" \ - -O "/etc/apk/keys/sgerrand.rsa.pub" && \ + "https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub" \ + -O "/etc/apk/keys/sgerrand.rsa.pub" && \ wget \ - "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \ - "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \ - "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && \ + "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \ + "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \ + "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && \ apk add --no-cache \ - "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \ - "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \ - "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && \ + "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \ + "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \ + "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && \ \ rm "/etc/apk/keys/sgerrand.rsa.pub" && \ /usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 "$LANG" || true && \ @@ -40,12 +37,19 @@ RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases rm "/root/.wget-hsts" && \ apk del .build-dependencies && \ rm \ - "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \ - "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \ - "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" + "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \ + "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \ + "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" RUN mkdir -p /home/.raiden WORKDIR /root/.raiden +RUN apk add --no-cache build-base python2-dev \ + && pip install pysha3 \ + && apk del build-base python2-dev + COPY init.sh /usr/bin +COPY eip55-checksum /usr/bin +COPY config.toml.template . + CMD ["init.sh"] diff --git a/build/config.toml.template b/build/config.toml.template new file mode 100644 index 0000000..53c6d33 --- /dev/null +++ b/build/config.toml.template @@ -0,0 +1,11 @@ +environment-type = "production" +keystore-path = "/root/.raiden/" +address = "${RAIDEN_ADDRESS}" +network-id = "${RAIDEN_NETWORK_ID}" +accept-disclaimer = true +eth-rpc-endpoint = "${RAIDEN_RPC_ENDPOINT}" +password-file = "/root/.raiden/.password" +routing-mode = "pfs" +enable-monitoring = true +api-address = "0.0.0.0:80" + diff --git a/build/eip55-checksum b/build/eip55-checksum new file mode 100755 index 0000000..215b201 --- /dev/null +++ b/build/eip55-checksum @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +import sha3 +import sys + +def checksum_encode(addr_str): # Takes a hex (string) address as input + keccak = sha3.keccak_256() + out = '' + addr = addr_str.lower().replace('0x', '') + keccak.update(addr.encode('ascii')) + hash_addr = keccak.hexdigest() + for i, c in enumerate(addr): + if int(hash_addr[i], 16) >= 8: + out += c.upper() + else: + out += c + return '0x' + out + +data = sys.stdin.read() +print(checksum_encode(data)) + + + diff --git a/build/init.sh b/build/init.sh index 2bd1914..228469e 100755 --- a/build/init.sh +++ b/build/init.sh @@ -1,19 +1,26 @@ #!/bin/sh set -e -# Check if password is set, and at least one file has been uploaded -if [ -n "${RAIDEN_ADDRESS}" ] && [ -n "${RAIDEN_KEYSTORE_PASSWORD}" ] && [ "$(find . -maxdepth 1 -type f | wc -l)" -gt 0 ]; then - echo "${RAIDEN_KEYSTORE_PASSWORD}" > .password - raiden --keystore-path . --accept-disclaimer --password-file .password "${EXTRA_OPTS}" -else - echo - echo "########################################################" - echo "## Raiden not configured to start! ##" - echo "## Please follow the following steps: ##" - echo "## 1: Upload a keystore file to /root/.raiden ##" - echo "## 2: Set the RAIDEN_ADDRESS of the keystore ##" - echo "## 2: Set the RAIDEN_KEYSTORE_PASSWORD to open it ##" - echo "## 3: Restart the package ##" - echo "########################################################" +function sleep_forever() { while true; do sleep 5; done +} +KEYSTORE_PATH="/root/.raiden" +KEYSTORE_FILE="${KEYSTORE_PATH}/keystore.json" + +if [ ! -f "${KEYSTORE_FILE}" ]; then + echo "Keystore file not present!" + sleep_forever fi + +# Convert keystore address to EIP-55 format +RAW_ADDRESS=$(cat ${KEYSTORE_FILE} | jq -r .address) +RAIDEN_ADDRESS=$(echo -n ${RAW_ADDRESS} | eip55-checksum) +export RAIDEN_ADDRESS + +echo "${RAIDEN_KEYSTORE_PASSWORD}" >/root/.raiden/.password + +# Generate config file from template +envsubst config.toml + +echo "Starting Raiden node for: ${RAIDEN_ADDRESS}" +exec raiden --config-file ./config.toml diff --git a/dappnode_package.json b/dappnode_package.json index e907972..c693f18 100644 --- a/dappnode_package.json +++ b/dappnode_package.json @@ -1,34 +1,37 @@ { "name": "raiden.dnp.dappnode.eth", - "version": "0.0.1", - "description": "The Raiden Network is an off-chain scaling solution, enabling near-instant, low-fee and scalable payments.", + "version": "0.0.2", + "upstreamVersion": "1.0.0", + "shortDescription": "Fast, cheap, scalable token transfers for Ethereum", + "description": "The Raiden Network is an off-chain scaling solution, enabling near-instant, low-fee, and scalable payments. It’s complementary to the Ethereum blockchain and works with any ERC20 compatible token. \n\n\n **Getting started** \n\n Once you have installed the Raiden DAppNode Package you **must** upload your own keystore. If you need one, [use the Raiden Wizard](https://docs.raiden.network/installation/quick-start/download-and-run-the-raiden-wizard) and provide http://fullnode.dappnode:8545 as your Ethereum URL if you have a node running.", "avatar": "/ipfs/QmaqgLyZXpETXYzhWcebNJnh6vPs4WqiCJbZY3EY1fXqer", "type": "service", - "image": { - "path": "", - "hash": "", - "size": "", - "restart": "always", - "ports": [], - "volumes": [ - "data:/root/.raiden" - ], - "environment": [ - "RAIDEN_KEYSTORE_PASSWORD=", - "RAIDEN_ADDRESS=", - "EXTRA_OPTS=--disable-debug-logfile" - ], - "keywords": [ - "Raiden", - "Ethereum" - ] + "backup": [ + { + "name": "data", + "path": "/root/.raiden" + } + ], + "warnings": {}, + "style": { + "featuredBackground": "linear-gradient(67deg, #000000, #2f3c3e)", + "featuredColor": "white", + "featuredAvatarFilter": "invert(1)" }, "author": "DAppNode Association (https://github.com/dappnode)", - "contributors": [ - "Abel Boldú (@vdo)" + "contributors": ["Abel Boldú (@vdo)"], + "categories": ["Payment channels"], + "keywords": [ + "Raiden", + "Raiden Network", + "Payment Channels", + "Ethereum", + "Blockchain" ], - "homepage": { - "homepage": "https://github.com/dappnode/DAppNodePackage-raiden#readme" + "links": { + "homepage": "https://raiden.network", + "ui": "http://raiden.dappnode", + "api": "http://raiden.dappnode:5001/api/" }, "repository": { "type": "git", @@ -40,6 +43,5 @@ "disclaimer": { "message": "This software is experimental, presented 'as is' and inherently carries risks. By installing it, you acknowledge that DAppNode Association has done its best to mitigate these risks and accept to waive any liability or responsibility for DAppNode in case of any shortage, discrepancy, damage, loss or destruction of any digital asset managed within this DAppNode package.\n\nThis package stores private keys, which will be stored in your DAppNode. Neither DAppNode Association nor the developers of this software can have access to your private key, nor help you recover it if you lose it. \n\nYou are solely responsible for keeping your private keys and password safe and to perform secure backups, as well as to restrict access to your computer and other equipment. To the extent permitted by applicable law, you agree to be responsible for all activities that have been conducted from your account. You must take all necessary steps to ensure that your private key, password, and recovery phrase remain confidential and secured. \n\nThis is an Alpha version of experimental open source software released as a test version under an MIT license and may contain errors and/or bugs. No guarantee or representations whatsoever is made regarding its suitability (or its use) for any purpose or regarding its compliance with any applicable laws and regulations. Use of the software is at your own risk and discretion and by using the software you acknowledge that you have read this disclaimer, understand its contents, assume all risk related thereto and hereby release, waive, discharge and covenant not to sue Brainbot Labs Establishment or any officers, employees or affiliates from and for any direct or indirect liability resulting from the use of the software as permissible by applicable laws and regulations.\n\nPrivacy Warning: Please be aware, that by using the Raiden Client, \namong others, your Ethereum address, channels, channel deposits, settlements and the Ethereum address of your channel counterparty will be stored on the Ethereum chain, i.e. on servers of Ethereum node operators and ergo are to a certain extent publicly available. The same might also be stored on systems of parties running Raiden nodes connected to the same token network. Data present in the Ethereum chain is very unlikely to be able to be changed, removed or deleted from the public arena.\n\nAlso be aware, that data on individual Raiden token transfers will be made available via the Matrix protocol to the recipient, intermediating nodes of a specific transfer as well as to the Matrix server operators." }, - "license": "MIT License", - "dependencies": {} + "license": "MIT License" } diff --git a/docker-compose.yml b/docker-compose.yml index 2cd8417..bbb3e24 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,18 @@ version: '3.4' services: - raiden.dnp.dappnode.eth: - image: 'raiden.dnp.dappnode.eth:0.0.1' - build: ./build + raiden.dnp.dappnode.eth: + image: 'raiden.dnp.dappnode.eth:0.0.2' + build: + context: ./build + dockerfile: Dockerfile + args: + - RAIDEN_VERSION=1.0.0 + volumes: + - 'data:/root/.raiden' + restart: always + environment: + - RAIDEN_KEYSTORE_PASSWORD= + - RAIDEN_NETWORK_ID=mainnet + - 'RAIDEN_RPC_ENDPOINT=http://fullnode.dappnode:8545' +volumes: + data: {} diff --git a/logo.jpg b/logo.jpg deleted file mode 100644 index 5c624e1..0000000 Binary files a/logo.jpg and /dev/null differ diff --git a/releases.json b/releases.json new file mode 100644 index 0000000..f370079 --- /dev/null +++ b/releases.json @@ -0,0 +1,9 @@ +{ + "0.0.2": { + "hash": "/ipfs/QmZjowEte2SHirQnJREn94uFXV5YhCx8kvhoCSkCYgC2pR", + "type": "directory", + "uploadedTo": { + "dappnode": "Wed, 03 Jun 2020 10:43:55 GMT" + } + } +} \ No newline at end of file diff --git a/setup-target.json b/setup-target.json new file mode 100644 index 0000000..757450a --- /dev/null +++ b/setup-target.json @@ -0,0 +1,18 @@ +{ + "keystore": { + "type": "fileUpload", + "path": "/root/.raiden/keystore.json" + }, + "password": { + "type": "environment", + "name": "RAIDEN_KEYSTORE_PASSWORD" + }, + "rpc-endpoint": { + "type": "environment", + "name": "RAIDEN_RPC_ENDPOINT" + }, + "network-id": { + "type": "environment", + "name": "RAIDEN_NETWORK_ID" + } +} diff --git a/setup-ui.json b/setup-ui.json new file mode 100644 index 0000000..a605a11 --- /dev/null +++ b/setup-ui.json @@ -0,0 +1,6 @@ +{ + "ui:order": ["keystore", "*"], + "password": { + "ui:widget": "password" + } +} diff --git a/setup.schema.json b/setup.schema.json new file mode 100644 index 0000000..f50a7ab --- /dev/null +++ b/setup.schema.json @@ -0,0 +1,30 @@ +{ + "description": "# DAppNode Raiden Wizard\n\nTo start this package you need to provide an Ethereum keystore file.\n\n[Use the Raiden Wizard](https://docs.raiden.network/installation/quick-start/download-and-run-the-raiden-wizard) to generate a JSON file and fund it!", + "type": "object", + "properties": { + "keystore": { + "type": "string", + "format": "data-url", + "title": "Raiden Keystore file", + "description": "Your Keystore/JSON file containing the key that you want to use for this node" + }, + "password": { + "type": "string", + "title": "Password", + "description": "Password to unlock the keystore" + }, + "rpc-endpoint": { + "type": "string", + "title": "RPC Endpoint", + "description": "Raiden will use your local Ethereum node by default." + }, + "network-id": { + "type": "string", + "title": "RPC Endpoint", + "description": "Raiden will use your local Ethereum node by default.", + "default": "mainnet", + "enum": ["mainnet", "goerli", "ropsten", "rinkeby"] + } + }, + "required": ["keystore", "password"] +}