Prerequisites - SpaceXpanse/Documentation GitHub Wiki
Prerequisites
In order to develop games using the SpaceXpanse platform you'll need a SpaceXpanse wallet or spacexpansed and some ROD (mainnet, testnet, or regtestnet ROD are all fine). You'll also need to have your wallet properly configured.
You will also need libspex. This is part of the Game State Processor (GSP). See below for more information.
Get a Wallet
There are 4 SpaceXpanse wallet distributions.
- SpaceXpanse Electron wallet for Windows
- SpaceXpanse QT wallet for Windows
- SpaceXpanse QT wallet for Linux
- SpaceXpanse QT wallet for Mac OS X
When you first run them, they need to download and sync the blockchain. This can take some time and largely depends on your network connection.
About the Electron Wallet
The SpaceXpanse Electron wallet is designed for gaming. Out-of-the-box it comes preconfigured for games with all the proper flags. This is the easiest option.
Further, the Electron wallet contains 2 distinct wallets:
- game.dat: Has no password. Meant for storing smaller amounts of ROD to play games
- vault.dat: Is password protected. Meant for storing larger amounts of ROD
Refer to the Wallets section of the SpaceXpanse Electron Help documentation for a more in depth description.
However, even if you do choose to use the Electron wallet, you should still download the QT wallet as it has some important tools that you'll enjoy using.
About the QT Wallets
The QT wallets are all standard wallets and very similar to the Bitcoin Core QT wallet. There aren't any significant differences between the Windows, Linux, and Mac OS X distributions.
If you choose to use a QT wallet during development, you can refer to the Bitcoin Core help for those parts that are common to both SpaceXpanse and Bitcoin.
You can also get help through the SpaceXpanse QT console by typing "help" or "help <command>".
Startup Flags
However, when you run the QT wallet, you must set several flags or you won't be able to connect to it. Run the QT wallet or spacexpansed with these flags (note that datadir is optional):
- -wallet=vault.dat: Loads the vault.dat wallet
- -wallet=game.dat: Loads the game.dat wallet
- -server: Sets spacexpansed to run as a server
- -rpcallowip=127.0.0.1: The IP to allow RPC calls on
- -datadir=<DataDirPath>: OPTIONAL Changes the default data directory to the one specified
- -zmqpubhashtx=tcp://127.0.0.1:28332: See below
- -zmqpubhashblock=tcp://127.0.0.1:28332: See below
- -zmqpubrawblock=tcp://127.0.0.1:28332: See below
- -zmqpubrawtx=tcp://127.0.0.1:28332: See below
- -zmqpubgameblocks=tcp://127.0.0.1:28332: See below
For information about the ZeroMQ flags, refer to the Bitcoin documentation on it here.
By default, the wallet runs on mainnet. If you wish to use testnet or regtestnet, you can use 1 of these flags (but not both).
- -testnet
- -regtest
spacexpanse.conf
You can also set those flags in the spacexpanse.conf file. It resides in the SpaceXpanse data directory. You can read more about the data directory in this Bitcoin documentation; the only difference is changing "Bitcoin" to "SpaceXpanse" in the path.
The configurations are the same as above, except you remove the "-" (dash). Use 1 per line.
SpaceXpanse QT Toolkit
The SpaceXpanse QT wallet download includes useful tools that will make your life much easier and more enjoyable.
The SpaceXpanse Command Line Interface (CLI), spacexpanse-cli, is very useful for running commands quickly. You can think of this as a more convenient version of the QT wallet's console.
Here's a quick tutorial on spacexpanse-cli that you may wish to read later.
About spacexpansed
spacexpansed is the core daemon and where the "work" is done. The QT wallet is just a convenient GUI for it.
Get Some ROD
You can develop your game using testnet or regtestnet, in which case you don't need to purchase any real ROD.
For testnet ROD, you can mine some yourself or you can contact us to send you some.
For regtestnet ROD, you must mine this yourself. Find out more about regtestnet here.
Both testnet and regtestnet are free, but at some point you will want to run your game on mainnet. You can purchase ROD on an exchange. See the SpaceXpanse website for more information.
libspex
The libspex daemon does much of the heavy lifting that blockchain programming requires. There are several places to look for it. Click any of the following for what you need. If you have questions, you can check a tutorial or post in the Development forum.
- libspex: The C++ source code
- libspex_wrapper: A wrapper for libspex. Creates a statically linked library for Windows
- Precompiled binaries for Windows: Statically linked library with all its dependencies
- SpaceXpanseWrapper: A C# project that wraps the libspex DLL
You don't need to decide on this right now, but you will need to download whichever option you need when it comes time to start coding.
For information on GSPs and how libspex relates to the SpaceXpanse daemon and your game, see libspex Component Relationships
RPC and JSON libraries
Creating a game with SpaceXpanse involves a great deal of RPC calls and using JSON. You may wish to use existing libraries rather than roll your own. Whichever you choose is entirely up to you.