Skip to content

Instantly share code, notes, and snippets.

View anubhavgirdhar's full-sized avatar

Anubhav Girdhar anubhavgirdhar

View GitHub Profile
@anubhavgirdhar
anubhavgirdhar / App.js
Created May 13, 2020 14:04
Front End for a Quotes DApp to store a quote and its respective owner on the Ethereum Blockchain
async function startApp() {
const address = "0x2Fb33202f99510FD2d1f7522d8709889b7858024";
const abi = [{"constant":false,"inputs":[{"internalType":"string","name":"newQuote","type":"string"}],"name":"setQuote","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getQuote","outputs":[{"internalType":"string","name":"currentQuote","type":"string"},{"internalType":"address","name":"currentOwner","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"quote","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"}]
const contract = new web3.eth.Contract(abi, address);
await contract.methods.setQuote("This is the best tutorial in the history of tutorials ever!"
@anubhavgirdhar
anubhavgirdhar / quotes.sol
Created May 13, 2020 13:18
Smart Contract for a Quotes DApp to store a quote and its respective owner on the Ethereum Blockchain
pragma solidity ^0.5.0;
contract Quote {
string public quote;
address public owner;
function setQuote(string memory newQuote) public {
quote = newQuote;
owner = msg.sender;
}
@anubhavgirdhar
anubhavgirdhar / app.js
Created September 1, 2019 09:12
weather-app
const forecast = require('./utils/forecast')
const geocode = require('./utils/geocode')
const address = process.argv[2]
if (!address){
console.log("Please provide a valid address")
} else{
console.log(geocode(address,(error,{Latitude,Longitude,Location}) => {