This project aims to create a custom virtual machine using the HyperSDK framework to facilitate minting and transferring tokens. It enables users to build a tailored blockchain solution that supports token creation, asset transfer, and trading via order books.
The goal is to provide a streamlined process for developers looking to implement blockchain features into their applications, leveraging the power of HyperSDK for scalability and customization.
Ensure the following tools are installed before proceeding:
-
WSL (Windows Subsystem for Linux):
- This project is developed using Ubuntu on WSL.
-
Go Programming Language:
- Install Go using the following command:
sudo snap install go --classic
- Verify the installation:
go version
- Install Go using the following command:
-
GCC (GNU Compiler Collection):
- Install GCC on WSL:
sudo apt update sudo apt install build-essential
- Verify the installation:
gcc --version
- Install GCC on WSL:
-
Clone the repository:
git clone https://github.com/jasrotia15/Create-a-Custom-Subnet.git
-
Open the repository in VS Code:
- From the Ubuntu terminal, run:
code .
- From the Ubuntu terminal, run:
-
Install dependencies:
- Open a terminal in VS Code and run:
go mod tidy
- Open a terminal in VS Code and run:
-
Ensure Go is in your system PATH:
- Run:
export PATH=$PATH:$(go env GOPATH)/bin
- If this doesn’t work, try:
export PATH=$PATH:/usr/local/go/bin
- Run:
-
Launch the Subnet:
MODE="run-single" ./scripts/run.sh
Note: This process may take a few minutes.
-
Build the project:
./scripts/build.sh
- The compiled CLI will be available at
./build/token-cli
.
- The compiled CLI will be available at
-
Import the demo private key:
./build/token-cli key import demo.pk ./build/token-cli chain import-anr
-
Interact with the HyperChain:
- Create an asset:
./build/token-cli action create-asset
- Mint your asset:
./build/token-cli action mint-asset
- View account balance:
./build/token-cli key balance
- Transfer tokens:
./build/token-cli action transfer
- Create an order:
./build/token-cli action create-order
- Fill an order:
./build/token-cli action fill-order
- Close an order:
./build/token-cli action close-order
- Create an asset:
Here are some common issues you might encounter while running the project and how to resolve them:
-
Issue: Go command not recognized.
Solution: Ensure that Go is properly installed and that the correct PATH is set. Run:export PATH=$PATH:/usr/local/go/bin
-
Issue: Network issues when launching the subnet.
Solution: Check that all necessary dependencies are installed, and ensure no conflicting processes are running. Try stopping all processes:killall avalanche-network-runner
-
Issue: Build script fails.
Solution: Make sure all dependencies are installed by running:go mod tidy
Watch real-time on-chain activity by running:
./build/token-cli chain watch
We welcome contributions from the community! Here's how you can contribute:
- Fork the Repository: Create a fork of the repository to make your changes.
- Create a Branch: Make a new branch for your changes:
git checkout -b feature/your-feature-name
- Submit a Pull Request: Once your changes are ready, submit a pull request for review.
- Ensure Code Quality: Follow coding standards and best practices. Check for issues using linters and run all tests before submitting.
Feel free to open an issue if you encounter bugs or have suggestions for enhancements.
This project is licensed under the MIT License. See the LICENSE file for more details.
This project is based on the TokenVM. Special thanks to the Metacrafters team for their contributions to the blockchain community.