@@ -29,45 +29,97 @@ Other apps are [Bolt](https://bolt.holdings/), a wallet that is very secure with
2929
3030## Installation
3131
32- ### Supported Platforms
33-
3432This repository currently supports the following platforms:
3533
3634- Mac OSX Mojave 10.14.5 or Above
3735- Linux (Ubuntu/bionic): This includes all Ubuntu 18+ platforms, so Ubuntu 19, Linux Mint 19 etc. (apt based package installer)
3836- Linux (RHEL/CENTOS 7+): All Releases based on RHEL 7+, Centos 7+, Fedora 30 etc. (yum based package installer)
3937
40- ### Instructions
41-
42- - Go is required to build gosdk code. Instructions can be found [ here] ( https://go.dev/doc/install )
38+ ### Step 1: Create a New Project Folder
39+ Open your terminal and run:
40+ ``` bash
41+ mkdir zus-go-demo
42+ cd zus-go-demo
43+ ```
44+ This creates and enters a new folder named ` zus-go-demo ` .
4345
44- 1 . Save below code as ` sdkversion.go `
46+ ### Step 2: Initialize a Go Module
47+ Run:
48+ ``` bash
49+ go mod init zus-go-demo
50+ ```
51+ This creates a ` go.mod ` file that declares this folder as a Go module. You'll use this file to track dependencies like the Züs SDK.
4552
46- package main
53+ If you are using VS Code, you can use the ` code ` CLI command to open the folder:
54+ ``` bash
55+ code .
56+ ```
57+ If not, open VS Code manually and open the ` zus-go-demo ` folder from the File menu.
4758
48- import (
49- "fmt"
59+ ### Step 3: Install Züs SDK from staging Branch
60+ In your terminal:
61+ ``` bash
62+ go get github.com/0chain/gosdk@staging
63+ ```
64+ This tells Go to pull the latest code from the ` staging ` branch of the SDK repo.
5065
51- "github.com/0chain/gosdk/zcncore"
52- )
66+ ** Expected output:**
67+ ```
68+ go: added github.com/0chain/gosdk v1.8.18-0.20230901213317-53d640a9b7f9
69+ ```
70+ This is a pseudo-version that references a specific commit on the ` staging ` branch.
5371
54- func main() {
55- fmt.Println("gosdk version: ", zcncore.GetVersion())
56- }
72+ ### Step 4: Create Your ` main.go ` File
73+ In the root of ` zus-go-demo ` , create a file named ` main.go ` and paste this:
74+ ``` go
75+ package main
5776
58- 2 . Run below command: (if you don't have gosdk already in your GOPATH)
77+ import (
78+ " fmt"
5979
60- go get github.com/0chain/gosdk
80+ " github.com/0chain/gosdk/zcncore"
81+ )
6182
62- 3 . Build the sample application sdkversion
83+ func main () {
84+ fmt.Println (" Züs Go SDK is ready!" )
85+ fmt.Println (" SDK Version:" , zcncore.GetVersion ())
86+ }
87+ ```
88+ This imports the SDK and prints its version.
6389
64- go build -o sdkversion sdkversion.go
90+ ### Step 5: Tidy Up Your Dependencies
91+ Run:
92+ ``` bash
93+ go mod tidy
94+ ```
95+ This cleans up the ` go.mod ` and ` go.sum ` files by removing unused and downloading used dependencies.
6596
66- 4 . Run the executable
97+ If you hadn’t imported anything yet, you might see a warning like:
98+ ```
99+ go: warning: "all" matched no packages
100+ ```
101+ If you see a missing ` go.sum ` entry error (e.g., after importing packages), and ` go mod tidy ` does not fetch dependencies, try:
102+ ``` bash
103+ go mod tidy -e
104+ ```
105+ The ` -e ` flag tells Go to continue downloading even if errors are detected.
67106
68- ./sdkversion
107+ ### Step 6: Run Your Project
108+ Run the Go file:
109+ ``` bash
110+ go run main.go
111+ ```
112+ This confirms that the SDK is installed, imported, and running.
69113
70- 5 . If it prints the gosdk version installed then setup is complete.
114+ Alternatively, you can build the sample application:
115+ ``` bash
116+ go build -o main main.go
117+ ```
118+ Run the executable:
119+ ``` bash
120+ ./main
121+ ```
122+ If the GoSDK version is printed successfully, the installation is complete.
71123
72124## Mobile Builds
73125
0 commit comments