Skip to main content

Posts

Showing posts from July, 2023

Smart contract with remix IDE and Ganache

  Previous Topic:  Simple transaction with ganache using Golang In the Previous topic, we learned how to do transaction with ganache using Golang. Now, we will learn what is smart contract and how to write smart contract and how to deploy it and how to call the contract using remix. To learn what is smart contract, we already write a blog about that. Please feel free to take a look.  Ethereum Smart contract . For beginners, use the Remix IDE for learning smart contract and understand how it works. Then we will use Truffle framework. REMIX:  Remix IDE Link Remix will provide a default workspace for developing smart contract. Now you can able to create a new file and start writing contracts, compile it with solidity compiler and deploy that contract and test the contracts. Simple Smart Contract: First create new file called store.sol  and start writing a simple contract. Contract Functionality: Store a record using SetRecord method. View the latest record . [reco...

Transactions on Ganache using Golang

  Previous Topic:  Connect to Ganache using golang In the pervious topic, we showed how to connect with ganache and retrieving balance for the account using Golang. Now, we are going to transfer some ethers from one account to another account using Golang. Transfer Fund: Here we are going to transfer 5 ethers, From Address :  0x532205E897418D09F2C0253E5A31e666eE87cb1A To Address :  0x3fCf008C3d40C0af410CD122F00eFA77288A2E13 Each account has balance of 100 eth. First, we need to find the nonce of the From Address and generate the unsigned raw transaction and using the private key of the From Address sign the unsigned raw transaction.  To get the Private Key follow the steps: 1. Click the show keys. 2. We will able to see the private key details of the respective address. After Signing the transaction, we need to broadcast that signed transaction in the network. package main import ( "context" "fmt" "log" "math/big" "strings" ...