I assume that you have read a lot about the block chain technology and where it can be applied. Now you must be wondering where should I develop the Smart Contract and run the program
Do I need to,
- Spent Ether to run program on Ethereum main network to test it
- Download the Ethereum wallet and connect to Ropsten or Rinkeby test network? Even if you connect to it and download the data from the peers you will find difficulty to execute the program.
Answer is no
Here are the simple steps you need to follow in order to run your first Hello World! etherum smart contract.
Overall Architecture
Step 1 : Setting up testrpc virtual environment
Download the Ethereumjs test rpc Docker image & run it. If you haven’t already installed docker engine follow this instruction.
docker pull silentinfotech/ethereumjs-testrpc
docker run -d -p 8545:8545 silentinfotech/ethereumjs-testrpc:latest -a 10 –debug
When you run the docker it will start the docker container and will forward port 8545 to it. testrpc is Node.js based ethereum client for development and testing. Find more information on testrpc from here
Step 2 : Remix IDE
We will use the remix IDE for the ethereum smart contract( In developer language program) development. Navigate to https://remix.ethereum.org/ and allow unsafe script to load.
As a part of first program, We will run hello world “Your first citizen: the greeter” program from ethereum.org. Find more information about hello world program from here
Step 3 : Copy & Paste Hello world contract
Copy “Your first citizen: the greeter” program and paste it on remix IDE window. Contract will be compiled automatically if Auto compile is selected already. Ignore the warning(s) for now.
Step 4 : Run program
Navigate to Run tab from top right corner. Choose Web3 Provider as environment. Enter appropriate URL – if you are running docker on local computer you won’t need to change the url. We are now connected to testrpc ethereum test environment. We can find the account dropdown auto populated with all test accounts with having 100EHR by default – which are more than sufficient to run the program. ;)
Let’s run the program,
Pass the constructor parameters in create method(e.g “Hello world!”. Click on create, Wow!!! we have generated a first block. You can even call the greet method on newly created block.
You can also read the existing blocks methods/variables by providing block address in At Address text field.
Ethereum Network Charges
In a nutshell, you will be charged when ever you/program will change the state of the variable. e.g Increment value of variable, store the value in variable, destroy value of variable. there is no charge for reading the blocks.
References
Tushar C
A seasoned tech enthusiast, holds the position of CEO at Silent Infotech and serves as the CTO at SpeedBot, an algorithmic trading platform. Renowned internationally as a speaker on emerging technologies, Tushar boasts over a decade of diverse experience in the tech industry. His journey commenced as a developer in a multinational corporation, and he later co-founded Silent Infotech alongside two other members. Tushar's expertise spans a multitude of technologies, including blockchain, AI, Python, Dotnet, and cloud solutions. He leverages his extensive knowledge to deliver a broad spectrum of enterprise solutions to businesses. A true technology master, Tushar excels in managing cloud infrastructure for large-scale enterprises. To learn more about his insights and expertise, connect with him.
Schedule Consultation with Tushar Schedule Now