Skip to main content

Quickstart

Follow these steps to get your Masa Oracle node up and running quickly:

1. Clone the repository

git clone https://github.com/masa-finance/masa-oracle.git
cd masa-oracle

2. Build the node

go build -v -o masa-node ./cmd/masa-node

3. Install contract dependencies

cd contracts/
yarn install
cd ../

4. Set up environment variables

Create a .env file in the root directory with the following content:

# Default .env configuration
BOOTNODES=/ip4/35.223.224.220/udp/4001/quic-v1/p2p/16Uiu2HAmPxXXjR1XJEwckh6q1UStheMmGaGe8fyXdeRs3SejadSa,/ip4/34.121.111.128/udp/4001/quic-v1/p2p/16Uiu2HAmKULCxKgiQn1EcfKnq1Qam6psYLDTM99XsZFhr57wLadF

API_KEY=
RPC_URL=https://ethereum-sepolia.publicnode.com
ENV=test
FILE_PATH=.
VALIDATOR=false
PORT=8080

# AI LLM
CLAUDE_API_KEY=
CLAUDE_API_URL=https://api.anthropic.com/v1/messages
CLAUDE_API_VERSION=2023-06-01
ELAB_URL=https://api.elevenlabs.io/v1/text-to-speech/ErXwobaYiN019PkySvjV/stream
ELAB_KEY=
OPENAI_API_KEY=
PROMPT="You are a helpful assistant."

# X
TWITTER_USER="yourusername"
TWITTER_PASS="yourpassword"
TWITTER_2FA_CODE="your2fa"

# Worker node config; default = false
TWITTER_SCRAPER=false
DISCORD_SCRAPER=false
WEB_SCRAPER=false

5. Start the node

./masa-node

Your Masa Oracle node should now be running and attempting to connect to the network. Check the logs to ensure it's functioning correctly. You will need your Public Key from the node startup logs to stake the node. Grab some testnet MASA from Discord.

#######################################
# __ __ _ ____ _ #
# | \/ | / \ / ___| / \ #
# | |\/| | / _ \ \___ \ / _ \ #
# | | | |/ ___ \ ___) / ___ \ #
# |_| |_/_/ \_\____/_/ \_\ #
# #
#######################################
Multiaddress: /ip4/192.168.1.25/udp/4001/quic-v1/p2p/16Uiu2HAm28dTN2WVWD2y2bjzwPdym59XASDfQsSktCtejtNR9Vox
IP Address: /ip4/127.0.0.1/udp/4001/quic-v1
Public Key: 0x065728510468A2ef48e6E8a860ff42D68Ca612ee
Is Staked: false
Is Validator: false
Is TwitterScraper: false
Is WebScraper: false
INFO[0001] Peer added to DHT: 16Uiu2HAmHpx13GPKZAP3WpgpYkZ39M5cwuvmXS5gGvrsa5ofLNoq
INFO[0005] Successfully advertised protocol /masa/oracle_protocol/v0.0.2-beta-dev

6. Stake the node with 1000 Sepolia MASA minimum

Grab your Public Key and get some Sepolia MASA from Discord. Then use the following command to initiate staking. Make sure you restart your node once you have staked:

./masa-node --stake <amount>

Replace <amount> with the number of tokens you want to stake. For example, to stake 1000 MASA tokens:

./masa-node --stake 1000

Your tokens will approve and stake:

Approving staking contract to spend tokens.....
0x8de79f5111b185fe67090f904b72f3dda7814a8aa81494cd177241549c213ba3
Approve transaction hash: 0x8de79f5111b185fe67090f904b72f3dda7814a8aa81494cd177241549c213ba3
Staking tokens.....
0xea3e9f779b56a6972ce393d44cbfb4a72e74f5ef00c9b5ddfa6b86bdecf4eecb
Stake transaction hash: 0xea3e9f779b56a6972ce393d44cbfb4a72e74f5ef00c9b5ddfa6b86bdecf4eecb

7. Start the staked node

./masa-node

The Is staked flag will change to true

#######################################
# __ __ _ ____ _ #
# | \/ | / \ / ___| / \ #
# | |\/| | / _ \ \___ \ / _ \ #
# | | | |/ ___ \ ___) / ___ \ #
# |_| |_/_/ \_\____/_/ \_\ #
# #
#######################################
Multiaddress: /ip4/192.168.1.25/udp/4001/quic-v1/p2p/16Uiu2HAm28dTN2WVWD2y2bjzwPdym59XASDfQsSktCtejtNR9Vox
IP Address: /ip4/127.0.0.1/udp/4001/quic-v1
Public Key: 0x065728510468A2ef48e6E8a860ff42D68Ca612ee
Is Staked: true
Is Validator: false
Is TwitterScraper: false
Is WebScraper: false
INFO[0001] Peer added to DHT: 16Uiu2HAmHpx13GPKZAP3WpgpYkZ39M5cwuvmXS5gGvrsa5ofLNoq
INFO[0005] Successfully advertised protocol /masa/oracle_protocol/v0.0.2-beta-dev

7. View swagger API

http://localhost:8080/swagger/index.html