How to build a Motivational Quote App in NEAR

  1. You’ve installed Node.js ≥ 12
  2. You’ve created a NEAR account first. If you don't have one navigate to https://wallet.testnet.near.org and click on “Create Account” and follow the prompts.
  1. Fork this repository https://github.com/electrone901/quotes.git, this will make a copy of this project in your own GitHub account.
  2. Clone the GitHub repository with the following command (this will copy the project files from GitHub to your computer):git clone https://github.com/YourGitHubUsername/quotes.git

Exploring The Code

  1. set_greeting: accepts a message, such as “Hello”, and records it for the user (account_id)
  2. get_greeting: accepts an account_id and returns the quote saved for it.

Deploy

Step 0: Install near-cli

npm install --global near-cli

Step 1: Create an account for the contract

  1. Authorize NEAR CLI using the following command: near login
  2. Create a subaccount by typing: near create-account guessing-game.YOUR-NAME.testnet — masterAccount YOUR-NAME.testnet
    Make sure to replace YOUR-NAME below with your actual account name. You should get similar results to the following image.

Step 2: set contract name

const CONTRACT_NAME = process.env.CONTRACT_NAME || 'new-awesome-project.YOUR-NAME.testnet'

Step 3: deploy!

npm run deploy
  1. builds & deploys smart contract to NEAR TestNet
  2. builds & deploys frontend code to GitHub using gh-pages. This will only work if the project already has a repository set up on GitHub. You should get similar logs as the image below.

Frontend

Conclusion

--

--

--

▪️BLOCKCHAIN 💻 W O R LD 🗽▪️E X P L O R E 🚖 ▪️D I S C O V E R 🎉 🏞▪️E A T 🍽▪️L I V E🌻 ▪️BLOGS ⛴️▪️E V E N T S ✈️▪️L I F E S T Y L E 💼⏰▪️YOUTUBE VIDEO🔥⬇️

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

useState hook in React

Emitting RxJS Observable Fallback Values

How to change the WYSIWYG in Strapi

What’s to Angular’s lifecycle hooks and inputs default values?

Day 6 : How to use Vuforia in Unity to create AR Application — Tutorials For AR

How to unit test your first Vue.js component

Mutating JavaScript Arrays

Compact AI platform for mobile use

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mar

Mar

▪️BLOCKCHAIN 💻 W O R LD 🗽▪️E X P L O R E 🚖 ▪️D I S C O V E R 🎉 🏞▪️E A T 🍽▪️L I V E🌻 ▪️BLOGS ⛴️▪️E V E N T S ✈️▪️L I F E S T Y L E 💼⏰▪️YOUTUBE VIDEO🔥⬇️

More from Medium

Introduction to Blockchain

Fundamentals of Blockchain Technology

Lets DeFi 2022 @ DeFi 2.0 with HASHSPYDER.COM

Demystifying Crypto and Blockchain