Skip to content

Solidity 小记

INFO

仅记录学习Solidity当中感到困惑的问题

node.js的运行

安装并使用solc

shell
yarn global add solc

使用solc编译.sol文件

shell
solcjs --abi --bin ./<ContractName>.sol -o build
# solcjs --abi --bin ./contract/Hello.sol -o build

:::detail

code runner中的设置

json
{
	"solidity": "solcjs --abi --bin $fileName -o build"
}

:::

函数修饰符

  • view
  • pure
  • constant

访问修饰符

  • private

  • public

  • internal

  • external

合约内部调用合约外部调用
publicYesYes
privateYesNo
internalYesNo (Inherence)
externalNoYes
One day we will climb the highest mountain, and suvey the smallest point.