# README
Decentralized Storage System
Prerequisite
-
Install Golang (version 1.20.3)
-
Install gRPC
How to Run
git clone https://github.com/xuyangm/fabric-samples.git
If the following error is reported:
GnuTLS recv error (-110): The TLS connection was non-properly terminated.
Solve it using:
sudo apt-get install gnutls-bin
git config --global http.sslVerify false
git config --global http.postBuffer 1048576000
-
curl -sSLO https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh && chmod +x install-fabric.sh
-
./install-fabric.sh b d
(fabric-version: 2.5.0 fabric-ca-version: 1.5.6) -
cd fabric-samples/test-network
-
./network.sh up createChannel -c mychannel -ca
-
./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go/ -ccl go
-
cd ../asset-transfer-basic/my-application/
-
go mod init
-
go mod tidy
-
go build boost.go
-
./boost
(use ./boost -h to see help message) -
Build applications:
go build chunk_storage_service.go
go build file_partition_service.go storage_object.go
go build store_file.go
go build request_file.go storage_object.go
- Start chunk_storage_service and file_partition_service respectively.
Terminal 1 (Use ./chunk_storage_service -h to see help):
./chunk_storage_service
Terminal 2 (Use ./file_partition_service -h to see help):
./file_partition_service
- To store a file (Use ./store_file -h to see help):
./store_file
The file hash will be shown on the terminal. The chunks are stored in the folders named "memory1" and "memory2".
- To request a file (Use ./request_file -h to see help):
./request_file -hash="REPLACE_WITH_THE_ACTUAL_FILE_HASH"
The output is stored as a file named "out".
- Stop network:
cd ../../test-network
./network.sh down
- Quick test:
./file_partition_service
./chunk_storage_service -port=":50052"
./chunk_storage_service -port=":50053"
./chunk_storage_service -port=":50054"
./store_file
./request_file -hash="xxx"
diff in out