**
Solana is a popular, fast and scalable blockchain platform that has attracted significant in the cryptocurrency area. As its development Environment Environment becomes more matte, setting up a suitable development environment on your machine can be irresistible for beginners. The Visual Studio (vs code), which is a great choice for developers because of its light and adaptable nature.
Prerequisites
Before we start, make sure you have the following prerequisites:
- Modern Operating System (Windows, MacOS or Linux)
- Recent version of Node.js (Recommended LTS or the Latest Version)
- Solana CLI (Node Package Manager) Installed on Your Machine
- Knowing with Gita and Basic Coding Concepts
Step 1: Install the Required Packages
Code, you will need to install the following Packages:
Solana-Cli '
- Vscode-Solan
You can install these packages via npm or yarn:
Bash
Npm install -g solana -cli @vscode/solana
`
or
`Bash
Predja Global Add Solana-Cli @vscode/Solana
`
Step 2: Create a New Solane Project
Create a new folder for your project and go into it. Then create a new directory within the project folder with the name of your choice (eg, my_solana_project
).
`Bash
mkdir my_solana_project
Cd my_solana_project
`
Step 3: Initialize the Solana Cli
Initialize Solana Cli to Download and Manage Packages:
`Bash
Solana Init
`
This Command will create a new directory structure for your project, including the necessary files for solana cli.
Step 4: Install Addiction
Install All Necessary Addiction By Launching The Following Commands:
`Bash
Npm install – -save @solana/web3.js
`
or
`Bash
Yarn Add @Solana/Web3.js
`
Step 5: Configure vs Code Settings
Update your vs code settings to include Solana CLI. .Vscode/settings.json
and by adding the following content:
`Json
{
"Extensions": ["Typescript"],
"Solanversion": "1.9.0",
"Solanodepath": "/usr/bin/node"
Iche
This configuration speaks to the vs code for the use of node.js version 1.9.0, which is a recommended version for salt development.
Step 6: Create a New Solano Folder
Create a new directory called “SRCWithin the Folder of Your Project:
Bash
Mkdir src
CD SRC
`
Step 7: Create a New Strength File
Create a new file called “Main.SolIn the Directorate" SRC/Treaty ", which will serve as our main contract:
Strength
Pragma Solidity ^0.8.0;
MYCONTKRT CONTRACT
Nint256 Public Number;
Function Incment () Public {
Count ++;
Iche
Function GetCount () Public View Returns (Naint256) {) {
Return Number;
Iche
Iche
This strength code defines a simple contract with the functions of the I getcount collection function.
Step 8: Build and Put Together a Project
Complete and Build your Solana Project Using the Following Commands:
Bash
Npm Run Build: Dev
Npm Run Compile
`
or
`Bash
Construction of Yarns: Dev
Construction of Yarn
`
Build: dev
will generate a vile ‘.solin the same directory.
Step 9: Open Your New Project In Vs Code
Open your new Solana Project at vs Code. You should see a new folder structure with several files and folders including:
- Main.Sol
: Your Main Strength Code
- Contracting.
Contract.abi
: Abi (Binary Application Interface) Your Contract
Step 10: Write the Code in Vs Code
You can now write the code directly in the editor or open an existing file.