Skip to content

Commit

Permalink
Update to electrum 3.0.5
Browse files Browse the repository at this point in the history
- Use docker-compose to simplify commands and use as a guide
- Put username and password for the RPC as it is now required
  • Loading branch information
ramontayag committed Jan 19, 2018
1 parent 0d7982a commit 2aba51e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 18 deletions.
10 changes: 4 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
FROM python:2.7-slim
FROM python:3.6-slim
MAINTAINER Vladimir Osintsev <[email protected]>

ENV ELECTRUM_VERSION 2.7.12
RUN apt-get update -y && apt-get install -y python-qt4 socat telnet netcat curl

ENV ELECTRUM_VERSION 3.0.5
ENV ELECTRUM_USER electrum-user
ENV ELECTRUM_HOME /home/$ELECTRUM_USER

RUN useradd -m $ELECTRUM_USER

RUN apt-get update -y && apt-get install -y python-qt4 socat telnet netcat curl

RUN pip install \
https://download.electrum.org/${ELECTRUM_VERSION}/Electrum-${ELECTRUM_VERSION}.tar.gz

Expand All @@ -23,7 +23,5 @@ VOLUME /data

EXPOSE 7000

RUN electrum setconfig rpcport 7777

ADD run.sh /
ENTRYPOINT /run.sh
21 changes: 9 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,29 @@ Star this project on Docker Hub :star2: https://hub.docker.com/r/osminogin/elect

### Ports

* ``7000`` - JSON-RPC port.
* `7000` - JSON-RPC port.

### Volumes

* ``/data`` - usually on host it has a path ``/home/user/.electrum``.
* `/data` - usually on host it has a path ``/home/user/.electrum``.


## Running

Take a look at `docker-compose.yml` to see how this is setup. When running in production, you can use this as a guide.

```bash
docker run --rm -p 127.0.0.1:7000:7000 --name electrum osminogin/electrum-daemon
docker-compose up
docker-compose exec electrum electrum daemon status
docker-compose exec electrum electrum create
docker-compose exec electrum electrum daemon load_wallet
curl --data-binary '{"id":"1","method":"listaddresses"}' http://electrum:electrumz@localhost:7000
```

:exclamation:**Warning**:exclamation:

Always link electrum daemon to containers or bind to localhost directly and not expose 7000 port for security reasons.


## Usage

```bash
docker exec -it electrum electrum daemon status
docker exec -it electrum electrum create
curl --data-binary '{"id":"1","method":"listaddresses"}' http://localhost:7000
```

## API

* [Electrum protocol specs](http://docs.electrum.org/en/latest/protocol.html)
Expand Down
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3'
services:
electrum:
build: .
ports:
- "7000:7000"
command: run.sh
environment:
ELECTRUM_RPCUSER: electrum
ELECTRUM_RPCPASSWORD: electrumz
2 changes: 2 additions & 0 deletions env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ELECTRUM_RPCUSER: electrum
ELECTRUM_RPCPASSWORD: electrumz
5 changes: 5 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ set -x
# graceful shutdown
trap 'echo 123123; pkill -TERM -P1; electrum daemon stop; exit 0' SIGTERM

# Set config
electrum setconfig rpcuser ${ELECTRUM_RPCUSER}
electrum setconfig rpcpassword ${ELECTRUM_RPCPASSWORD}
electrum setconfig rpcport 7777

# run application
electrum daemon start && socat -v TCP-LISTEN:7000,fork TCP:127.0.0.1:7777

Expand Down

0 comments on commit 2aba51e

Please sign in to comment.