Tutorials: How to set up a Full Node

From Waves Wiki
Jump to: navigation, search
This page contains changes which are not marked for translation.

Other languages:
العربية • ‎corsu • ‎čeština • ‎Deutsch • ‎Ελληνικά • ‎English • ‎español • ‎français • ‎Bahasa Indonesia • ‎italiano • ‎日本語 • ‎Bahasa Melayu • ‎Nederlands • ‎polski • ‎português do Brasil • ‎русский • ‎ไทย • ‎Tiếng Việt • ‎粵語 • ‎中文(中国大陆)‎

The Forging Process in Waves

The Waves blockchain was started in July 2016 with its genesis block containing 100 million WAVES. The Full Node code was first released to the community in December 2016 essentially decentralizing the network. Since then, any person can run a Full Node and gets a reward for doing so. The minimum balance to forge is 10'000 WAVES - this amount can also be leased to a node, e.g. the node's balance may be 0 but 10'000 WAVES are leased to it. The network reward solely consists of the accrued transaction fees a block contains and is given fully to the generator of the block. The transactions fees can be WAVES and/or any token on the Waves blockchain which is accepted by a miner - see Tokens Flexibility for more information on that. Additionally, Waves Platform distributes the Miners Reward Token to full node operators - you can read more about that here.

Your chance to forge a block depends only on your balance: The more WAVES you have, the bigger is your chance to forge the next block. Your actual chance calculates as followed: My generating balance ÷ Total of all generating balances

You might ask yourself what the generating balance is. Below you find a quick list of different terms for balances:

  • Regular Balance: Your normal Waves balance as seen in the Lite Client
  • Effective Balance: Regular balance + received leases - sent leases
  • Generating Balance: Effective balance with received and cancelled leases after 1000 blocks. This amount is used for forging.

How to set up a Full Node

Part 1: Install Java SE Runtime Environment (JRE)

Step 1: Waves requires JRE 1.8 to function properly. Click here to get to the Oracle download section. Then, click on "Accept License Agreement" and choose the option that best fits your operative system.

Java installation.PNG

Step 2: After having downloaded JRE, run the installer. That should look as followed:

JRE installation.PNG

Before continuing, you must add a line ;JAVA_HOME/bin to your existing PATH environment variable to access the JRE from the command line. We are going to show you how to do so in Windows 10. If you're using another operative system check here.

Step 3: To do so, right click the Computer icon and click on Properties.

JRE installation2.PNG

Step 4: Choose Advanced system settings.

JRE installation3.PNG

Step 5: Then, click on Environment Variables.

JRE installation4.PNG

Step 6: To add a line in the PATH variable, click PATH (figure 1) and then click Edit (figure 2).

JRE installation5.PNG

Step 7: Go to the very end of the variable value and type "JAVA_HOME/bin", then press OK.

JRE installation6.PNG

Step 8: To finish and save, click "OK" on all windows.

Part 2: Download and Configure Waves

Now you have to download the latest version of waves.jar as well as the required configuration file to any folder, for example C:/waves.

Step 1: Click here to see all Waves releases and download the latest version of waves.jar (currently v0.6.4).

Download waves.PNG

Step 2: As mentioned before, you also need the required configuration file for MainNet which can be found right here.

Step 3: Open notepad (notepad++ is better but we use notepad for this tutorial) and copy and paste the configuration file in it. That should look as followed.

Waves config file.PNG

Step 4: Configure the .conf file. This is the most tricky part and it is advised to consult the official GitHub guide.

In the end, your configuration file should look something like this:

# Waves Node settings section.
waves {
  # Node base directory.
  directory = ${user.home}"/waves"

  # Application logging level. Could be DEBUG | INFO | WARN | ERROR. The default value is INFO.
  logging-level = INFO

  # P2P Network settings.
  network {
    # Peers and blacklist storage file.
    file = ${waves.directory}"/data/peers.dat"

    # Network address.
    bind-address = "0.0.0.0"

    # Port number.
    port = 6863

    # Node name to send during a handshake. Comment this string out to set random node name.
    #node-name = "some-node-name"

    # String with IP address and port to send as an external address during a handshake. Could be set automatically in case of UPnP is enabled.
    declared-address = ""

    # A nonce to send during a handshake. Should be different if few nodes run on the same external IP address. Comment this out to set random nonce.
    #nonce = 0

    # List of IP addresses of well-known nodes.
    known-peers = ["52.30.47.67:6863", "52.28.66.217:6863", "52.77.111.219:6863", "52.51.92.182:6863"]

    # Restricts node communication to local machine.
    local-only = no

    # How long the information about peer stays in the database after the last communication with it.
    peers-data-residence-time = 1d

    # For how long a peer stays in the blacklist after getting in it.
    black-list-residence-time = 10m

    # A number of network connections handled simultaneously.
    max-connections = 30

    # Timeout on network communications with peers.
    connection-timeout = 30s

    # Network buffer size.
    outbound-buffer-size = 16M

    # The minimal ephemeral port number used to distinguish incoming connections.
    min-ephemeral-port-number = 35368

    # The size of a circular buffer to store unverified peers.
    max-unverified-peers = 1000

    # The period of time between broadcasts of the connected peers' list.
    peers-broadcast-interval = 2m

    # The number of incorrect packets received from a peer to blacklist it.
    black-list-threshold = 50

    # The number of unrequested packets received from a peer to blacklist the peer.
    unrequested-packets-threshold = 100

    # UPnP settings.
    upnp {
      # Enable or disable UPnP tunnel creation. Use this setting only if your router/gateway supports it. This is useful only if your node is running in a home network. And completely unuseful if your node is in the cloud.
      enable = no

      # UPnP timeouts.
      gateway-timeout = 7s
      discover-timeout = 3s
    }
  }

  # Wallet settings.
  wallet {
    # The path to wallet file.
    file = ${waves.directory}"/wallet/wallet.dat"

    # Password to protect wallet file.
    password = "some string as password"

    # Wallet seed as a BASE58 string.
    seed = ""
  }

  # Blockchain settings.
  blockchain {
    # The path to blockchain file.
    file = ${waves.directory}"/data/blockchain.dat"

    # Blockchain type. Could be TESTNET | MAINNET | CUSTOM. The default value is TESTNET.
    type = TESTNET

    # The 'custom' section should be uncommented and set only in case of CUSTOM blockchain type is selected. It's impossible to overwrite predefined 'testnet' and 'mainnet' configurations.
    #    custom {
    #      # Address feature character. Used to prevent mixin up addresses from different networks.
    #      address-scheme-character = "C"
    #
    #      # Timestamps/heights of activation/deactivation of different funcions.
    #      functionality {
    #        allow-temporary-negative-until = 0
    #        allow-invalid-payment-transactions-by-timestamp = 0
    #        require-sorted-transactions-after = 0
    #        generation-balance-depth-from-50-to-1000-after-height = 0
    #        minimal-generating-balance-after = 0
    #        allow-transactions-from-future-until = 0
    #        allow-unissued-assets-until = 0
    #        allow-burn-transaction-after = 0
    #        require-payment-unique-id-after = 0
    #        allow-exchange-transaction-after: 0
    #        allow-createalias-transaction-after: 0
    #      }
    #
    #      # List of genesis transactions
    #      genesis {
    #        # Timestamp of genesis block and transactions in it
    #        timestamp = 1460678400000
    #
    #        # Genesis block signature
    #        signature = "BASE58BLOCKSIGNATURE"
    #
    #        # Initial balance in smallest units
    #        initial-balance = 100000000000000
    #
    #        # Initial base target
    #        initial-base-target =153722867
    #
    #        # Average delay between blocks
    #        average-block-delay = 60s
    #
    #        # List of genesis transactions
    #        transactions = [
    #          {recipient = "BASE58ADDRESS1", amount = 50000000000000},
    #          {recipient = "BASE58ADDRESS2", amount = 50000000000000}
    #        ]
    #      }
    #    }
  }

  # Checkpoints settings.
  checkpoints {
    # The public key for checkpoints verification. The default value is the TESTNET public key.
    public-key = "4PvoqxpWi7kCA9N3UXcEB9CZx4iPPeHX9jSYdAioPhnr"
  }

  # Transaction fees for different types of transactions.
  fees {
    payment {
      WAVES = 100000
    }
    issue {
      WAVES = 100000000
    }
    transfer {
      WAVES = 100000
    }
    reissue {
      WAVES = 100000
    }
    burn {
      WAVES = 100000
    }
    exchange {
      WAVES = 100000
    }
    lease {
      WAVES = 100000
    }
    lease-cancel {
      WAVES = 100000
    }
    create-alias {
      WAVES = 100000
    }
  }

  # Matcher settings.
  matcher {
    # Enable/disable matcher.
    enable = yes

    # Matcher's account address.
    account = ""

    # Matcher REST API bind address.
    bind-address = "127.0.0.1"

    # Matcher REST API port.
    port = 6886

    # Minimum allowed order fee.
    min-order-fee = 100000

    # A fee of order match transaction.
    order-match-tx-fee = 100000

    # Matcher's directories.
    journal-directory = ${waves.directory}"/journal"
    snapshots-directory = ${waves.directory}"/snapshots"

    # Snapshot creation interval.
    snapshots-interval = 1d

    # A maximum number of open orders.
    max-open-orders = 1000

    # Base assets used as price assets.
    price-assets: []

    # Predefined ordering of base assets.
    predefined-pairs: []
  }

  # New block generator settings.
  miner {
    # Enable/disable block generation.
    enable = yes

    # Enable/disable off-line block generation.
    offline = no

    # The number of connected peers required to start block generation.
    quorum = 1

    # New block generation interval.
    generation-delay = 15s

    # The maximum age of the last block to allow generation.
    interval-after-last-block-then-generation-is-allowed = 1d

    # Enable/disable TF-Like scheduling.
    tf-like-scheduling = yes
  }

  # Node's REST API settings.
  rest-api {
    # Enable/disable REST API.
    enable = yes

    # Network address to bind.
    bind-address = "127.0.0.1"

    # Port to listen to REST API requests.
    port = 6869

    # Hash of API key string.
    api-key-hash = "H6nsiifwYKYEx6YzYD7woP1XCn72RVvx6tC1zjjLXqsu"

    # Enable/disable CORS support.
    cors = yes
  }

  # Nodes' synchronisation settings.
  synchronization {

    # The number of blocks that could be rolled back in case of a fork detection. If the fork is longer than this the rollback is impossible.
    max-rollback = 100

    # The size of temporary storage for forked blocks.
    max-chain-length = 101

    # Load only entire chain from peer then requested.
    load-entire-chain = yes

    # Timeout to receive all requested blocks.
    synchronization-timeout = 30s

    # Stick to one peer while receiving requested blocks.
    pin-to-initial-peer = yes

    # The number of retries of synchronisation before sending the peer to the blacklist.
    retries-before-blacklisting = 2

    # The number of retries of synchronisation operations.
    operation-retires = 3

    # Score broadcast interval.
    score-broadcast-interval = 30s

    # Time to live for broadcasted score.
    score-ttl = 90s
  }

  # Unverified transactions pool settings.
  utx {

    # Pool size.
    size = 10000

    # Random transaction broadcast interval.
    broadcast-interval = 30s
  }
}

If you wish to use an existing Waves address from the Lite Client, all you need to do is check the backup window in the Lite Client and put the encoded SEED in the seed = "" field and your wallet password in the password = "" field in the wallet settings.

Account info back up.PNG

Part 3: Run Waves

It's very important that you encrypt your apikey in the api-key-hash = "" field. To do so, simply run Waves with the default bind-address = "127.0.0.1" and with enable = yes in the node's REST API settings. This ensures that you can connect to the network safely and encrypt your apikey.

Download the blockchain. Then, go to 127.0.0.1:6869 in your browser where you will be able to use RPC commands through Swagger.

Once all this is done, you'll have to close the node and set the different apikey and apikeyhash in the config file as well as the rpcAddress. Let's go through this step by step.

Step 1: Open the command prompt (search "cmd" on Windows).

Command prompt.PNG

Step 2: Navigate to the folder where your waves.jar and the configuration file are stored. This is done with the "cd" command (change directory). Since we saved the file in a folder called waves on the desktop, the command we'll use is (Note: replace "kanopt" with your user name):
<code>cd C:\Users\kanopt\Desktop\waves</code>

Command prompt2.PNG

Step 3: Now enter the following command to run Waves with the config you specified: java -jar waves.jar waves-mainnet.conf

Command prompt3.PNG

You are now downloading the Waves blockchain. That should look something like this:

Command prompt4.PNG

Step 4: Once the blockchain is fully downloaded (compare the block height with a block explorer, for example WavesGo, to see if it finished), you'll be able to access Swagger to encrypt an apikey. Open your browser and go to "127.0.0.1:6869".

Step 5: Now click on "Utils".

Swagger1.PNG

Step 6: Then, click on "/utils/hash/secure".

Swagger2.PNG

Step 7: Enter your desired apikey (figure 1) and click "Try it out" (figure 2).

Swagger3.PNG

Step 8: Now take your apikey and its hash and put it in the configuration file in the "apiKeyHash": "". Simply replace "H6nsiifwYKYEx6YzYD7woP1XCn72RVvx6tC1zjjLXqsu" with the hash field.

Swagger4.PNG

Step 9: Change the "rpcAddress": "127.0.0.1" field to your external IP.

Step 10: Close the command line terminal that is downloading the blockchain and repeat Step 1, Step 2 and Step 3.

Swagger5.PNG

Step 11: The blockchain will now download fully. When it has completed, you will start to forge!