[Set-Up Guide] Ark ACES Node | Del



  • Hi everyone!

    I noticed that some people were struggling to setup an ACES node, like myself. So I decided to make a simple guide on how to go about an do it. If you have questions at the end feel free to reach out to @ryano or myself at @0toierance I will try my best to help.

    Original Git

    Remember if you start getting errors, just go over the code again, and look into the git, redoing it helps alot


    Part 1:

    Locate a server on any VPS service provider:
    https://www.vultr.com/
    https://www.digitalocean.com/
    https://www.linode.com/
    For my case I used vultr

    0_1505785875192_upload-5065e024-ceef-4536-b83e-04404cec42e8

    (Here I am choosing my OS for my server)

    0_1505785927349_upload-6741e926-0696-4c71-a286-f279611604ef

    (Here is the particular server I chose for the setup, and finally click ‘Deploy’)

    0_1505786008624_upload-cfd8ab53-26e4-48e1-849c-b66e9a1d79a8

    (After you deploy your server, click into it in your “Server” tab.)

    Afterwards, download Putty and open it and use the server IP address from your server details to login like so;

    0_1505786345202_upload-b80643b9-eaa4-439f-88ca-c1f76d02ba8a

    (Input server address and click ‘Open’)

    0_1505786465022_upload-cfc4dfe0-89c4-44f5-a610-f21ac9a85547

    (When you see this alert, simply click ‘Yes’ its just normal warning.)

    0_1505786545233_upload-5d5bd8da-9e73-4398-a0da-3b03a914dc47

    (And this window should pop up, here enter your login, which should be ‘root’ and then copy and paste your password.)

    Tip: to paste in Putty, make sure to right click your mouse.

    Part 2:

    Install system dependencies:

    sudo apt-get install software-properties-common python-software-properties build-essential curl git maven
    sudo add-apt-repository ppa:git-core/ppa
    sudo add-apt-repository -y ppa:ethereum/ethereum
    sudo add-apt-repository ppa:webupd8team/java -y
    sudo apt-get update

    sudo apt-get install ethereum solc

    Install Java JVM

    echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
    sudo apt-get install oracle-java8-installer

    Install nodejs

    curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
    sudo apt-get install nodejs

    Install nginx

    sudo apt-get install nginx

    0_1505786659130_upload-75728e76-2d3b-4e37-8f8e-6e85c4038720

    (When inputting go line by line starting with ‘sudo’ and you should go through something like this, remember to type ‘y’ to proceed forward.)

    Install Ethereum Service

    Copy the following into /etc/systemd/system/geth-network.service. There are 3 different ways to run geth to target different ethereum networks: dev, testnet, and mainnet.

    vim /etc/systemd/system/geth-network.service

    When in vim, press ‘a’ to enter insert mode. Then press ctrl+shift+V to paste the desired network chunk below. If you make a mistake, press ESC and type :1,$d to clear the page. Save the changes with ESC and type :x.

    You can choose any of the 3 networks, for my case I chose Mainnet

    Local Devnet:


    [Unit]
    Description=Ethereum devnet

    [Service]
    Restart=always
    ExecStart=/usr/bin/geth --dev --rpc --rpcaddr=127.0.0.1 --rpcapi ‘web3,eth,personal’ --rpccorsdomain="*" \
    –datadir=/eth-data
    [Install]
    WantedBy=multi-user.target
    Ropsten Testnet:


    Ropsten Testnet:


    [Unit]
    Description=Ethereum testnet

    [Service]
    Restart=always
    ExecStart=/usr/bin/geth --testnet --rpc --rpcaddr=127.0.0.1 --rpcapi ‘web3,eth,personal’ --rpccorsdomain="*" \
    –datadir=/eth-data --fast --cache=1024 \
    –bootnodes “enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303,enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@13.84.180.240:30303”

    [Install]
    WantedBy=multi-user.target
    Mainnet:


    Mainnet:


    [Unit]
    Description=Ethereum network

    [Service]
    Restart=always
    ExecStart=/usr/bin/geth --rpc --rpcaddr=127.0.0.1 --rpcapi ‘web3,eth,personal’ --rpccorsdomain="*" \
    –datadir=/eth-data --fast --cache=1024 \
    –bootnodes “enode://20c9ad97c081d63397d7b685a412227a40e23c8bdc6688c6f37e97cfbc22d2b4d1db1510d8f61e6a8866ad7f0e17c02b14182d37ea7c3c8b9c2683aeb6b733a1@52.169.14.227:30303,enode://6ce05930c72abc632c58e2e4324f7c7ea478cec0ed4fa2528982cf34483094e9cbc9216e7aa349691242576d552a2a56aaeae426c5303ded677ce455ba1acd9d@13.84.180.240:30303”

    [Install]
    WantedBy=multi-user.target


    0_1505787721272_upload-a732ff41-ea11-4348-87c7-01da96e654bf

    (After you choose your ethereum network type the following)


    vim /etc/systemd/system/geth-network.service


    You can also ‘nano’ which is more user friendly than ‘vim’, in this case and all other cases when using, it will look like this:


    nano /etc/systemd/system/geth-network.service



    0_1505787848788_upload-cdfc3292-add5-475c-bb18-e641fe2241f2

    (An empty directory like this will open, where you’ll input the chosen Ethereum Network, again I chose Mainnet so mine looked like this)

    0_1505787998356_upload-66adf3ab-6486-4668-a2fe-dc729d218bdd


    Start up ethereum service (this can take several hours to sync before transactions):


    sudo chmod 655 /etc/systemd/system/geth-network.service
    sudo systemctl daemon-reload
    sudo service geth-network start


    0_1505788136187_upload-2b667db0-7ff1-4e8e-9053-60260dd60924

    (After typing out those commands, you should end up with something like this)


    And it will look something like this:

    ETH Blockchain Syncing


    Part 3:

    Open a new console and login with the same credentials you used previously.

    To confirm that you are syncing type the following:


    sudo geth attach ipc:/eth-data/geth.ipc
    eth.syncing


    0_1505788524558_upload-da5f26ed-acee-4e71-9b57-5d81fc11a9d7

    (And you should see something like this, remember to type ‘exit’ in order to leave that part)

    Create Service ETH Wallet

    Connect to the local geth instance and create a new ETH wallet for ACES service:

    geth attach ipc:/eth-data/geth.ipc

    Followed by:

    personal.newAccount(‘enter your passphrase here’);
    eth.accounts


    0_1505789110975_upload-6541f9ff-4377-4078-afc9-a8bf85f0dbc6

    (At the end you should save the ETH address that it spit out along with the password you input, remember to ‘exit’)


    Next type the following:

    sudo mkdir /apps
    cd /apps
    git clone https://github.com/ark-aces/aces-backend.git


    0_1505789270295_upload-5de4a47c-a322-4b7c-a559-5e03602eb900

    (It will look something like this)

    Afterwards, type the following:

    mkdir /etc/aces-backend


    Copy src/main/resources/application.yml file over into /etc/aces-backend and replace wallet configurations with your own Ethereum and Ark addresses and passphrases/passwords. Ensure that the values remain quoted. If using mainnet, change arkPerEthAdjustment: “100.00” to arkPerEthAdjustment: “1”.

    Copy the following code into the console:

    vim /etc/aces-backend/application.yml

    0_1505789611536_upload-5a1f6617-074f-48ba-8a90-4a830b7595d4


    Afterwards copy the following code into the new directory:

    spring:
    datasource:
    url: "jdbc:h2:/tmp/testdb;DB_CLOSE_ON_EXIT=FALSE;AUTO_RECONNECT=TRUE"
    driver-class-name: "org.h2.Driver"
    jpa:
    hibernate:
    ddl-auto: “update”

    arkNetwork:
    name: “mainnet”

    ethBridge:
    ethServerUrl: "http://localhost:8545"
    scriptPath: "./bin"
    nodeCommand: “/usr/bin/node”

    serviceArkWallet:
    address: "change me"
    passphrase: "change me"
    passphrase2:

    serviceEthAccount:
    address: "change me"
    password: “change me”

    arkPerEthAdjustment: “100.00”

    ethContractDeployService:
    arkFlatFee: "2.00"
    arkPercentFee: "2.25"
    requiredArkMultiplier: “1.2”

    ethTransferService:
    arkFlatFee: "1.00"
    arkPercentFee: "1.25"
    requiredArkMultiplier: “1”


    0_1505789843104_upload-f436d0cd-086b-427e-9cdf-aa2161df5865

    0_1505789874529_upload-b9657505-4843-4444-8553-7d00b26838b3

    See above image on how you should end up formatting the script


    Now we begin to set up the system backend:

    Input the following:

    vim /etc/systemd/system/aces-backend.service

    Again a new directory will open, in it

    copy and paste the following:

    [Unit]
    Description=Aces Backend

    [Service]
    Restart=always
    WorkingDirectory=/apps/aces-backend
    ExecStart=/usr/bin/mvn spring-boot:run -Dspring.config.location=file:/etc/aces-backend/application.yml

    [Install]
    WantedBy=multi-user.target


    0_1505790086862_upload-98f3d651-e13f-423e-b31f-1c635dd2c29a

    (It will look something like this, remember to save and exit by typing ‘:wq’)

    Afterwards access the following directory:

    cd /apps/aces-backend/bin


    Then execute the following:

    npm install


    Next execute the following commands in order to start the ACES backend:

    sudo chmod 655 /etc/systemd/system/aces-backend.service
    sudo systemctl daemon-reload
    sudo service aces-backend start


    Installing ACES frontend

    cd /apps
    git clone https://github.com/ark-aces/aces-frontend.git


    0_1505792288609_upload-3f5e2755-dc85-4642-8919-3bbb0609dec4

    Copy prod configuration template into custom configuration file:

    cd /apps/aces-frontend
    cp src/environments/environment.prod.ts src/environments/environment.custom.ts


    0_1505793092490_upload-82175f3e-e5d3-4fe5-a668-d96b17f062c1

    (Here is how it would look like)

    Input the following:

    vim /apps/aces-frontend/src/environments/environment.custom.ts


    If using an Ethereum Testnet, copy the following into /apps/aces-frontend/src/environments/environment.custom.ts, making sure to replace localhost with your server IP, if applicable.


    export const environment = {
    production: true,
    title: ‘Custom Ark Contract Execution Services (ACES)’,
    isEthTestnet: true,
    ethNetworkName: ‘ropsten’,
    etherscanBaseUrl: ‘https://ropsten.etherscan.io’,
    ethArkRateFraction: ‘1/100’,
    arkExplorerBaseUrl: ‘https://explorer.ark.io’,
    acesApiBaseUrl: ‘http://localhost/aces-api
    };


    If using an Ethereum Mainnet, copy the following into /apps/aces-frontend/src/environments/environment.custom.ts, making sure to replace localhost with your server IP, if applicable.


    export const environment = {
    production: true,
    title: ‘Custom Ark Contract Execution Services (ACES)’,
    isEthTestnet: false,
    ethNetworkName: ‘mainnet’,
    etherscanBaseUrl: ‘https://etherscan.io’,
    ethArkRateFraction: ‘1’,
    arkExplorerBaseUrl: ‘https://explorer.ark.io’,
    acesApiBaseUrl: ‘http://localhost/aces-api
    };


    0_1505793725701_upload-96bc2c18-02d4-42d6-90b7-e6ca73715ebc

    (This is how the code for Ethereum Mainnet code will look like once input)

    0_1505793825698_upload-42884440-8918-4f83-bc03-e74062f5228b


    (Remember to change the ‘localhost’ to your server IP)


    Install angular for the front-end UI


    Follow the code below:


    cd /apps/aces-frontend
    npm install -g @angular/cli
    npm install


    0_1505794050857_upload-0ca1c8c8-0d84-4fdd-b3f7-4e647be09bb2

    0_1505794078510_upload-6e3545ef-b51f-4ded-8708-025154bbb5ad

    (It will look something like this)


    Build the application:


    ng build --target=production --env=custom --base-href /aces-app/


    0_1505794243396_upload-dbf05c02-5a5e-4db3-a8c9-793d2d9a5648

    (This is how your console should appear once it is finished building the application)


    Part 4:

    Set up nginx web server:

    Allow backend and frontend to be served by nginx by adding the following to /etc/nginx/sites-available/default under root server directive.

    First vim into the file


    vim /etc/nginx/sites-available/default


    0_1505794886928_upload-c0067895-ba30-4e39-b781-1f1448d47a26

    Then add the snippet below under the server directive.


    location /aces-app/ {
    alias /apps/aces-frontend/dist/;
    try_files $uri $uri/ /aces-app/;
    }

    location /aces-api/ {
    proxy_pass http://127.0.0.1:8080/;
    }


    0_1505794907236_upload-68f63491-dfd2-44f4-bc1b-186c0d6faf2d


    Now restart the nginx service


    sudo service nginx restart


    Part 5:

    Confirm setup

    Check the backend API by making a GET request to http://localhost/aces-api/test-service-info:

    0_1505795075528_upload-052e77e9-d37d-4628-8ca1-9d7d1ff13f33

    After you check your server IP using the ‘curl’ you should get this result:

    0_1505795108720_upload-02360ed1-b5d4-4923-86c7-b70e1bfda047

    And lastly open up the aces-app frontend in your browser: http://localhost/aces-app/

    0_1505795157317_upload-b788d83a-daff-4009-921f-00a4da8b44f4

    0_1505795170642_upload-b92c43a4-e22d-4076-b23d-fb430a73f078


    Remember if you start getting errors, just go over the code again, and look into the git, redoing it helps a lot

    Alright, so that’s it. I hope it works out for everyone who uses this guide, if you end up confused feel free to reach out to me on slack or here or any of the Ark devs. I am not taking credit for any development in this project, i’m merely a user who felt that there should be a guide regarding the set up. I appreciate the opportunity to have come up with this as well as all the hard work that the devs and many community members put in to make this project so awesome.

    Oh, and special thank to @ryano for all the help setting up

    -Del
    Slack: @0toierance



  • This was a great guide, however I’m having an issue with just getting a loading wheel after clicking any of the buttons, presuming it’s not seeing the backend but not seeing any errors in nginx, any tips on where else to look?



  • Very Nice Looking Guide!!! Job well done :clap_tone1:!!! It will be some time until I get to try this out. Thank You!!! : :smile:



  • @djh82uk Hey! Sorry for the late reply, for some reason I wasn’t receiving any notifications :( However, if you’re still stuck come on over to the slack channel #aces
    There are a handful of people who can assist you along with myself.



  • @michaelthecrypto Thank you very much Michael!



  • Pwoah. Nicely done brother.



  • @criptodogg Thanks a lot :thumbsup: :D :thumbsup:



Looks like your connection to [Set-Up Guide] Ark ACES Node | Del was lost, please wait while we try to reconnect.