Documentation
Search

Emercoin Docker

Docker compose image for Emercoin core

Why is all this necessary?

Docker allows you to create an isolated container with an Emercoin wallet inside and a separate storage (volume: blockhain_data) for the blockchain. This makes it cross-platform (you can run it on any OS where you can install Docker), the ability to update versions of the Emercoin wallet in one click. Use the wallet functionality in your projects through the RPC JSON interface.

At the moment there are two versions:

  • Core Fast Start - For those who do not want to wait long for blockchain synchronization after installation (~ 3-4 hours). It is convenient, but it is recommended to use it for informational purposes only, since the pre-downloaded blockchain contradicts the ideology of decentralization.
  • Core - the classic version, just an Emercoin wallet in a container. It takes time to sync with the network.

To start from scratch:

Install [Git] (https://github.com/git-guides/install-git) Install [Docker] (https://docs.docker.com/engine/install/) and [docker-compose] (https://docs.docker.com/compose/install/#install-compose)

Clone the repository and go to the project folder:

git clone https://github.com/emercoin/docker && cd docker

Start building a container with Emercoin:

for regular version Core

docker-compose up -d

for the Core Fast Start version:

docker-compose -f docker-compose-fs.yaml up -d

The container is launched, it takes time to download the blockchain (~ 3-5 hours), but some data can be obtained right now. By default, port 6662 is used to connect to the container.

  • address: 127.0.0.1
  • user: emcrpc
  • password: emcpass
  • method: POST request body example {"method": "getinfo"}

Change the password in the container:

docker-compose exec emc bash changepass.sh
docker-compose restart emc

How can I check that the container is working properly?

Need to send POST (using Postman, for example) to the address http://emcrpc:[email protected]:6662, request body {" method ":" getinfo "}

Python:

import requests

url = "emcrpc:[email protected]:6662"
payload = "{\"method\": \"getinfo\" }"
headers = { 'Content-Type': 'application/json' }
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))

On the command line using Curl: (sudo apt-get update && sudo apt-get install curl) - если Curl не установлен

curl --location --request POST 'emcrpc:[email protected]:6662' \
--header 'Content-Type: application/json' \
--data-raw '{"method": "getinfo" }'

if everything is ok, the response will be in JSON format:

{
    "result": {
        "fullversion": "v0.7.10emc",
        "version": 71000,
        "protocolversion": 70015,
        "walletversion": 130000,
        "balance": 0.000000,

Build Management

Stop container:

docker-compose stop emc

Remove containers:

docker-compose down

In this case, the blockchain database, wallet.dat and emercoin.conf are not deleted. It remains in volume docker_emercoin_data.

Delete blockchain database

docker volume rm docker_emercoin_data

Attention! this command also deletes wallet.dat