/EAC_API_JAVA

A simple block explorer & API node for EarthCoin (EAC) written in java

Primary LanguageJava

EAC_API_JAVA

A simple block explorer & API node for EarthCoin (EAC) written in java

Requirements:

  • A fully sync EarthCoin v.2.0 node with txindex=1 in the config file and enabled rpc calls
  • Java runtime environment v.8.0 or higher
  • Approx. 10 GB disk space for blockchain data

Advantages:

  • Platform independent code. Can be operated at any operating system supporting Java.
  • No external database is required. All data are obtained from the coin node through the rpc calls.
  • Multithread implementation to avoid a response stuck.

Instalation:

  1. Get and compile the EarthCoin v.2.0 wallet. Follow the instructions at https://github.com/Sandokaaan/EarthCoin2019/releases
  2. Edit the config file of EarthCoin, make sure to add lines: txindex=1
    rpcuser=YOUR_RPC_USERNAME
    rpcpassword=YOUR_RPC_PASSWORD
    rpcport=YOUR_RPC_PORT_NUMBER
  3. Run the EarthCoin v.2.0 wallet and let it sync.
  4. Install/update the Java runtime environment, see https://www.java.com/
  5. Get the code from this repository: git clone https://github.com/Sandokaaan/EAC_API_JAVA.git
  6. Optionnaly, you can build the code with your java compiller (Netbeans, Eclipse, javac).
  7. Open the folder "EAC_API_JAVA/dist" and run the code: java -jar ApiExtension.jar
  8. Stop the program started in the stage 7, locate the file "api.conf" and modify the lines rpcuser, rpcpassword and rpcport to be the same as in wallet config file - see stage 2. Also se the port number for the API server.
  9. Start code java -jar ApiExtension.jar again and let it run on a background.

HTTPS/SSL configuration (optional):
10. Obtain a valid SSL certificate for the domain name of your server (for a free certificate see e.g. https://github.com/Sandokaaan/EAC_API_JAVA/releases/download/v.2.0.8/TrustAsia_english.pdf, https://github.com/Sandokaaan/EAC_API_JAVA/releases/download/v.2.0.8/TrustAsia_chinese.pdf or https://github.com/diafygi/acme-tiny).
11. Use keytool to import your SSL certificate to a *.jks keystore file: keytool -importkeystore -deststorepass PASSWORD -destkeypass PASSWORD -destkeystore ./KEYSTOREFILE.jks -deststoretype pkcs12 -srckeystore SERVERCERTIFICATE.p12 -srcstoretype pkcs12 -srcstorepass PASSWORD -alias CERTIFICATENAME
Do not forget to change capitalized words to your password and appropriate file names.
12. Move the keystore file to a secure PATH
13. Open the API config file api.conf . Set variables:
usessl=1
sslcertpath=PATH
sslcertpassword=PASSWORD
Where change PATH with the full or relative path to your keystore file from the step 12, and PASSWORD with the password used in the step 11.
14. Restart the API.

A demo server with SSL-protocol enabled: https://blocks.deveac.com:4000/

A demo server without SSL: http://blocks.deveac.com:9000/