Coder Social home page Coder Social logo

solidity's Introduction

Web3 and Solidity - FreeCodeCamp Course

Solidity

General knowledge

  • Nonce: transaction count for the account
  • Gas Price: ptice per unit of gas (wei)
  • Gas Limit: max gas that can be used for the transaction
  • To: address of the account to send the transaction to
  • Value: amount of ether to send (wei)
  • Data: what to send to the To address
  • V, R, S: signature of the transaction

Solidity

  • pragma: version of the compiler
  • contract: like a class in OOP
  • constructor: a function that runs once when the contract is created
  • public: can be accessed from outside the contract
  • view: can be called without spending gas
  • pure: does not read from or modify the state and does not spend gas
  • memory: temporary place to store data
  • storage: permanent place to store data
  • mapping: like a hash table
  • require: like an if statement
  • msg.sender: address of the account that called the function
  • msg.value: amount of ether that was sent along with the function call
  • address(this): address of the contract
  • address payable: address that can send ether
  • modifier: like a function that is run before the function it is applied to
  • receive function: a special function in solidity that is run when the contract receives ether without a function call
  • fallback function: a special function in solidity that is run when the contract receives ether and the function call does not match any other function

Optimization (Gas Efficiency)

  • immutable: variables that cannot be changed after the contract is deployed
  • constant: variables that cannot be changed after the contract is deployed and can be accessed from outside the contract
  • if and custom errors instead of require: require uses more gas than if statements and custom errors
  • view: functions that do not change the state of the contract
  • pure: functions that do not read from or modify the state of the contract

solidity's People

Contributors

zineddinebk09 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.