diff --git a/README_ASIC.md b/README_ASIC.md new file mode 100644 index 00000000..7a925f06 --- /dev/null +++ b/README_ASIC.md @@ -0,0 +1,76 @@ +# ASIC timelord user guide + +## Initial setup + +Download and unpack LibFT4222 library: +```bash +# in chiavdf directory +wget https://ftdichip.com/wp-content/uploads/2022/06/libft4222-linux-1.4.4.170.tgz +mkdir src/hw/libft4222 +tar -C src/hw/libft4222 -xf libft4222-linux-1.4.4.170.tgz +ln -s libft4222.so.1.4.4.170 src/hw/libft4222/build-x86_64/libft4222.so +``` + +Build binaries: +```bash +cd src +make -f Makefile.vdf-client emu_hw_test hw_test emu_hw_vdf_client hw_vdf_client +``` + +Connect the Chia VDF ASIC device and verify that it is detected: +```bash +# in chiavdf/src/ directory +LD_LIBRARY_PATH=hw/libft4222/build-x86_64 ./hw_vdf_client --list +``` + +If the device is shown in the list, check if it's working: +```bash +LD_LIBRARY_PATH=hw/libft4222/build-x86_64 ./hw_test +``` + +Output should contain lines similar to the following: +``` +VDF 0: 1000000 HW iters done in 2s, HW speed: 714720 ips +``` + +## Running + +You should have a Chia full node running and synced. + +Start timelord (but not timelord-launcher) in chia-blockchain: +```bash +chia start timelord-only +``` + +Start hardware VDF client (`8000` specifies timelord's port number): +```bash +# in chiavdf/src/ directory +LD_LIBRARY_PATH=hw/libft4222/build-x86_64 ./hw_vdf_client 8000 +``` + +The VDF client accepts a number of options: +``` +Usage: ./hw_vdf_client [OPTIONS] PORT [N_VDFS] +List of options [default, min - max]: + --freq N - set ASIC frequency [1100, 200 - 2200] + --voltage N - set board voltage [0.88, 0.7 - 1.0] + --ip A.B.C.D - timelord IP address [localhost] + Allows connecting to a timelord running on a remote host. Useful when running multiple machines with VDF hardware connecting to a single timelord. + --vdfs-mask N - mask for enabling VDF engines [7, 1 - 7] + The ASIC has 3 VDF engines numbered 0, 1, 2. If not running all 3 engines, the mask can be specified to enable specific engines. It must be the result of bitwise OR of the engine bits (1, 2, 4 for engines 0, 1, 2). + --vdf-threads N - number of software threads per VDF engine [4, 2 - 64] + Number of software threads computing intermediate values and proofs per VDF engine. + --proof-threads N - number of proof threads per VDF engine + Number of software threads only computing proofs per VDF engine. Must be less than --vdf-threads. + --auto-freq-period N - auto-adjust frequency every N seconds [0, 10 - inf] + --list - list available devices and exit +``` + +## Shutting down + +Stop timelord: +```bash +chia stop timelord-only +``` + +Stop the VDF client by pressing Control-C or killing the process with `SIGTERM`. diff --git a/src/hw/readme.txt b/src/hw/readme.txt deleted file mode 100644 index e9e7445a..00000000 --- a/src/hw/readme.txt +++ /dev/null @@ -1,84 +0,0 @@ -Build instructions: - -Start in the top dir of 'chiavdf' repo. - -cd src/hw -# create symlink to libftd2xx package -ln -s ../../path/to/libftd2xx -cd .. -make -f Makefile.vdf-client emu_hw_main hw_main emu_hw_vdf_client hw_vdf_client - ---- - -Running with emulated HW: -./emu_hw_main 3 100000 - -Running with real HW: -./hw_main 3 1000000 - -The arguments are the number of VDF engines (1, 2 or 3) and the number of iterations to run. - ---- - -To run with an emulated timelord, first build 'chiavdf' Python module: -# start in the top chiavdf directory -python3 setup.py build - -Start emulated timelord (replace 3.7 in directory name if your Python version is not 3.7): -PYTHONPATH=build/lib.linux-x86_64-3.7 python3 src/tl_emu.py - -Start VDF client in another terminal (8000 is the TCP port number): -./hw_vdf_client 8000 - -Alternatively, run with the emulated HW: -./emu_hw_vdf_client 8000 - ---- - -To run the hardware VDF client with a Chia timelord in testnet: - -Install Chia blockchain (skip the GUI part as it won't be needed): -https://github.com/Chia-Network/chia-blockchain/wiki/INSTALL - -Configure testnet10 (or a different testnet as needed): -https://github.com/Chia-Network/chia-blockchain/wiki/How-to-Connect-to-the-Testnet - -Start a local full node (in chia-blockchain directory; Python venv should be already activated): -chia start node - -Change log level in config file (it is likely located in ~/.chia/mainnet/config/config.yaml): -... - log_level: INFO - -Start timelord (in chia-blockchain directory): -chia start timelord-only - -Start HW VDF client (in chiavdf/src directory): -./hw_vdf_client 8000 - -Watch timelord logs, the following lines would indicate the proofs are coming: -tail -f ~/.chia/mainnet/log/debug.log -... -2023-02-10T17:54:46.719 timelord chia.timelord.timelord : INFO Finished PoT chall:627fdf36c81a1399393f.. 1720038 iters, Estimated IPS: 53739.7, Chain: Chain.CHALLENGE_CHAIN -2023-02-10T17:54:48.581 timelord chia.timelord.timelord : INFO Finished PoT chall:7ea19c8a61ee0691c1d6.. 1720038 iters, Estimated IPS: 50785.0, Chain: Chain.REWARD_CHAIN - -To stop running hardware VDF client and timelord, first stop the VDF client using Ctrl-C, then shut down the timelord: -chia stop timelord-only - ---- - -Arguments and options for hw_vdf_client and emu_hw_vdf_client: - -Usage: ./hw_vdf_client [OPTIONS] PORT [N_VDFS] -List of options [default, min - max]: - --freq N - set ASIC frequency [1100, 200 - 2200] - --voltage N - set board voltage [0.88, 0.7 - 1.0] - --ip A.B.C.D - timelord IP address [localhost] - Allows connecting to a timelord running on a remote host. Useful when running multiple machines with VDF hardware connecting to a single timelord. - --vdfs-mask - mask for enabling VDF engines [7, 1 - 7] - The ASIC has 3 VDF engines numbered 0, 1, 2. If not running all 3 engines, the mask can be specified to enable specific engines. It must be the result of bitwise OR of the engine bits (1, 2, 4 for engines 0, 1, 2). - --vdf-threads N - number of software threads per VDF engine [4, 2 - 28] - Number of software threads computing intermediate values and proofs per VDF engine. - --proof-threads N - number of proof threads per VDF engine - Number of software threads only computing proofs per VDF engine. Must be less than --vdf-threads. - --list - list available devices