The Enjin Wallet Daemon provides a streamlined process for signing blockchain transactions, enabling seamless and efficient transactions between your game and the blockchain. This tool creates a persistent bridge between your game and the blockchain, ensuring a fluid gaming experience for players.
In the Enjin Platform context, the Wallet Daemon is a utility tool that manages a blockchain wallet address associated with an Enjin Blockchain account. When a transaction is initiated on the Enjin Platform, the Wallet Daemon receives the transaction, signs it, and sends it back to the platform. This ensures secure and efficient transaction processing for Enjin Platform users.
The diagram above provides insight into the interaction between the Enjin Wallet Daemon and the Enjin Platform. This illustrates how the Wallet Daemon can communicate with the API in both directions, automatically signing and broadcasting transactions to the blockchain. This helps developers better understand how the two components work together seamlessly to provide a streamlined experience.
The diagram above depicts the various stages involved in creating a new collection on the Enjin Matrixchain via the Enjin Platform API, with a particular emphasis on the Wallet Daemon events.
- Establish a WebSocket connection - Connect to a WebSocket server to subscribe to channels that receive events.
- Subscribe to a WebSocket channel - Subscribe to the channel associated with your wallet to receive real-time events.
- Send a mutation - Send a "CreateCollection" mutation to the Enjin Platform API to create a new collection on the Enjin Matrixchain. The API will encode the transaction that the wallet daemon needs to sign and save it in the Enjin Platform Database.
- Wallet daemon requests pending transactions - The wallet daemon repeatedly asks the Enjin Platform API if there are any transactions to sign to prevent incoming connections to the wallet daemon, which holds your Private Key.
- Sign and broadcast the transaction - After receiving the pending transaction, the wallet daemon signs it with your private key and broadcasts it to the Enjin Matrixchain.
- Enjin Matrixchain processes the transaction - If everything is correct and valid, the Matrixchain successfully processes the extrinsic sent by the wallet daemon, and the new collection is created.
- Enjin Platform API monitors the chain - The Enjin Platform API continually watches the chain via a WebSocket connection to detect any activity.
- Save the data to the database - The Enjin Platform API stores the new collection data in its own database, allowing you to query it as desired.
- Emit an event - The Enjin Platform API sends an event to the WebSocket channels, providing you with the opportunity to take appropriate actions if you're subscribed to the relevant channel.
There are two approaches for running the Wallet Daemon:
Choosing the Right Approach for Running the Wallet Daemon
There are two ways to run the Wallet Daemon, each suitable for different user profiles and use cases:
Executable Approach: This method involves running a simple executable, configuring it via a user interface, and clicking 'Run' to start it. It is the most straightforward approach and is recommended for beginners or those who are not developers. Learn how to set it up in our Setting up Wallet Daemon using Executable guide.
Docker Approach: This method involves cloning a GitHub repository and modifying the configuration files. It offers more flexibility and control, making it suitable for developers and for production use. Learn how to set it up in our Setting up Wallet Daemon using Docker guide.
Choose the approach that best fits your technical proficiency and the needs of your project.
Setting up the Wallet Daemon Executable is a straight forward process.
Download the latest version of the Wallet Daemon from GitHub, extract it, and run the
enjin_wallet_daemon.exe executable file.
Follow the on-screen instructions to set it up and make sure to insert your Enjin Platform API Token from your account settings page.
Code repository: https://github.com/enjin/platform
It is recommended that the Enjin Wallet Daemon is installed and ran in isolation. This means running it on a dedicated server. The daemon itself is incredibly light-weight and does not require any extensive resources.
Have Docker installed?
If you don't have Docker installed, please review the Platform Local Installation Guide for more information.
You can do this by first cloning the
enjin/platform repository from GitHub with the submodules:
git clone --recurse-submodules https://github.com/enjin/platform.git
You will want to update the
configs/daemon/.env file with the
PLATFORM_KEY (which is an API Token generated within the Settings page of the Enjin Platform Cloud). In addition to this, you'll want to specify a unique
KEY_PASSis immutable. It is directly used to derive the wallet private key. Choose something unique and make sure to backup this
KEY_PASSin a secure manner.
The final configuration is to update the
configs/daemon/config.json file to communicate with either the Enjin Blockchain (mainnet) or Canary Blockchain (testnet). You can do this by updating the node property in the JSON file. You can find an example of both networks below.
Finally, you can spin up the daemon using the following command from the platform directory:
docker compose up -d daemon
Updated 9 days ago