Skip to main content

Posts

Showing posts with the label Ganache

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...

Connect to Ganache using Golang

Previous Topic:  Ganache Overview Connect to Ganache: We are going use the go-ethereum - ethclient package to make a connection with the ganache server using Golang. go get github.com/ethereum/go-ethereum/ethclient In the below example, we are just simply connecting with ganache server and retrieve the chain Id value from the server. package main import ( "context" "fmt" "log" "github.com/ethereum/go-ethereum/ethclient" ) func main() { client, err := ethclient.Dial("http://127.0.0.1:7545") if err != nil { log.Fatal(err) } fmt.Println("Connection with ganache successful") chainId, err := client.ChainID(context.Background()) if err != nil { log.Fatal(err) } fmt.Println("Chain Id :", chainId) } Output: Connection with ganache successful Chain Id : 1337 Retrieving Balance for the accounts: go get github.com/ethereum/go-ethereum/common In the below example, we are going to retrieve the balanc...

Ganache Workspace Overview

Previous Topic:  Ganache Installation Ethereum Workspace Overview: After the workspace created, you will able to see the server details and list of accounts. Each account has 100 ether. There were some additional interface you can access: Accounts       - list of generated accounts and their balance [default view] Blocks       - shows each block mined on the blockchain, along with gas used and transactions. Transactions       - list all the transactions on the blockchain network Contracts      - list the contracts contains in the workspace only when the workspace is connected with a             truffle project. Logs      - shows the logs for the server which is helpful for debugging  Events      - list all the events triggered since the workspace created. How to Connect with Local Ganache Server? In the Ganache UI, you can able to see the server details....

What is GANACHE and How to install?

Ganache is a personal blockchain for rapid Ethereum distributed application development. You can use Ganache across the entire development cycle; enabling you to develop, deploy, and test your dApps in a safe and deterministic environment. Ganache comes in two favours: a UI and CLI. Ganache UI is a desktop application supporting Ethereum technology. Features: Fast and efficient for testing  offers Ethereum Json RPC Mine block instantly and fast forward time Easy to use. It has UI desktop application which helps us to understand what is happening in broader view. Installation on Windows: Step 1: Go to this page:  https://trufflesuite.com/ganache/  and click the download. Step 2: Once downloaded, Open that file and click install. It will install the ganache CLI and UI desktop application on the windows. Step 3: After the installation, Ganache application is now available.  If you have problem after the installation, Go to settings -- Installed Apps -- Ganache and Scrol...