Skip to content

Latest commit

 

History

History
executable file
·
114 lines (92 loc) · 3.2 KB

solidity.md

File metadata and controls

executable file
·
114 lines (92 loc) · 3.2 KB

ethereum

app example

smart contracts

Linux Foundation Hyperledger Fabric hyperledger composer playground hyperledger composer playground tutorial

# application schema
Business Application -> Hyperledger Composer -> Blockchain ( Hyperledger Fabric)

documentation


user app to communicate with Ethereum

  • Metamask ( chrome extension )
  • Mist browser

Rinkeby ethereum account charger Rinkeby ethereum charger


account address types:

  • external ( user account, common for all networks )
  • internal ( contract account, specific for each network )
balance
storage - data storage
code - compiled machine code 

account credential saving

bip39

SmartContract API collaboration via nodejs app example

  • NodeJS ( min version 8.0.1 )
# ganache-cli 
const Web3 = require('web3')
const web3 = new Web3("http://localhost:8545")

console.log(web3.eth.getAccounts().then(e=>console.log(e)))

http://solidity.readthedocs.io/en/latest/

contract development phases:

  • create project
npm init
npm install -save solc

  • contract creation ( solidity compiler )
  • local testing ( Mocha framework )
# npm install mocha ganache-cli web3@1.0.0-beta.26
npm install mocha ganache-cli web3
 
  • deployment ( script )
truffle

code examples references source code of the smart contracts

syntax highlighters

Open the package installation manager in atom and search for 'language-ethereum'. After installing the package, you might have to manually change the highlighter in the .sol file. Look for the selector at the bottom right of your editor window.

Sublime VSCode Webstorm VIM

array types

  • fixed array
uint[5] exampleOfFixedArray;
  • dynamic array
string[] public exampleOfDynamicPublicArray;

function types

  • public/private ( default - public )
  • view/constant ( return field, return constant)
  • pure ( don't use any contract-variables to manipulate, 'pure' functions )
  • payable

useful functions

  • eccak256
built in, which is a version of SHA3. A hash function basically maps an input string into a random 256-bit hexidecimal number.
example:
//b1f078126895a1424524de5321b339ab00408010b7cf0e6ed451514981e58aa9
keccak256("aaaac");