Solidity API Manual
Section
Guide
- Basic Design
- Function Selector
- Argument Encoding
- Types
- Formal Specification of the Encoding
- Function Selector and Argument Encoding
- Examples
- Use of Dynamic Types
- Events
- JSON
- Non-standard Packed Mode
- Handling tuple types
- Inline Assembly
- Standalone Assembly
- Example
- Syntax
- Opcodes
- Literals
- Functional Style
- Access to External Variables and Functions
- Labels
- Declaring Assembly-Local Variables
- Assignments
- If
- Switch
- Loops
- Functions
- Things to Avoid
- Conventions in Solidity
- Parsing / Grammar
- Desugaring
- Opcode Stream Generation
- Withdrawal from Contracts
- Restricting Access
- State Machine
- Example
- Creating Contracts
- Visibility and Getters
- Function Modifiers
- Constant State Variables
- Functions
- Events
- Inheritance
- Abstract Contracts
- Interfaces
- Libraries
- Using For
- Getter Functions
- View Functions
- Pure Functions
- Fallback Function
- Function Overloading
- Low-Level Interface to Logs
- Additional Resources for Understanding Events
- Constructors
- Arguments for Base Constructors
- Multiple Inheritance and Linearization
- Inheriting Different Kinds of Members of the Same Name
- Call Protection For Libraries
- How to Report Issues
- Workflow for Pull Requests
- Running the compiler tests
- Whiskers
- Input Parameters and Output Parameters
- Control Structures
- Function Calls
- Creating Contracts via new
- Order of Evaluation of Expressions
- Assignment
- Scoping and Declarations
- Error handling: Assert, Require, Revert and Exceptions
- Input Parameters
- Output Parameters
- Returning Multiple Values
- Internal Function Calls
- External Function Calls
- Named Calls and Anonymous Function Parameters
- Omitted Function Parameter Names
- Destructuring Assignments and Returning Multiple Values
- Complications for Arrays and Structs
- Scoping starting from Version 0.5.0
- Basic Questions
- Advanced Questions
- Is it possible to do something on a specific block number? (e.g. publish a contract or execute a transaction)
- What is the transaction ��payload��?
- Is there a decompiler available?
- Create a contract that can be killed and return funds
- Can you return an array or a string from a solidity function call?
- "Is it possible to in-line initialize an array like so: string[] myarray = [""a"", ""b""];"
- Can a contract function return a struct?
- If I return an enum, I only get integer values in web3.js. How to get the named values?
- Can state variables be initialized in-line?
- How do structs work?
- How do for loops work?
- What are some examples of basic string manipulation (substring, indexOf, charAt, etc)?
- Can I concatenate two strings?
- Why is the low-level function .call() less favorable than instantiating a contract with a variable (ContractB b;) and executing its functions (b.doSomething();)?
- Is unused gas automatically refunded?
- When returning a value of say uint type, is it possible to return an undefined or ��null��-like value?
- Are comments included with deployed contracts and do they increase deployment gas?
- What happens if you send ether along with a function call to a contract?
- Is it possible to get a tx receipt for a transaction executed contract-to-contract?
- What is the memory keyword? What does it do?
- How do you get a random number in a contract? (Implement a self-returning gambling contract.)
- Get return value from non-constant function from another contract
- Get contract to do something when it is first mined
- How do you create 2-dimensional arrays?
- What happens to a struct��s mapping when copying over a struct?
- How do I initialize a contract with only a specific amount of wei?
- Can a contract function accept a two-dimensional array?
- "What is the relationship between bytes32 and string? Why is it that bytes32 somevar = ""stringliteral""; works and what does the saved 32-byte hex value mean?"
- Can a contract pass an array (static size) or string or bytes (dynamic size) to another contract?
- Sometimes, when I try to change the length of an array with ex: arrayname.length = 7; I get a compiler error Value must be an lvalue. Why?
- Is it possible to return an array of strings (string[]) from a Solidity function?
- If you issue a call for an array, it is possible to retrieve the whole array? Or must you write a helper function for that?
- What does the following strange check do in the Custom Token contract?
- More Questions?
- Versioning
- Remix
- npm / Node.js
- Docker
- Binary Packages
- Building from Source
- CMake options
- The version string in detail
- Important information about versioning
- Clone the Repository
- Prerequisites - macOS
- Prerequisites - Windows
- External Dependencies
- Command-Line Build
- A Simple Smart Contract
- Blockchain Basics
- The Ethereum Virtual Machine
- Storage
- Subcurrency Example
- Transactions
- Blocks
- Overview
- Accounts
- Transactions
- Gas
- Storage, Memory and the Stack
- Instruction Set
- Message Calls
- Delegatecall / Callcode and Libraries
- Logs
- Create
- Self-destruct
- Specification of JULIA
- Specification of JULIA Object
- Restrictions on the Grammar
- Scoping Rules
- Formal Specification
- Type Conversion Functions
- Low-level Functions
- Backends
- Backend: EVM
- Backend: ��EVM 1.5��
- Backend: eWASM
- Version Pragma
- Importing other Source Files
- Comments
- Syntax and Semantics
- Paths
- Use in Actual Compilers
- Encoding of the Metadata Hash in the Bytecode
- Usage for Automatic Interface Generation and NatSpec
- Usage for Source Code Verification
- Layout of State Variables in Storage
- Layout in Memory
- Layout of Call Data
- Internals - Cleaning Up Variables
- Internals - The Optimizer
- Source Mappings
- Tips and Tricks
- Cheatsheet
- Order of Precedence of Operators
- Global Variables
- Function Visibility Specifiers
- Modifiers
- Reserved Keywords
- Language Grammar
- Pitfalls
- Recommendations
- Formal Verification
- Private Information and Randomness
- Re-Entrancy
- Gas Limit and Loops
- Sending and Receiving Ether
- Callstack Depth
- tx.origin
- Minor Details
- Restrict the Amount of Ether
- Keep it Small and Modular
- Use the Checks-Effects-Interactions Pattern
- Include a Fail-Safe Mode
- Voting
- Blind Auction
- Safe Remote Purchase
- Micropayment Channel
- Possible Improvements
- Simple Open Auction
- Blind Auction
- State Variables
- Functions
- Function Modifiers
- Events
- Struct Types
- Enum Types
- Introduction
- Code Layout
- Naming Conventions
- Indentation
- Tabs or Spaces
- Blank Lines
- Maximum Line Length
- Source File Encoding
- Imports
- Order of Functions
- Whitespace in Expressions
- Control Structures
- Function Declaration
- Mappings
- Variable Declarations
- Other Recommendations
- Naming Styles
- Names to Avoid
- Contract and Library Names
- Struct Names
- Event Names
- Function Names
- Function Argument Names
- Local and State Variable Names
- Constants
- Modifier Names
- Enums
- Avoiding Naming Collisions
- General Recommendations
- Value Types
- Reference Types
- Mappings
- Operators Involving LValues
- Conversions between Elementary Types
- Type Deduction
- Booleans
- Integers
- Fixed Point Numbers
- Address
- Fixed-size byte arrays
- Dynamically-sized byte array
- Address Literals
- Rational and Integer Literals
- String Literals
- Hexadecimal Literals
- Enums
- Function Types
- Data location
- Arrays
- Structs
- delete
- Implicit Conversions
- Explicit Conversions
- Ether Units
- Time Units
- Special Variables and Functions
- Block and Transaction Properties
- Error Handling
- Mathematical and Cryptographic Functions
- Address Related
- Contract Related
- Using the Commandline Compiler
- Compiler Input and Output JSON Description
- Input Description
- Output Description