The SolanaSDK project integrates the Solana blockchain into Unreal Engine, providing seamless blockchain-based functionalities such as:
- Wallet creation and management
- SOL transfers
- Token creation and management
- Retrieving token balances
- Direct interaction with Solana blockchain features
This project includes a custom plugin called SolanaPlugin
to simplify blockchain operations within Unreal Engine.
The project adheres to Unreal Engine's standard folder structure, with the addition of the SolanaPlugin
under the Plugins
directory.
SolanaSDK/
├── Config/ # Configuration files for the project
├── Content/ # Game assets such as Blueprints, UI, and media
├── Plugins/
│ └── SolanaPlugin/
│ ├── Content/ # Example assets and Blueprints for the plugin
│ ├── Resources/ # Icon and metadata files for the plugin
│ ├── Source/ # Plugin source files
│ │ ├── Private/ # Private C++ source files
│ │ │ ├── SolanaManager.cpp
│ │ │ └── Other implementation files
│ │ ├── Public/ # Public header files
│ │ │ ├── SolanaManager.h
│ │ │ └── Other public headers
│ │ ├── ThirdParty/ # External SDKs and dependencies
│ │ │ ├── solana_sdk.h # Solana SDK header
│ │ │ ├── libsolana_c_sdk.dylib # Precompiled Solana SDK binary
│ │ │ └── Additional headers/libraries
│ │ └── SolanaPlugin.Build.cs
│ └── SolanaPlugin.uplugin # Plugin descriptor file
├── Saved/ # Auto-saved files
└── YourProject.uproject # Unreal Engine project descriptor
The SolanaPlugin
is a custom Unreal Engine plugin designed to interact with the Solana blockchain. It provides:
- Wallet Management: Create, load, and save wallets.
- SOL Transfers: Send SOL to other wallets.
- Token Management: Create SPL tokens and manage associated token accounts.
- Token Balances: Retrieve balances for SOL and SPL tokens.
- Blueprint Integration: Easy-to-use Blueprint nodes for blockchain operations.
Follow these steps to run the project:
- Clone or download the repository to your local machine.
- Open the project in Unreal Engine by double-clicking the
YourProject.uproject
file.
- Ensure you have the required C++ development environment set up for Unreal Engine.
- Click Tools > Generate Visual Studio Code Project Files (or equivalent for your platform).
- Open the generated project in your IDE (e.g., Visual Studio, Xcode).
- Build the project to ensure all dependencies and plugins compile successfully.
Examples are available in the Content
folder under Plugins/SolanaPlugin/Content
.
- Drag your Blueprint from the
Plugins/SolanaPlugin/Content/Blueprints
into the level. - Or Open the Solana Level in
Plugins/SolanaPlugin/Content/Maps
- Click the Play button in the Unreal Engine Editor to test the blockchain interactions in your game.
- Navigate to the
Plugins/SolanaPlugin
directory in this project.
- Copy the entire
SolanaPlugin
folder (includingSource
,Content
, andResources
).
- Paste the
SolanaPlugin
folder into thePlugins
folder of your target Unreal Engine project.- If the
Plugins
folder doesn’t exist, create it in the root of your target project directory.
- If the
- Open your target project in Unreal Engine.
- Go to Edit > Plugins.
- Search for
SolanaPlugin
in the list of installed plugins. - Enable the plugin and restart the project if prompted.
- After restarting, navigate to the Blueprint Editor.
- Look for Solana-related Blueprint nodes such as
CreateWallet
,TransferSOL
, orGetBalance
.
- Create Wallet: Use the
CreateWallet
Blueprint node or the corresponding C++ function. - Save/Load Wallets: Save the wallet to a file or load an existing one using the provided nodes.
- Use the
TransferSOL
Blueprint node to send SOL to another wallet. - Input the recipient address and the amount (in lamports).
- Use the
GetBalance
node to fetch the balance of a wallet.
- Create SPL Tokens: Use the
CreateSPLToken
function to create new tokens. - Mint Tokens: Mint SPL tokens to a wallet.
- Fetch Token Balances: Retrieve associated token balances.
If you need to rebuild the plugin or add features:
- Modify the source files in
Source/SolanaPlugin
. - Ensure platform-specific binaries (e.g.,
.dylib
,.dll
) are in theThirdParty
directory. - Rebuild the plugin using Unreal Engine's build tools.
The solana_sdk.h
and libsolana_c_sdk.dylib
files is generated from solana-c-sdk
Contributions are welcome! To contribute:
- Fork this repository.
- Create a new branch for your feature or bug fix:
git checkout -b feature/your-feature
- Commit your changes:
git commit -m "Add new feature"
- Push to your branch:
git push origin feature/your-feature
- Open a pull request with a detailed description of your changes.
This project is licensed under the MIT License.
- Solana for its blockchain technology.
- Unreal Engine community for development support.
- Open-source contributors for their libraries and tools.