Build from Source

🚧

Building from source is for Advanced Developers

If you are new to FIO, it is recommended that you install the FIO prebuilt binaries using the Docker or Manual installations described below instead of building from source.

Download FIO Source

To download the FIO source code, clone the fio repo and its submodules. It is advised to create a home fio folder first and download all the FIO related software there:

mkdir -p ~/fioprotocol && cd ~/fioprotocol
git clone --recursive https://github.com/fioprotocol/fio

Update Submodules

If a repository is cloned without the --recursive flag, the submodules must be updated before starting the build process:

cd ~/fioprotocol/fio
git submodule update --init --recursive

Pull Changes

When pulling changes, especially after switching branches, the submodules must also be updated. This can be achieved with the git submodule command as above, or using git pull directly:

[git checkout <branch>]  (optional)
git pull --recurse-submodules

Build FIO Binaries

The build script, located in the 'scripts' sub-directory, first installs all dependencies and then builds FIO. The script has several options including '-P' (pinned build), and '-i' (install directory). Execute ./fio_build.sh -h to see a full list.

Note: A default build, one where no options are provided, uses the following settings.

  • Clang Version: System clang version. Override with '-P' option.
  • Install Directory: $HOME/fio. Override with '-i' option.
  • Build Type: Release. Override with the '-o' option.
  • Core Symbol Naming: SYS. Override with the '-s' option.

To build, first change to the ~/fioprotocol/fio folder, then execute the script as follows:

cd ~/fioprotocol/fio/scripts
./fio_build.sh -P

The build process writes temporary content to the fio/build folder. After building, the program binaries can be found at fio/build/programs.

Verify clang version

πŸ“˜

Optional

FIO Chain requires clang v8 as part of the LLVM requirements. If you did not use 'pinned' build above ./fio_build.sh -P, ensure the correct LLVM versions are used before proceeding.

To confirm your clang version, go to the build directory or if inspecting an installed binary, the install directory (e.g., $HOME/fio, /usr/local/bin/nodeos, etc.). To locate a running instance of fio:

ps -ef | grep nodeos

Next, execute the strings command on the binary (insert your nodeos build/install dir in the following command):

strings /usr/local/bin/nodeos | grep -i clang | head -10

Install FIO Binaries

πŸ“˜

Recommended Installation

After building FIO successfully, it is recommended to install the FIO binaries to a system location, i.e. /usr/local/bin. This location must be specified at build time! Running the install script will install FIO at the location designated during build with the '-i' option (the default location is '$HOME/fio').

The install script, fio_install.sh, located in the 'scripts' sub-directory takes no arguments and installs the built artifacts from the build process above into the install directory. If no install directory was specified explicitly using the '-i' option, FIO will be installed in the $HOME/fio folder. Note that adequate permission is required to install in system folders, e.g., /usr/local/bin.

cd ~/fioprotocol/fio/scripts
./fio_install.sh

Set-up nodeos configuration file

config.ini

sudo vi /etc/fio/nodeos/config.ini

Mainnet template

################################################################################
#
# FIO tools
#
# Created by CryptoLions.io.. with customizations for dapix debian package
# Git Hub: https://github.com/fioprotocol/fio.start
#
###############################################################################

# Only modify if you are producing blocks
#producer-name = !!_YOUR_PRODUCER_NAME_!!!
#signature-provider = YOUR_PUB_KEY_HERE=KEY:YOUR_PRIV_KEY_HERE

# Addresses below represent IP mask for network connectivity, i.e. who can access server. Leave 0.0.0.0 for public server.
http-server-address = 0.0.0.0:8888
p2p-listen-endpoint = 0.0.0.0:3856
# unix-socket-path = nodeos.sock # FUTURE.
# access-control-allow-origin = *
# p2p-server-address = !!!NODE_IP_ADDRESS!!!!:3856

chain-state-db-size-mb = 16384
reversible-blocks-db-size-mb = 1024
max-transaction-time = 100

contracts-console = true

p2p-max-nodes-per-host = 100

chain-threads = 8
http-threads = 6
wasm-runtime = wabt

http-validate-host = false
verbose-http-errors = true
abi-serializer-max-time-ms = 2000

#produce-time-offset-us = 250000
last-block-time-offset-us = -300000

# Safely shut down node when free space
chain-state-db-guard-size-mb = 128
reversible-blocks-db-guard-size-mb = 2

access-control-allow-origin = *
access-control-allow-headers = Origin, X-Requested-With, Content-Type, Accept
# access-control-max-age =
# access-control-allow-credentials = false

# actor-whitelist =
# actor-blacklist =
# contract-whitelist =
# contract-blacklist =
# filter-on =

# SSL
# Filename with https private key in PEM format. Required for https (eosio::http_plugin)
# https-server-address =
# Filename with the certificate chain to present on https connections. PEM format. Required for https. (eosio::http_plugin)
# https-certificate-chain-file =
# Filename with https private key in PEM format. Required for https (eosio::http_plugin)
# https-private-key-file =

allowed-connection = any
# allowed-connection = specified
# peer-private-key = ["!!NEW_KEY_PUB!!","!!NEW_KEY_PRIV!!"] #create new key for private peers
# peer-key = "!![PUBKEY]!!"

max-clients = 150
connection-cleanup-period = 30
network-version-match = 0
sync-fetch-span = 2000
enable-stale-production = false

pause-on-startup = false
max-irreversible-block-age = -1
txn-reference-block-lag = 0

#mongodb-queue-size = 256
# mongodb-uri =

# peer-key =
# peer-private-key =

# plugin = eosio::producer_plugin
# plugin = eosio::producer_api_plugin

plugin = eosio::chain_plugin
plugin = eosio::chain_api_plugin
# plugin = eosio::db_size_api_plugin

# Uncomment below for a v1 history node.
# plugin = eosio::history_plugin
# plugin = eosio::history_api_plugin
# filter-on = *
# filter-out = eosio:onblock:
# history-per-account = 9223372036854775807
# history-index-state-db-size-mb = 1000000
# history-state-db-size-mb = 4000000

# State History (For 1.8.0-rc1+ add to start params --disable-replay-opts )
# plugin = eosio::state_history_plugin
# state-history-dir = state-history
# trace-history = true
# chain-state-history = true
# state-history-endpoint = 0.0.0.0:8080
# debug mode info (https://github.com/EOSIO/eos/pull/7298)
# trace-history-debug-mode

p2p-peer-address = fio.eu.eosamsterdam.net:9956 # (bp@eosamsterdam)
p2p-peer-address = fio.eosdac.io:6876 # eosDAC (bp@thedac)
p2p-peer-address = peer-fio.nodeone.network:9874 # NodeOne (fionodeonebp@nodeone)
p2p-peer-address = peer.fio.alohaeos.com:9876 # Aloha EOS (bp@alohaeos)
p2p-peer-address = peer1-fio.eosphere.io:9876 # EOSphere (bp@eosphere)
p2p-peer-address = peer2-fio.eosphere.io:9876 # EOSphere (bp@eosphere)
p2p-peer-address = fiomainnet.everstake.one:7770 # Everstake (bp@everstake)
p2p-peer-address = fio.eosrio.io:8122 # EOS Rio (br@eosrio)
p2p-peer-address = fio.acherontrading.com:9876 # Acheron Trading (bp@acherontrading)
p2p-peer-address = fiop2p.eos.barcelona:3876 # eosBarcelona (bp@eosbarcelona)
p2p-peer-address = p2p.fio.detroitledger.tech:1337 # Detroit Ledger Technologies(EOS Detroit) (eosio@detroit)
p2p-peer-address = p2p.fio.zenblocks.io:9866 # ZenBlocks (bp@zenblocks)
p2p-peer-address = p2p.blockpane.com:9876 # Blockpane
p2p-peer-address = p2p.fio.genereos.io:9876 # (bp@genereos)
p2p-peer-address = fio.greymass.com:49876 # Greymass (bp@greymass)
p2p-peer-address = fio.eosusa.news:9886 # EOSUSA (bp@eosusa)
p2p-peer-address = p2p.fioprotocol.io:3856  # Foundation for Interwallet Operability
p2p-peer-address = p2p.fio.eosargentina.io:1984 # EOS Argentina (fio@eosargentina)
p2p-peer-address = fio.cryptolions.io:7987 # CryptoLions (bp@cryptolions)
p2p-peer-address = peer.fio-mainnet.eosblocksmith.io:5090 # Blocksmith ( blocksmith@blocksmith )
p2p-peer-address = p2p.fio.services:9876 # Gandalf ( gandalf@grey )
p2p-peer-address = peer.fio.currencyhub.io:9876 # Currency Hub (bp@thecurrencyhub)
p2p-peer-address = fiop2p.eoscannon.io:6789 # EOSCannon (bp@eoscannon)
p2p-peer-address = fio.eosdublin.io:9976 # eosDublin (bp@eosdublin)
p2p-peer-address = fio.guarda.co:9976 #Guarda Wallet (bp@guardaw)
p2p-peer-address = p2p.fiosweden.org:9376 # sw/eden (bp@fiosweden)
p2p-peer-address = p2p1.fio.greeneosio.com:9876 # GreenEOSIO (bp@greeneosio)
p2p-peer-address = fiop2p.ledgerwise.io:25877 # Ledgerwise (bp@ledgerwise)
p2p-peer-address = fio-bp.dmail.co:7676 # dmail.co (bp@dmaildotco)

Testnet template

################################################################################
#
# FIO tools
#
# Created by CryptoLions.io.. with customizations for dapix debian package
# Git Hub: https://github.com/fioprotocol/fio.start
#
###############################################################################

# Only modify if you are producing blocks
#producer-name = !!_YOUR_PRODUCER_NAME_!!!
#signature-provider = YOUR_PUB_KEY_HERE=KEY:YOUR_PRIV_KEY_HERE

# Addresses below represent IP mask for network connectivity, i.e. who can access server. Leave 0.0.0.0 for public server.
http-server-address = 0.0.0.0:8888
p2p-listen-endpoint = 0.0.0.0:3856
# unix-socket-path = nodeos.sock # FUTURE.
# access-control-allow-origin = *
# p2p-server-address = !!!NODE_IP_ADDRESS!!!!:3856

chain-state-db-size-mb = 16384
reversible-blocks-db-size-mb = 1024
max-transaction-time = 100

contracts-console = true

p2p-max-nodes-per-host = 100

chain-threads = 8
http-threads = 6
wasm-runtime = wabt

http-validate-host = false
verbose-http-errors = true
abi-serializer-max-time-ms = 2000

#produce-time-offset-us = 250000
last-block-time-offset-us = -300000

# Safely shut down node when free space
chain-state-db-guard-size-mb = 128
reversible-blocks-db-guard-size-mb = 2

access-control-allow-origin = *
access-control-allow-headers = Origin, X-Requested-With, Content-Type, Accept
# access-control-max-age =
# access-control-allow-credentials = false

# actor-whitelist =
# actor-blacklist =
# contract-whitelist =
# contract-blacklist =
# filter-on =

# SSL
# Filename with https private key in PEM format. Required for https (eosio::http_plugin)
# https-server-address =
# Filename with the certificate chain to present on https connections. PEM format. Required for https. (eosio::http_plugin)
# https-certificate-chain-file =
# Filename with https private key in PEM format. Required for https (eosio::http_plugin)
# https-private-key-file =

allowed-connection = any
# allowed-connection = specified
# peer-private-key = ["!!NEW_KEY_PUB!!","!!NEW_KEY_PRIV!!"] #create new key for private peers
# peer-key = "!![PUBKEY]!!"

max-clients = 150
connection-cleanup-period = 30
network-version-match = 0
sync-fetch-span = 2000
enable-stale-production = false

pause-on-startup = false
max-irreversible-block-age = -1
txn-reference-block-lag = 0

#mongodb-queue-size = 256
# mongodb-uri =

# peer-key =
# peer-private-key =

# plugin = eosio::producer_plugin
# plugin = eosio::producer_api_plugin

plugin = eosio::chain_plugin
plugin = eosio::chain_api_plugin
# plugin = eosio::db_size_api_plugin

# Uncomment below for a v1 history node.
# plugin = eosio::history_plugin
# plugin = eosio::history_api_plugin
# filter-on = *
# filter-out = eosio:onblock:
# history-per-account = 9223372036854775807
# history-index-state-db-size-mb = 1000000
# history-state-db-size-mb = 4000000

# State History (For 1.8.0-rc1+ add to start params --disable-replay-opts )
# plugin = eosio::state_history_plugin
# state-history-dir = state-history
# trace-history = true
# chain-state-history = true
# state-history-endpoint = 0.0.0.0:8080
# debug mode info (https://github.com/EOSIO/eos/pull/7298)
# trace-history-debug-mode

p2p-peer-address = 104.248.89.37:9876
p2p-peer-address = 176.31.117.48:49876
p2p-peer-address = 203.59.26.145:9876
p2p-peer-address = fio-testnet.eosphere.io:9810
p2p-peer-address = p2p.blockpane.com:3856
p2p-peer-address = fiotestnet.everstake.one:7770
p2p-peer-address = fiotestnet.greymass.com:39876
p2p-peer-address = peer.fiotest.alohaeos.com:9876
p2p-peer-address = testnet.fio.eosdetroit.io:1337
p2p-peer-address = testnet.fioprotocol.io:1987

genesis.json

sudo vi /etc/fio/nodeos/genesis.json

Mainnet template

{
  "initial_timestamp": "2020-03-25T00:00:00.000",
  "initial_key": "FIO7PptcpF7ai1LDgT9CvxukZ7nzM5cdeFVVDdTZeSNZLdcjYxUdk",
  "initial_configuration": {
    "max_block_net_usage": 1048576,
    "target_block_net_usage_pct": 1000,
    "max_transaction_net_usage": 524288,
    "base_per_transaction_net_usage": 12,
    "net_usage_leeway": 500,
    "context_free_discount_net_usage_num": 20,
    "context_free_discount_net_usage_den": 100,
    "max_block_cpu_usage": 200000,
    "target_block_cpu_usage_pct": 2000,
    "max_transaction_cpu_usage": 150000,
    "min_transaction_cpu_usage": 100,
    "max_transaction_lifetime": 3600,
    "deferred_trx_expiration_window": 600,
    "max_transaction_delay": 3888000,
    "max_inline_action_size": 4096,
    "max_inline_action_depth": 4,
    "max_authority_depth": 6,
    "max_ram_size": 34359738368
  }
}

Testnet template

{
  "initial_timestamp": "2020-03-10T12:30:00",
  "initial_key": "FIO6HCfioqMe7zbH62JmJE2LX3YsoXDfj5nenMZoa6omrLUHiZ1V4",
  "initial_configuration": {
    "max_block_net_usage": 1048576,
    "target_block_net_usage_pct": 1000,
    "max_transaction_net_usage": 524288,
    "base_per_transaction_net_usage": 12,
    "net_usage_leeway": 500,
    "context_free_discount_net_usage_num": 20,
    "context_free_discount_net_usage_den": 100,
    "max_block_cpu_usage": 200000,
    "target_block_cpu_usage_pct": 2000,
    "max_transaction_cpu_usage": 150000,
    "min_transaction_cpu_usage": 100,
    "max_transaction_lifetime": 3600,
    "deferred_trx_expiration_window": 600,
    "max_transaction_delay": 3888000,
    "max_inline_action_size": 4096,
    "max_inline_action_depth": 4,
    "max_authority_depth": 6,
    "max_ram_size": 34359738368
  }
}

Configure and Run FIO Chain Node

See Configure Your Node


What’s Next