Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
31 views32 pages

Module5 Part2.Pptx Miss

The document outlines the Ethereum development environment, emphasizing the use of local private networks or simulated environments like Ganache for testing smart contracts before deploying them on public testnets. It highlights the importance of Remix IDE for Solidity development and debugging, as well as MetaMask for managing Ethereum accounts and facilitating interactions with the blockchain. Additionally, it provides a step-by-step guide on deploying smart contracts using MetaMask and Remix IDE, including account importation and transaction confirmation.

Uploaded by

777amru
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views32 pages

Module5 Part2.Pptx Miss

The document outlines the Ethereum development environment, emphasizing the use of local private networks or simulated environments like Ganache for testing smart contracts before deploying them on public testnets. It highlights the importance of Remix IDE for Solidity development and debugging, as well as MetaMask for managing Ethereum accounts and facilitating interactions with the blockchain. Additionally, it provides a step-by-step guide on deploying smart contracts using MetaMask and Remix IDE, including account importation and transaction confirmation.

Uploaded by

777amru
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 32

Module 5

Part 2
Ethereum Development Environment
• A usual and sensible approach is to develop and test Ethereum smart contracts
either in a local private net or a simulated environment like Ganache. Then it can
be deployed on a public testnet.
• Test networks:
• The Ethereum Go client (https://geth.ethereum.org), Geth, can be connected to the
test network using the following command:

This command will connect to the Ropsten network, which is a preconfigure proof
of work (PoW) test network.
Remix IDE
• There are various Integrated Development Environments (IDEs) available for
Solidity development.
• Remix (formerly browser Solidity) is the most commonly used IDE for building
and debugging smart contracts.
• Remix is the web-based environment for the development and testing of contracts
using Solidity.
• It is a feature-rich IDE that does not run on a live blockchain; in fact, it is a
simulated environment in which contracts can be deployed, tested, and debugged.
It is available at https://remix.ethereum.org.
Remix IDE
• When we run Remix for the first time, it won't show any of the plugins. In order to add
plugins to Remix IDE, we need to access the plugin manager to activate the plugins we
need. This is shown in the following figure.
Remix IDE
• The preceding screenshot shows different elements of the Remix IDE when
DEBUGGER is running.
• On the right-hand side, the source code is shown.
• Below that is the output log, which shows informational messages and data related
to compilation and the execution status, and transaction information of the
transaction/contract.
MetaMask
• MetaMask allows interaction with Ethereum blockchain via the Firefox and
Chrome browsers.
• It injects a web3 object within the running websites’ JavaScript context, which
allows immediate interface capability for DApps.
• This injection allows DApps to interact directly with the blockchain .
• MetaMask also allows account management.
• This acts as a verification method before any transaction is executed on the
blockchain.
• The user is shown a secure interface to review the transaction for approval or
rejection before it can reach the target blockchain.
MetaMask
• An interesting feature to note is that MetaMask can connect to any Ethereum
blockchain via the custom RPC connection.
• It can connect to not only remote blockchains but also to locally running
blockchains.
• All it needs is an RPC connection exposed by a node running on the blockchain. If
it's available, MetaMask can connect and will allow a web browser to connect to it
via the web3 object.
• MetaMask can also be used to connect to a locally running test (or simulated)
blockchain like Ganache and TestRPC
MetaMask
• MetaMask allows account management and also records all transactions for these
accounts. This is shown in the following screenshot:
Using MetaMask and Remix IDE to deploy a smart contract
• Metamask is an interface between the Ethereum blockchain and the web browser.
• As MetaMask injects a web3 object into the browser, we can use it with Remix IDE
to deploy contracts to the blockchain.
• Case study: Add our local private network in MetaMask and then interact with it
using Remix IDE
• Open the Google Chrome web browser, where MetaMask is installed.
• Select Localhost 8545, where the Geth instance of our private net is listening on:
• Navigate to Remix IDE for Ethereum smart contract development on your browser
at https://remix.ethereum.org.
• Once on the website, notice the DEPLOY & RUN TRANSACTIONS option in the
left-hand column.
• Choose Injected Web3 as the Environment. This is shown in the following
screenshot on the left-hand side:
Using MetaMask and Remix IDE to deploy a smart contract

• When Remix IDE is connected to MetaMask, it will show network information,


such as Custom (786) network, and account information, as shown in the
following screenshot.
Using MetaMask and Remix IDE to deploy a smart contract
• In order for MetaMask to operate on existing accounts, we need to import them
from the existing keystore, in our case, the private network 786 keystore.
• In MetaMask, the Import Account option is available under the My Accounts
menu, as shown in the following screenshot.
Using MetaMask and Remix IDE to deploy a smart contract

• Simply browse to the key store and select the keystore file, then enter the
password and click Import.
Deploying a contract with MetaMask
Sample smart contract in Solidity
Smart contract in remix
Compile option in remix
Smart contract deployment in remix
In the Geth logs, we see Submitted contract creation , which means that a contract
creation transaction has been submitted and acknowledged as a result of the
deploy action from the Remix IDE and the Confirm action from MetaMask
Smart contract deployment in remix
• We run the addition option, enter a value of 100 in the box, and click on the
addition button, as shown in the following screenshot, on the left-hand side. This
will invoke the MetaMask window, as shown in the following screenshot, on the
right-hand side.
Smart contract deployment in remix
• Click Confirm, and the transaction will be mined as usual because we have a
miner running the background in Geth.
• Now click on the currValue button, which will read the contract to find the
current value, which is, as expected, 105
• Possible errors:
• Gas estimation failed as incorrect version of EVM entered

You might also like