Technical Documentation
Comprehensive guides, API references, and technical documentation for blockchain development.
- Getting Started
- Smart Contracts
- DeFi Protocols
- Sonic Labs
- API Reference
- Best Practices
Getting Started with Blockchain Development
Prerequisites
Before diving into blockchain development, ensure you have the following:
- Basic programming knowledge (JavaScript, Python, or similar)
- Understanding of cryptographic concepts
- Familiarity with web development (HTML, CSS, JavaScript)
- Knowledge of command-line interfaces
Development Environment Setup
Set up your blockchain development environment with these essential tools:
1. Node.js and npm
Install Node.js for JavaScript development and package management:
# Download from https://nodejs.org/
# Verify installation
node --version
npm --version
2. Hardhat Development Environment
Hardhat is a development environment for Ethereum that helps you compile, deploy, test, and debug your smart contracts:
npm install --save-dev hardhat
npx hardhat init
3. MetaMask Wallet
Install MetaMask browser extension for wallet management and testnet interaction:
Download from metamask.io
Your First Smart Contract
Let's create a simple "Hello World" smart contract to get started:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract HelloWorld {
string public message;
constructor() {
message = "Hello, Blockchain World!";
}
function setMessage(string memory newMessage) public {
message = newMessage;
}
function getMessage() public view returns (string memory) {
return message;
}
}
Deploying to Testnet
Deploy your smart contract to a testnet for testing and validation:
1. Configure Network
// hardhat.config.js
module.exports = {
networks: {
sepolia: {
url: `https://sepolia.infura.io/v3/${INFURA_PROJECT_ID}`,
accounts: [PRIVATE_KEY]
}
}
};
2. Deploy Contract
npx hardhat run scripts/deploy.js --network sepolia
Next Steps
After setting up your development environment:
- Complete the pre-course foundation lessons
- Practice with simple smart contracts
- Explore DeFi protocol development
- Build your first dApp
Quick Reference
Essential commands and concepts for blockchain development.
Solidity Basics
pragma solidity ^0.8.0;
- Version declarationcontract
- Smart contract definitionpublic
- Public visibility modifierview
- Read-only function modifierpayable
- Can receive ETH modifier
Hardhat Commands
npx hardhat compile
- Compile contractsnpx hardhat test
- Run testsnpx hardhat node
- Start local nodenpx hardhat run scripts/deploy.js
- Deploy contractsnpx hardhat console
- Interactive console
Web3.js Basics
web3.eth.getAccounts()
- Get accountscontract.methods.functionName()
- Call contract functionweb3.utils.toWei()
- Convert to Weiweb3.utils.fromWei()
- Convert from Weicontract.events.EventName()
- Listen to events
API Reference
Complete API documentation for blockchain development tools and libraries.
Solidity Language Reference
Complete reference for the Solidity programming language used for smart contract development.
View Solidity DocsWeb3.js Documentation
JavaScript library for interacting with Ethereum blockchain and smart contracts.
View Web3.js DocsHardhat Framework
Development environment for Ethereum with testing, deployment, and debugging tools.
View Hardhat DocsSonic Labs API
High-performance blockchain infrastructure and DeFi protocol development tools.
View Sonic Labs Docs