ConsoleFlare
  • Python
    • Python Installation
    • Pandas and SQL
  • Projects
    • Data Analytics Project
      • Courier Analytics Challenge
      • Solution
    • Skytrax Airline Review Analysis Pipeline
      • Setting up Azure SQL Database
      • SkyTrax Web Scraping
  • Reporting
    • Power BI
      • Installation
      • Data Sources
      • Important Links
  • PySpark & Databricks
    • Spark vs Hadoop
    • Cluster Computing
    • PySpark
    • Databricks Introduction
    • PySpark in Databricks
    • Reading Data with PySpark
    • PySpark Transformation Methods
    • Handling Duplicate Data
    • PySpark Action Methods
    • PySpark Native Functions
    • Partitioning
    • Bucketing
    • Partitioning vs Bucketing
  • Live Data Streaming
    • Spark Streaming
      • Installation Issues
      • Jupyter Notebook Setup
  • Data Pipeline
    • Azure Data Factory
  • Blockchain
    • Smart Contract Guide
      • Setting up a Node project
      • Developing smart contracts
  • Interview Questions
    • SQL Interview Questions
    • Power BI Interview Questions
  • T-SQL Exercises
    • Exercise 0
    • Exercise 1
    • Exercise 2
    • Exercise 3
  • CHEAT SHEET
    • Ultimate SQL Server Cheat Sheet
Powered by GitBook
On this page

Was this helpful?

  1. Blockchain
  2. Smart Contract Guide

Setting up a Node project

Setting up a Node project for smart-contracts

PreviousSmart Contract GuideNextDeveloping smart contracts

Last updated 2 years ago

Was this helpful?

To start a new project, create a directory for it:

mkdir learn_sc && cd learn_sc

Then we will initialize our node project inside the newly created folder:

npm init -y

This will create a package.json file, which will evolve as your project grows, such as when installing dependencies with npm install

JavaScript and npm are some of the most used software tools in the world: if you’re ever in doubt, you’ll find plenty of information about them online.

Using npx

There are two broads type of packages stored in the npm registry: libraries and executables. Installed libraries are used like any other piece of JavaScript code, but executables are special.

A third binary was included when installing node: . This is used to run executables installed locally in your project.

For our local blockchain development, we will need to install certain packages/libraries so that we can create a local blockchain network within our local systems. For this we can either Truffle or Hardhat.

Whilst and can be installed globally we recommend installing them locally in each project so that you can control the version on a project-by-project basis.

In this guide, we will be going with using Hardhat.

Tracking with Version Control

Before you get coding, you should add to your project to track changes.

By far, the most used tool is , often in conjunction with for hosting purposes. Indeed, you will find the full source code and history of all OpenZeppelin software in our .

If you’ve never used Git before, a good starting place is the .

Don’t commit secrets such as mnemonics, private keys and API keys to version control! Make sure you files with secrets.

npx
Truffle
Hardhat
version control software
Git
GitHub
GitHub repository
Git Handbook
.gitignore