• In the form of code
• Stored on a blockchain
• Executes under given conditions
• Owner creates the contract
• Contract replicates among all the nodes
• Tenant deposits to the contract
• Contract’s State changes on all the nodes
1. Developing a simple contract
2. Compiling the contract
3. Deploying the contract
4. Interacting with the contract
5. Adding more functions to our code to make it more practical
• An open source tool for writing, compiling and testing Solidity contracts
• Object-oriented
• Contract-oriented
• High-level language
• Influenced by C++,Python, and JavaScript
• Target Ethereum Virtual Machine(EVM)
• Compile tab: Start to compile button Run tab: Environment=JavaScript VM
• JavaScriptVM:All the transactions will be executed in a sandbox blockchain in the browser. Nothing will be persisted and a page reload will restart a new blockchain from scratch,the old one will not be saved.
• InjectedProvider:Remix will connect to an injected web3 provider.Mistand Metamask are example of providers that inject web3,thustheycanbeusedwith this option.
• Web3Provider:Remixwillconnecttoaremotenode.Youwillneedtoprovide the URLaddress to the selected provider: geth, parity or any Ethereum client.
• GasLimit:Themaximumamountofgasthatcanbesetforalltheinstructionsofa contract.
• Value:Inputsomeetherwiththenextcreatedtransaction(wei=10-18ofether).
• Private: e.g., Ganache sets a personal Ethereum blockchain for running tests, executing commands, and inspecting the state while controlling how the chain operates.
• PublicTest(Testnet):Like Ropsten,Kovan and Rinkeby which are existing public blockchains used for testing and which donot use real funds.Use faucet for receiving initial virtual funds.
• Public Real(Mainnet):Like Bitcoin and Ethereum which are used for real and which available for everybody to join.
• Setter=RedButton:Createstransaction
• Getter=BlueButton:Justgivesinformation
Additional features
• Transferring funds from an account to the contract
• Saving the address of the contract creator
• Limiting the users’ access to functions
• Withdrawing funds from the contract to an account
• Transfer money to the contract
• Modifier:Conditions you want to test in other functions
• First the modifier will execute, then function
• Add your custom network that you want to test your contracts on
Import your RPC server address and the port number from Ganache toMyEtherWallet
• Contracts tab:Deploy Contract
• Type your contract and compile it
Click on Details Button:access ByteCode to import it to MyEtherWallet
Access your private key for signing your contract in MyEtherWallet
1. Paste the contract’s ByteCode fromRemix
2. Gas Limit will automatically be calculated
3. Paste your private key from Ganache
4. Click Unlock
5. Now you have access to your wallet
Click on Sign Transaction button to deploy your contract
You can see now you have one transaction for your address and your balance has been changed because of the amount of gas you paid for creating the contract.
Copy the ABI (ABI is the interface that tells MyEtherWallet how to interact with the contract)
Contracts tab:
Interact with Contract=Paste the contract address from Ganache and the ABI from Remix
You now can interact with the contract by selecting a function and invoking it
(There is no operation cost for getting information)
If you choose a function that updates the state of the contract, you will need to pay gas for it in a transaction.
• Instead of using Ganache with its default properties for private blockchain you can run your own blockchain
• Install Geth: One of the implementations of Ethereum written in Go
• Create the genesis block
• Creates to rage of the blockchain
• Deploy blockchain odes
• Connect MyEtherWallet to your blockchain to interact with it
• The first block in the chain and a json file that stores the configuration of the chain
• Create and store the file as genesis.json
• Go to the directory of the genesis.json file
• Specify directory of your blockchain
• Create the storage from the genesis block
• Geth folder:Store your database
• keystore:Store your Ethereum accounts
• Start the blockchain
• Network id provides privacy for your network.
• Other peers joining your network must use the same network id.