Membuat dApp “Buy Me a Coffee”

Build a dApp “Buy Me a Coffee” — Weekly Learning 2

Pada artikel kali ini, akan membahas sedikit mengenai dApp Buy Me A Coffee pada jaringan Goerli ETH. Pada dApp ini pengguna bisa mengirim fake ETH sebagai tips dan menambahkan pesan singkat. Berikut adalah hasil testingnya :

Referensi github : https://github.com/ekoyanu99/BuyMeACoffee-dApp/blob/master/contracts/BuyMeACoffee.sol

Buat folder baru dengan nama BuyMeACoffee-contract atau bisa bebas

Buka folder dan lakukan inisialisasi project :

Install hardhat dan dependency yang dibutuhkan :

Buat project sampel :

Pilih project that use javascript, hapus file default smart contract dan ganti dengan BuyMeACoffee.sol sesuai pada referensi github

Install dotenv kemudian buat file .env berisi private key dan url rpc goerli

Contoh file .env

Edit file hardhat.config.js tambahkan require dotenv

Tambahkan goerli pada network

Buat file deploy.js pada folder scripts seperti berikut :

Jalankan deploy.js

Buat file withdraw.js pada folder yang sama dan deploy :

Jangan lupa untuk mengganti contractAddress pada line 13

Jalankan npm run dev atau yarn dev. Ganti contractAddress pada file index.jsx

Done …

Let’s connect together

Twitter : https://twitter.com/ekoyanu99

Github : https://github.com/ekoyanu99

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store