✏️
go-conflux-sdk
  • README
  • Quickstart
  • Getting Started
    • Run a Node locally
    • Interacting with a Node
    • Deploy and Interact with Smart Contracts
    • Subscription
  • Smart Contracts
    • Smart Contract Overview
    • Getting Started with Solidity
    • Compiling Solidity source code
    • Interacting with Smart Contracts
    • Application Binary Interface
    • Contracts Supported
  • Transactions
    • Conflux Transactions
    • Obtaining CFX
    • Gas & Storage Collateral
    • Account Manager
    • Transfer CFX
    • Transaction Nonce
    • Batch Call snd Send Transactions
  • Other
    • Call/BatchCall RPC Hook
    • Conflux Addreess
  • Conflux-ABIGEN
  • ChangeLog
  • References
Powered by GitBook
On this page

Was this helpful?

  1. Smart Contracts

Compiling Solidity source code

PreviousGetting Started with SolidityNextInteracting with Smart Contracts

Last updated 3 years ago

Was this helpful?

Compilation to bytecode is performed by the Solidity compiler, solc. You can install the compiler, locally following the instructions as per .

To compile the Solidity code run:

$ solc <contract>.sol --bin --abi --optimize -o <output-dir>/

The --bin and --abi compiler arguments are both required to take full advantage of working with smart contracts from web3j.

--bin

Outputs a Solidity binary file containing the hex-encoded binary to provide with the transaction request. This is required only for deploy and isValid methods.

--abi

Outputs a Solidity file which details all of the publicly accessible contract methods and their associated parameters. These details along with the contract address are crucial for interacting with smart contracts. The ABI file is also used for the generation of

There is also a --gas argument for providing estimates of the required to create a contract and transact with its methods.

Alternatively, you can write and compile Solidity code in your browser via the project. browser-solidity is great for smaller smart contracts, but you may run into issues working with larger contracts.

the project documentation
Solidity smart contract wrappers
Application Binary Interface
Solidity smart contract wrappers
Gas
browser-solidity