Skip to content

Latest commit

 

History

History
92 lines (61 loc) · 4.82 KB

solidity.md

File metadata and controls

92 lines (61 loc) · 4.82 KB

Solidity

This chapter is about solidity tricks and contracts built within the company and where were they used.

The cryptozombies.io tutorial is pretty fun to learn solidity with, it will give you a better idea of actual use cases for blockchain.

Remix - The easiest solidity IDE to start with. http://remix.ethereum.org

Learn to run a Geth node locally

Ganache is a locally running Ethereum blockchain which is a much faster option for testing and debugging that connecting to a public blockchain.

Visual Studio Code is a development IDE with good support for solidity.

Tips on Ethereum build environments

More tips on Ethereum build environments

Implement the crowdsale example from the Ethereum.org website in Remix https://www.ethereum.org/crowdsale

Work through the ethernaut tutorials to improve the security of your contracts.

Implement an ERC20 token and deploy it to a testnet (ropsten)

Check OpenZeppelin for libraries (and maybe tutorials) here

Truffle tutorials

Like it or not, every time that it is possible to avoid writing in Solidity, people have done so. JavaScript can be used for front-ends and contract testing. Likewise, any computation that can be moved from the blockchain to the front-end should be moved, to minimize costs.

EIP

Security and Specific actions

VERY IMPORTANT about security https://etherscan.io/solcbuginfo

(Security) Transfer Ether to a contract

Articles about security

Useful tools for Solidity development

Web3J

When using web3j you need to compile the contracts using solc and we3j CLI. But junior solidity developers stumble upon a common issue.

I wrote A Gentleman’s Introduction to Web3j from Java but that article misses one thing.

Let's consider the contract below

pragma solidity ^0.5.10;

contract SimpleStorage {
    uint256 storedData;

    function set(uint256 x) public {
        storedData = x;
    }

    function get() public view returns (uint256) {
        return storedData;
    }
}

If you compile it using solc <smart-contract>.sol –bin –abi –optimize -o <output-dir>/ it should be good. But if you use an external dependency like openzeppelin, you will get an error saying something like "File outside of allowed directories issue".

The solution is really simple, you only need to allow any folder on the solc command, so solc <smart-contract>.sol --allow-paths *, –bin –abi –optimize -o <output-dir>/ will solve the problem.