一. Environmental preparation

commander machine requires version of golang 1.20 or above. And worker machine is based on Ubuntu 2004/2204 system, not only with golang 1.20,but also the installation of OpenSSL library to run the chip driver.
down miner:

git clone https://github.com/utnet-org/uminer

二. compile and start miner service

1. compile and start commander machine

enter./miner-server, take this as root directory
if the commander machine don't possess the chip and driver environment, two files needed to be modified:./api/chipApi/burn.go && sign.go, make notation of the driver function, changing to a pseudo function with the same name to assure the compilation pass. img.png proceed to other command execution:

# run the golang dependence
go mod tidy
# On Ubuntu, use apt to install:
sudo apt-get install protobuf-compiler
# On macOS, use Homebrew to install:
brew install protobuf
# install protoc-gen-go
go install google.golang.org/protobuf/cmd/protoc-gen-go
# add PATH
export PATH=$PATH:$GOPATH/bin
# run chip gprc service:enter ./api/chipApi/rpc,and run:
protoc --go_out=. --go-grpc_out=. ./chip.proto 
# do similar operation to all the rest of chainApi and containerApi
# run server gprc service:enter./serverConf, and run:
protoc --go_out=. --go-grpc_out=. ./conf.proto 
# compile commander主程序:enter./cmd/run, and compile:
go build -o ../commanderserver
# commanderserver.sh will be compiled at ./cmd,do execute:
../commanderserver --serverip=addr --workerip=addr1,addr2,... --node=addr0 startcommander
# the meaning of configuration is shown: addr is the ip address of commander machine,addr1,addr2,...is the worker address communicated by commander,addr0 is the address of node.
# now the commander machine is working functionally.

2. compile and start worker machine

note:worker machine is the one equipped with computation TPU chips,and commander machine will coordinate with worker,node and container cloud server. They are essentially different, commander does not have to hold chips. worker机的任务仅仅只是执行和芯片驱动有关的任务,如烧录,产生密钥和签名。

# enter./bm_chip, take it as root directory

# enter ./src and run:
g++ -shared -o libchip.so *.cpp ../bmlib/src/*.cpp ../bmlib/src/linux/*.cpp ../common/bm1684/src/common.c -I../bmlib/include -I../bmlib/src/linux -I../common/bm1684/include -I../config -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib -lssl -lcrypto -fPIC
# it generates the lipchip.so file under the same directory,make a copy to the following position:
cp ./libchip.so /usr/lib/ (or cp ./libchip.so /usr/local/lib/)

# leave the bm_chip, back to miner-server root directory,and compile the go file same as when activating commander,change the name of executable file:
go build -o ../workerserver
# workerserver.sh will be compiled at ./cmd,do execute:
../workerserver --serverip=addr startworker
# only a configuration of "addr" is needed for the ip address of worker machine, and now the worker machine is working functionally.