Install TinyChain
Install the TinyChain host software

Most users will only need to run the TinyChain Python client, not a TinyChain host. See the Python client introduction for instructions to install the client.

The quick and easy way to get TinyChain up and running to try it out is to use Docker:
# build the Dockerfile from the GitHub repo, then run a new container with TinyChain listening on host port 8702
# the "-it" option also opens an interactive terminal
docker run -it -p 8702:8702/tcp $(docker build https://github.com/haydnv/tinychain.git -q) ./tinychain --address=0.0.0.0
You can check that your installation succeeded by loading http://127.0.0.1:8702/state/scalar/value/string?key="Hello, World!" in your browser.

An install script is provided for Ubuntu (only tested on Ubuntu 20.04):
curl https://raw.githubusercontent.com/haydnv/tinychain/master/bin/install.sh -sSf | bash

  1. 1.
    If you need CUDA support for GPU acceleration, first install CUDA 11 by following the instructions here: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#ubuntu-installation. If you're not sure, skip this step.
  2. 3.
    Install cargo by following the instructions here: https://doc.rust-lang.org/cargo/getting-started/installation.html
  3. 4.
    Install TinyChain by running cargo install tinychain --features=tensor

Installation on other operating systems has not been tested and may not be straightforward. If you need to install TinyChain on an operating system other than 64-bit x86 Ubuntu Linux, please Ask for help.
  1. 1.
    If you need CUDA support for GPU acceleration, make sure to install CUDA first. If you're not sure, skip this step.
  2. 2.
    Install ArrayFire by following the instructions here: https://arrayfire.org/docs/installing.htm
  3. 3.
    Install cargo by following the instructions here: https://doc.rust-lang.org/cargo/getting-started/installation.html
  4. 4.
    Install TinyChain by running cargo install tinychain --features=tensor
The ArrayFire library requires the environment variables AF_PATH and LD_LIBRARY_PATH to be set at build time and at run time. The vast majority of installation failures happen as a result of missing or incorrect environment variables. If you have any problems with your TinyChain installation, the first thing to check is that AF_PATH is set to the ArrayFire installation root directory and included in LD_LIBRARY_PATH.
Example:
export AF_PATH=/opt/arrayfire
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$AF_PATH/lib64

To use TinyChain in production, you'll probably want to configure systemd so that TinyChain will automatically restart in the case of a crash or a host machine restart. You can find detailed instructions on how to configure a new service with systemd here. You can customize this example systemd config file for your use-case:
# This is an example systemd service config for TinyChain.
[Unit]
Description=Tinychain
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=2
# change this user name!
User=root
# change this path to match your Tinychain install path
# you'll probably also want to include the --address, --data_dir, and --cluster flags, at a minimum
ExecStart=/root/tinychain/host/target/release/tinychain --cache_size=4G
[Install]
WantedBy=multi-user.target
Copy link
On this page
Client
Host
Easy install
Automatic install (Ubuntu)
Manual install (Ubuntu)
Manual install (other OS)
systemd configuration