All Projects β†’ liamzebedee β†’ awesome-solidity-patterns

liamzebedee / awesome-solidity-patterns

Licence: other
πŸš€Awesome Solidity patterns to make life easier ✌️

Projects that are alternatives of or similar to awesome-solidity-patterns

heimdall
Ethereum Smart Contracts Security Monitoring
Stars: ✭ 18 (-75.34%)
Mutual labels:  smart-contracts
pact-todomvc
Demo of integrating a JS webapp with the Pact smart contract langauge
Stars: ✭ 20 (-72.6%)
Mutual labels:  smart-contracts
flow-ft
The Fungible Token standard on the Flow Blockchain
Stars: ✭ 120 (+64.38%)
Mutual labels:  smart-contracts
proof-of-existence
Ethereum Smart Contract to prove a document's existence at some point by storing and verifying its hash.
Stars: ✭ 22 (-69.86%)
Mutual labels:  smart-contracts
blockchain-development
A complimentary course for an understanding of blockchain and its development like custom blockchain, dapps, etc.
Stars: ✭ 71 (-2.74%)
Mutual labels:  smart-contracts
framework
Lightweight, open source and magic-free framework for testing solidity smart contracts.
Stars: ✭ 36 (-50.68%)
Mutual labels:  smart-contracts
haal
HÀÀl - Anonymous Electronic Voting System on Public Blockchains
Stars: ✭ 96 (+31.51%)
Mutual labels:  smart-contracts
rgb-core
RGB Core Library: consensus validation for private & scalable client-validated smart contracts on Bitcoin & Lightning
Stars: ✭ 99 (+35.62%)
Mutual labels:  smart-contracts
TZComet
Contract Metadata Viewer on Tezos
Stars: ✭ 24 (-67.12%)
Mutual labels:  smart-contracts
uniswap-arbitrage-flash-swap
Uniswap flash swap arbitrage solidity contracts
Stars: ✭ 341 (+367.12%)
Mutual labels:  smart-contracts
starter-kit-gsn
An OpenZeppelin starter kit focused on GSN.
Stars: ✭ 39 (-46.58%)
Mutual labels:  smart-contracts
create-ether-dapp
A template for building Full-Stack Blockchain Dapps using Next.js (React), TypeScript, Tailwind CSS, Hardhat, Solidity, and many more!
Stars: ✭ 100 (+36.99%)
Mutual labels:  smart-contracts
ethereum-solidity-course-updated-code
Up-to-date Solidity/web3.js/React/Next.js code for the udemy.com course Ethereum and Solidity: The Complete Developer's Guide.
Stars: ✭ 161 (+120.55%)
Mutual labels:  smart-contracts
mStable-contracts
πŸ“ƒ Smart Contracts that make up the core of the mStable protocol
Stars: ✭ 277 (+279.45%)
Mutual labels:  smart-contracts
fcl-js
FCL (Flow Client Library) - The best tool for building JavaScript (browser & NodeJS) applications on Flow 🌊
Stars: ✭ 302 (+313.7%)
Mutual labels:  smart-contracts
quipuswap-core
πŸ§™β€β™‚οΈ Repository containing QuipuSwap liquidity protocol smart-contracts written in Ligo language
Stars: ✭ 48 (-34.25%)
Mutual labels:  smart-contracts
bloqly
Bloqly: JavaScript Smart Contracts Engine + SQL database
Stars: ✭ 29 (-60.27%)
Mutual labels:  smart-contracts
ipfs-eth-database
An example of usage IPFS in Ethereum Smart Contracts
Stars: ✭ 55 (-24.66%)
Mutual labels:  smart-contracts
flow-protocol-ethereum
Flow Protocols powering synthetic asset and margin trading
Stars: ✭ 18 (-75.34%)
Mutual labels:  smart-contracts
web3j-example
Android web3j example
Stars: ✭ 27 (-63.01%)
Mutual labels:  smart-contracts

awesome-solidity-patterns πŸ’»πŸ

An accomplice to the Consensys "Smart Contract Best Practices", but with less security and more engineering focus. WIP.

Copyright 2018 Liam Zebedee and contributors.

Foreward

While Solidity on the outside looks like JS, functions like C, its semantics are quite unique and different. It is birthed as a "smart contract" programming language, however you can better understand its strange decisions by the constraints imposed by running atop the Ethereum blockchain:

  • storage is very expensive
  • money/value is data
  • computation is transactioned, state is rationed

You can see this in many ways:

  • basic operations on data types are difficult/missing: iteration on maps, non-existent keys are 0x0 (even for structs their fields are all 0x0)
  • returning structs from external methods is impossible - rather, it returns tuples for now due to the ABI version
  • types are generally much more plentiful in number, but lower-level in nature (bytes32, bytes64, uint256)
  • contracts cannot respond natively to "timed events" - they must be interacted with via calls, or by decentralized services such as the Ethereum Alarm Clock
  • all interactions are based on the primitive of messages, contract instantiations are sending eth to an address (which is in itself the hash of the contract), everything functions as an address (wallets and contracts alike)
  • since protocol messages are padded, features such as dynamic arrays do not work in places you expect
  • upgradeability is not built-in
  • no ubiquitous package management yet

A Guide

I've decided to write a guide of the knowledge base I've been building up - for those who understand code, who know the fundamentals of blockchain, but don't want to trawl through 200 poorly-written half-answered StackExchange questions and blog posts.

I've tried to organise this guide into various topics that commonly crop up in the software engineering practice of building smart contracts.

  • Data modelling: the common patterns of separating concerns (i.e. MVC)
  • Interaction modelling: ⏰ in-progress
  • Testing: the simplest patterns for writing unit and integration tests for smart contract systems / dApps.
  • Solidity semantics: common gotcha's/suprises in the semantics of Solidity
  • Self-study: read the codebases of larger projects, and run example contracts created by others to get tactile understanding of the language
  • Web3: usage patterns for JavaScript interaction with Solidity
  • seth: read my tutorial on this amazing tool by MakerDAO, A Primer on Seth, Solidity's Swiss Army Knife

Take a further read of https://github.com/fravoll/solidity-patterns

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].