2a. TEE Miners
Tee-worker is the Masa component to scrape data from a secure TEE enclave. It uses the ego framework to build, run and sign the binary.
Hardware Prerequisites
Required Hardware
🔒 Intel SGX Support
- Intel SGX 2.0+ enabled CPU required
- Hardware-level security enclave
- Secure computation environment
💻 Compatible Processors
- 11th Gen+ Intel Core series
- Modern Intel Xeon processors
- Must have SGX feature enabled in BIOS
Verify your CPU supports Intel SGX 2.0 or higher before setting up mining operations. The SGX feature must also be enabled in your system BIOS.
Cloud Provider Recommendations
For optimal TEE mining performance and reliability, we recommend using Microsoft Azure. This provider has been extensively tested and validated by our team to ensure seamless compatibility with Masa Network’s TEE mining requirements:
Microsoft Azure
✓ Offers SGX-enabled virtual machines
✓ Proven reliability for TEE workloads
✓ Validated for Masa Network mining
✓ Our recommended provider
Alibaba Cloud
✗ Not supported for TEE mining
✗ Uses outdated SGX API (v3)
✗ Incompatible with Masa requirements
✗ Please use Azure or other validated providers
Azure instance capacity planning
When running TEE miners on Azure, it’s important to understand the capacity limits to optimize costs and performance. Here’s what we’ve validated:
Instance Specifications
Standard DC4s v2
- 4 vCPUs
- 16 GiB Memory
- SGX-enabled
Miner Capacity
- Maximum 4 TEE miners per instance
- 1 miner per vCPU recommended
- Attempting to run >4 miners causes automatic termination
To optimize costs, you can run multiple miners on a single Azure instance as long as you stay within the vCPU limits. This approach is more cost-effective than running individual instances for each miner.
System Setup & Configuration
Prerequisites
Before starting TEE mining operations, ensure you have:
Docker Setup
✓ Docker installed and running
✓ Permissions to run containers
Network Keys
✓ BTCLI to installation to manage your wallet
✓ Generate coldkey and hotkey mnemonics and register your miner
Installing the Bittensor BTCLI
Installing the Bittensor BTCLI
To install the BTCLI please follow the Bittensor BTCLI docs.
To install the BTCLI please follow the Bittensor BTCLI docs.
Note that there is limited support for Windows at the moment. We recommend using WSL2 to run the BTCLI. Please reference the Bittensor CLI where it covers windows installation here.
Installing Docker
Installing Docker
To install Docker, follow these steps:
Linux:
After running these commands, restart your system for the changes to take effect.
Verify installation by running:
To install Docker, follow these steps:
Linux:
After running these commands, restart your system for the changes to take effect.
Verify installation by running:
For windows users, we recommend using WSL2 to run Docker. Please reference the Docker docs where it covers windows installation here. Then use the linux instructions above to install docker.
Generate coldkey and hotkey mnemonics and register your miner
Generate coldkey and hotkey mnemonics and register your miner
Creating your wallet mnemonics and register your miner
Follow these steps to create your wallet keys and register as a miner on the network. You’ll need to generate both a coldkey (for secure storage) and hotkey (for active mining operations).
Create a Cold Wallet
First, create a cold wallet for your miner
:
Create a Hot Wallet
Next, create a hot wallet for your cold wallet:
Make sure to use the same wallet name (miner) that you used in Step 1.
Verify Your Wallets
Finally, verify that both wallets were created successfully:
You should see your miner
wallet listed, along with its associated hotkey (default
).
Keep your wallet passwords safe! You’ll need them for future operations.
Register Your Node
Register your node as a miner on the subnet:
- Configure your node as a miner
- Set up the necessary network connections
Verify Registration
Check that your miner is properly registered on the subnet:
This command will display the subnet metagraph, showing:
- All registered nodes and their roles
- Your miner’s status and registration
- Current network topology
Look for your hotkey address in the output to confirm successful registration. If you don’t see your node listed, wait a few minutes and try again.
Keep your coldkey and hotkey mnemonics secure and backed up. These are required for mining operations and cannot be recovered if lost.
Subnet 42 TEE worker setup
To begin mining on Subnet 42, follow these steps to set up your TEE worker:
Clone Repository
First, clone the Subnet 42 repository which contains the TEE mining software:
Navigate to Directory
Change into the repository directory:
Copy Environment File
Create your environment configuration file:
Edit Environment File
Configure your .env file by updating the following fields:
- Your coldkey mnemonic from wallet creation
- Your hotkey mnemonic from wallet creation
- Your role (miner or validator)
- Your machine’s public IP address and port by default:8091 and 8080
- Network UID (165 for testnet, 42 for mainnet)
- Network name (test or finney) finney is for mainnet.
- Telemetry Result Worker Address (This is the address of the telemetry result worker)
- A comma separated list of twitter credentials to use if you want to scrape twitter data
- A comma separated list of twitter Bearer API tokens to use. Takes precedence over TWITTER_ACCOUNTS. This is the most reliable way to scrape twitter data.
- CAPABILITIES: A comma-separated list of capabilities your miner supports via credentials and/or API keys.
What capabilities can miners support for X/Twitter data access and how do I configure them?
What capabilities can miners support for X/Twitter data access and how do I configure them?
Miners should declare the capabilities their node supports in the .env
file, either by listing specific capabilities or using all
to enable all capabilities:
The table below outlines which capabilities are supported by different access types, add each one if you re not using ‘all’.
Example of how to add the CAPABILITIES=“searchbyquery,searchbyfullarchive” to the .env file:
Capability | Base API | Pro API | Credentials |
---|---|---|---|
all | ✅ Yes | ✅ Yes | ✅ Yes |
searchbyquery | ✅ Yes | ✅ Yes | ✅ Yes |
searchbyfullarchive | ❌ No | ✅ Yes | ✅ Yes |
searchbyprofile | ❌ No | ✅ Yes | ✅ Yes |
searchfollowers | ❌ No | ❌ No | ✅ Yes |
getbyid | ❌ No | ❌ No | ✅ Yes |
getreplies | ❌ No | ❌ No | ✅ Yes |
getretweeters | ❌ No | ❌ No | ✅ Yes |
gettweets | ❌ No | ❌ No | ✅ Yes |
getmedia | ❌ No | ❌ No | ✅ Yes |
gethometweets | ❌ No | ❌ No | ✅ Yes |
getforyoutweets | ❌ No | ❌ No | ✅ Yes |
getbookmarks | ❌ No | ❌ No | ✅ Yes |
getprofilebyid | ❌ No | ❌ No | ✅ Yes |
gettrends | ❌ No | ❌ No | ✅ Yes |
getfollowing | ❌ No | ❌ No | ✅ Yes |
getfollowers | ❌ No | ❌ No | ✅ Yes |
getspace | ❌ No | ❌ No | ✅ Yes |
getspaces | ❌ No | ❌ No | ✅ Yes |
Example .env file
The .env file comes pre-configured for the Subnet 165 testnet environment. No additional network configuration is needed.
When running multiple miners on one instance, you will need to create separate configuration files for each miner. Each config file should have unique settings like ports and wallet keys to avoid conflicts between miners.
Start Your Node
Start your node with Docker Compose based on your configured role:
For miners:
This will:
- Launch the required containers for your node type
- Initialize your miner node
- Connect to the subnet network
Verify TEE Worker
Once your TEE miner is running on Subnet 42, you can verify its setup and performance using the TEE Worker Status Dashboard:
- Visit TEE Worker status dashboard
- Enter your TEE Worker address (e.g. https://<your-ip-address>:8080)
- The tool will display:
- Connection status to your TEE Worker
- Telemetry data including:
- Boot time and last operation timestamp
- Number of Twitter scrapes performed
- Total tweets returned
- Worker capabilities report
- X/Twitter integration test results
Ensure your worker reports all expected capabilities. Missing capabilities may reduce your potential rewards in the network.
If you see “No Capabilities Reported”, verify that your TEE worker is properly initialized and that all required environment variables are correctly set in your .env file.
Monitor Logs
Monitor your miner’s logs to ensure everything is running properly:
To see TEE worker logs:
To see miner or validator logs:
Watch for:
- Successful network connections
- Mining activity
- Any potential errors or warnings
It may take a few minutes for your miner to fully sync with the network and begin mining operations.
Upgrading your miner
Stop current miner
Stop your current miner:
Update code
Pull the latest changes from the repository:
Start new version
Start the new version:
Frequently Asked Questions
⚙️ Setup & Configuration
Can I run multiple miners on the same instance?
Can I run multiple miners on the same instance?
Yes, multiple miners can run on the same machine. However, each miner must have its own TEE worker. A single TEE worker cannot be shared across multiple miners.
How many miners can I run per instance?
How many miners can I run per instance?
The number of miners per instance depends on the system resources and performance considerations. Each miner needs its own TEE worker, so the setup must account for computational capacity.
Can I use a single scraper for multiple miners?
Can I use a single scraper for multiple miners?
No, the scraper (worker) is tied to a specific miner’s TEE worker. Each miner must have its own dedicated scraping logic within its TEE environment.
Do I need separate Twitter/X accounts per miner?
Do I need separate Twitter/X accounts per miner?
Yes, but a miner can have multiple Twitter accounts/API keys assigned. It can be X/Twitter accounts you scrape and/or X/Twitter API accounts. We recommend the Twitter API Pro tier for full-archive search. or a combination of tiers for higher stability.
Can I authenticate via Twitter/X API instead of premium account scraing with logins?
Can I authenticate via Twitter/X API instead of premium account scraing with logins?
Should I invest in a Twitter API subscription?
Should I invest in a Twitter API subscription?
Yes, it is recommended to consider Twitter/X API Pro or a combination of tiers. This provides better access to full-archive search, improves data reliability, and reduces the risk of scraping failures.
Will miners be able to share TEE workers in the future?
Will miners be able to share TEE workers in the future?
How does Twitter/X data access affect performance?
How does Twitter/X data access affect performance?
Both stable authentication and reliable data access are critical for miner performance and rewards. Your miner’s ability to consistently return high-quality Twitter/X data impacts scoring. Poor performance can result from:
- Authentication failures
- Slow response times
- Missing or incomplete data
- Rate limiting issues
- API quota exhaustion
We recommend using the Twitter API with the following tiers:
- Basic Tier ($100/month)
- Good starting point for testing
- Limited to 500k tweets/month
- Recent search only (7 days)
- Pro Tier ($5000/month)
- Full archive search access
- Up to 1M tweets/month
- Higher rate limits
- More reliable for production
You can use a combination of tiers to achieve the best performance and stability. You also have the option to use premium accounts with logins but can be more unstable..
A well-optimized setup with reliable API access or stable premium accounts, combined with efficient data retrieval and processing, is key to maintaining high performance scores and maximizing rewards.