Skip to content

02amanag/SmartContractWithGolang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intract with Smart contract using Golang

Setup

  1. Install Ganache -> Download

  2. Install Solidity -> Docs

sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install solc
  1. Install Geth -> Docs
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum

To deply contract

$ make sol

To intract with contract run

$make run

To Check and test use postman

Import blockChain.postman_collection.json

Or curl commands

  1. to check balance :- curl --location --request GET 'http://localhost:1323/balance'
  2. to check admin address :- curl --location --request GET 'http://localhost:1323/admin'
  3. to deposite 50 abount of value from account's private key in address :-

curl --location --request POST 'http://localhost:1323/deposite/50' \ --header 'Content-Type: application/json' \ --data-raw '{ "accountPrivateKey":"fd4eef6dec5575cc78f3f14d4b749094f8b88ad7883caaa8d1d24e9a01e3732d" }'

  1. to withdrawl 10 :- curl --location --request POST 'http://localhost:1323/withdrawl/50' \ --header 'Content-Type: application/json' \ --data-raw '{ "accountPrivateKey":"fd4eef6dec5575cc78f3f14d4b749094f8b88ad7883caaa8d1d24e9a01e3732d" }'

About

how to deploy any smart contract and interact with them through API using Golang

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published