LogoLogo
  • 🚀DeSo Vision
  • 🪙DeSo Tokenomics
    • No Equity, Just Coins and Code
    • Current DESO Supply
    • Initial DESO Distribution
    • DESO Sinks
    • The BMF: Burn-Maximizing Fee Mechanism
    • Designed for the End-Game
  • 🏛️DeSo Governance
  • ⭐DeSo Tutorial (Build Apps)
  • 🖥️Node Architecture Overview
    • Setup a Node & Frontend Locally
    • Making Your First Changes
  • 📅DeSo Roadmap
  • 🔍DeSo Block Explorer
  • 💸DeSo Wallet
  • 💬DeSo Chat Protocol
  • 👽Openfund
  • 👀Focus
  • 🛠️DeSo Tech Stack
  • 🌐DeSo Applications
  • DeSo Blockchain
    • 1️⃣Bare Metal
    • 2️⃣Scaling Roadmap
    • 3️⃣Content Moderation
    • 4️⃣Infinite-State
    • 5️⃣On-Chain Data
    • 6️⃣Smart Services
    • 7️⃣User Security
  • DeSo Features
    • 1️⃣Associations
    • 2️⃣Creator Coins
    • 3️⃣Feeds & Moderation
    • 4️⃣Social NFTs
    • 5️⃣Social Tipping
  • DeSo Identity
    • 1️⃣Identity: Overview
      • Core Concepts
      • Mobile Integration
    • 2️⃣Identity: iFrame API
      • Overview
      • Endpoints
    • 3️⃣Identity: Window API
      • Overview
      • Endpoints
  • DESO FRONTEND
    • 1️⃣Frontend: Get Started
    • 2️⃣Frontend: React Example
  • DESO BACKEND
    • 1️⃣Backend: Config
      • Onboarding
      • Phone Number Verification
      • Global State
      • Admins
      • Web Security
      • Media
        • Images
        • Videos
      • Hot Feed
      • Selling $DESO
        • Wyre - Buy with USD
        • Buy with BTC
        • Buy with ETH
      • Analytics
      • Emails
      • Supply Monitoring
    • 2️⃣Construct: API
      • Social Transactions API
      • NFT Transactions API
      • Financial Transactions API
      • Derived Keys Transaction API
      • DeSo Tokens Transactions API
      • Associations Transactions API
      • Access Groups API
    • 3️⃣Data: API
      • Admin Endpoints
      • Associations Endpoints
      • DeSo Tokens Endpoints
      • Media Endpoints
      • Miner Endpoints
      • Notification Endpoints
      • NFT Endpoints
      • Social Endpoints
      • Referral Endpoints
      • Tutorial Endpoints
      • Meta Data Endpoints
      • Transaction Spending Limits Endpoints
      • User Endpoints
      • Post Endpoints
      • Messages Endpoints
      • Access Group Endpoints
    • 4️⃣Transactions: API
  • DeSo Exchange Listings
    • 1️⃣Exchange Listing: API
  • DeSo Nodes
    • 2️⃣Node: Setup
    • 3️⃣Node: Staying Up-To-Date
    • 4️⃣Node: FAQ
  • DESO VALIDATORS
    • 1️⃣Run a Validator
  • Openfund
    • What is Openfund?
    • Openfund Tokenomics
    • Openfund Governance
    • Algorithmic Trading
      • The DeSo Python SDK
    • The DeSo Python SDK
      • Getting Help from the Community
      • Creating DeSo Testnet Accounts
      • Debugging Tips and Code Walkthrough
      • Write Blockchain Bots with AI
      • Market-Making Bots
      • Social AI Agents
      • AI-Generating Your Code
    • How Do the Advanced AMMs Work?
  • Focus
    • The Crypto Social Network
    • Next-Generation Token Mechanics
      • Launching Your Token
      • How the Order-Book AMMs Work
    • Crypto-Native Monetization
    • Focus Tokenomics
    • The Social Airdrop
    • Decentralizing Social Media
  • Contact And Media
    • ☀️DeSo Website
    • 📑DeSo Blog
    • 💻DeSo Github
    • 💎DeSo Diamond
    • 🐦DeSo Twitter
    • 📺DeSo YouTube
    • 📬Contact US
    • ⚠️Reporting an Account or Post
  • 中文
    • 什么是DeSo? (What is DeSo?)
    • 愿景 (The Vision)
Powered by GitBook
On this page
  • Prerequisites
  • Setup
  • Building and running locally
  • Running the frontend in development mode
  • Running the node in testnet mode
  • Running the node in mainnet mode
  • Running a local identity service (optional)

Was this helpful?

  1. Node Architecture Overview

Setup a Node & Frontend Locally

PreviousNode Architecture OverviewNextMaking Your First Changes

Last updated 10 months ago

Was this helpful?

This doc will teach you how to set up your dev environment. Although it's not a hard prerequisite, we recommend skimming the DeSo Code Walkthrough first, as it provides some useful context.

Prerequisites

To run the frontend repo, you will need to be running Node v13.13.0 and NPM 6.14.4. We recommend using NVM to set this environment up. To run the backend you'll need Go v1.15.6 installed. These can be installed via by running:

brew install nvm
# follow the output to set up your ~/.nvm folder, nvm script, and shell completion
nvm install 13
# check the versions
node -v
npm -v
# then install go
brew install [email protected]
# check the version
go version

We will also assume that you have installed. This is the recommended IDE for developing on DeSo since most of the code is Go code.

Another prerequisite is which can be installed with – brew install vips – or apt install libvips-tools on Ubuntu.

Setup

First, you must checkout all repos into the same directory. Some of these repos are technically optional, but checking them all out allows you to hop around the code more easily.

cd $WORKING_DIRECTORY
git clone https://github.com/deso-protocol/core.git
git clone https://github.com/deso-protocol/backend.git
git clone https://github.com/deso-protocol/frontend.git
git clone https://github.com/deso-protocol/identity.git

Once all of these repos are checked out, we recommend importing them into a single Goland project. This allows you search across and develop on all of of the repos concurrently. To do this, open Goland, hit File > Open, select a repo folder, and select "Attach" when prompted. If you do this correctly, you should have all four repos loaded into a single Goland project.

  • SHIFT+SHIFT: Open any file across all four repos with fuzzy search.

  • CTRL+SHIFT+F: Search across all four repos at once with regexes.

  • CTRL+SHIFT+A: Runs any action that you would normally find in a menu.

  • CTRL+B: Jump to definition or find usages.

If you like Vim, you can also install the Vim plugin so you get your typical Vim hotkeys.

Building and running locally

Running the frontend in development mode

# Assume we're starting in $WORKING_DIRECTORY, which contains all the repos
cd frontend
npm install

# The following command will serve the frontend on localhost:4200 with
# auto-reloading on changes. You must run a node before the site will
# actually work however (see next section).
npm start

Running the node in testnet mode

# Assume we're starting in $WORKING_DIRECTORY, which contains all the
# repos. Also assume we have "ng serve" running.
cd backend/scripts/nodes

# The n0_test script runs a testnet blockchain locally. It starts mining 
# blocks immediately at a much faster rate than mainnet. You can set your 
# public key to receive the block rewards by setting it as --miner-public-key 
# in the arguments. This gives you funds that you can test with. You can see 
# the status of the node by going to the Admin tab after logging in with an
# account and then going to the Network subtab.
export CGO_CFLAGS_ALLOW="-Xpreprocessor"
./n0_test

# Once n0_test is running, you must navigate to the following URL. 4200 is the
# port for ng serve. Note that in order to be 
http://localhost:4200

By default, your browser will point at localhost:17001, which is the default "mainnet" API port. However, when you run n0_test, your node spins up on localhost:18001. To point your frontend at your testnet node, however, you must open up your inspector and change your lastLocalNodev2 parameter to localhost:18001 as shown in the screenshot below. After you do this, you should be able to Sign Up, and everything should work normally.

Running the node in mainnet mode

Most of the time, we develop using testnet mode because it's fast and cheap. However, to make sure our changes work before pushing we like to run full-blown mainnet nodes locally.

# Assume we're starting in $WORKING_DIRECTORY, which contains all the repos.
# Also assume we have "ng serve" running.
cd backend/scripts/nodes

# The n0 script runs a node that connects to mainnet peers. It will download
# all the blocks from its peers and then start syncing its mempool from them.
# You can see the status of the node by going to the Admin tab after
# logging in with an account and then going to the Network subtab. Note that
# syncing the blockchain may take an hour or so.
$ ./n0

# Once n0 is running, you must navigate to the following URL. 4200 is the
# ng serve port. It should automatically hit your node, which should be
# exposing its API at localhost:17001.
http://localhost:4200

Running a local identity service (optional)

Running an identity service locally is generally not required. However, doing so is as easy as running the Angular app:

# Assume we're starting in $WORKING_DIRECTORY, which contains all the repos
cd identity
npm install

# Install angular cli
sudo npm install -g @angular/cli typescript tslint dep

# The following command will serve identity on localhost:4201 with
# auto-reloading on changes.
ng serve --port 4201

In order to point your browser at your local identity service rather than at identity.deso.org, you must change a localStorage value similar to what we did to get the testnet node running. In this case, we must change lastIdentityServiceURL to http://localhost:4201. See the screenshot below:

If you're not familiar with Goland, the following hotkeys are useful for jumping around the code ():

🖥️
homebrew
Goland
vips
homebrew
full cheat sheet here