{"id":173,"date":"2025-08-28T14:22:54","date_gmt":"2025-08-28T14:22:54","guid":{"rendered":"https:\/\/learn.rantissi.my.id\/?p=173"},"modified":"2025-08-28T14:22:56","modified_gmt":"2025-08-28T14:22:56","slug":"setup-proyek-web3-pertama-hardhat-metamask-node-js","status":"publish","type":"post","link":"https:\/\/learn.rantissi.my.id\/index.php\/2025\/08\/28\/setup-proyek-web3-pertama-hardhat-metamask-node-js\/","title":{"rendered":"Setup Proyek Web3 Pertama (Hardhat + MetaMask + Node.js)"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Persiapan: Apa yang Akan Kita Gunakan?<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Tools<\/th><th>Fungsi<\/th><\/tr><\/thead><tbody><tr><td><strong>Node.js<\/strong><\/td><td>Untuk menjalankan skrip JavaScript (wajib untuk Hardhat)<\/td><\/tr><tr><td><strong>Hardhat<\/strong><\/td><td>Framework smart contract (compile, test, deploy)<\/td><\/tr><tr><td><strong>MetaMask<\/strong><\/td><td>Wallet untuk interaksi dengan blockchain<\/td><\/tr><tr><td><strong>Sepolia Testnet<\/strong><\/td><td>Jaringan Ethereum gratis untuk pengujian<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Langkah 1 \u2013 Install Node.js<\/h2>\n\n\n\n<p>\ud83d\udcbb Buka terminal, lalu cek apakah sudah terinstal:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>node -v\nnpm -v\n<\/code><\/pre>\n\n\n\n<p>Kalau belum ada, silakan install dari:<br>\ud83d\udc49 <a href=\"https:\/\/nodejs.org \">https:\/\/nodejs.org <\/a>(LTS version)<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Langkah 2 \u2013 Buat Folder Proyek<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir hello-web3\ncd hello-web3\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Langkah 3 \u2013 Inisialisasi Proyek Hardhat<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>npm init -y\nnpm install --save-dev hardhat\nnpx hardhat\n<\/code><\/pre>\n\n\n\n<p>Lalu pilih:<br>\u27a1\ufe0f <strong>Create a basic sample project<\/strong><br>\u2192 Tekan enter untuk semua pilihan default<\/p>\n\n\n\n<p>Setelah selesai, kamu akan dapat struktur seperti ini:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>hello-web3\/\n\u251c\u2500\u2500 contracts\/\n\u2502   \u2514\u2500\u2500 Lock.sol\n\u251c\u2500\u2500 scripts\/\n\u2502   \u2514\u2500\u2500 deploy.js\n\u251c\u2500\u2500 test\/\n\u251c\u2500\u2500 hardhat.config.js\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Langkah 4 \u2013 Setup MetaMask &amp; Testnet<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Install MetaMask extension di browser<\/strong><\/li>\n\n\n\n<li>Buat wallet baru (jangan gunakan wallet utama)<\/li>\n\n\n\n<li>Ganti jaringan ke <strong>Sepolia testnet<\/strong><\/li>\n\n\n\n<li>Dapatkan ETH gratis:\n<ul class=\"wp-block-list\">\n<li>Kunjungi faucet resmi: <a href=\"https:\/\/sepoliafaucet.com\">https:\/\/sepoliafaucet.com<\/a><\/li>\n\n\n\n<li>Masukkan alamat wallet \u2192 klik &#8220;Send me ETH&#8221;<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>\ud83d\udca1 Sepolia ETH ini hanya untuk uji coba, <strong>tidak punya nilai uang<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Langkah 5 \u2013 Konfigurasi Jaringan Sepolia di Hardhat<\/h2>\n\n\n\n<p>Edit file <code>hardhat.config.js<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>require(\"@nomicfoundation\/hardhat-toolbox\");\n\nmodule.exports = {\n  solidity: \"0.8.20\",\n  networks: {\n    sepolia: {\n      url: \"https:\/\/eth-sepolia.g.alchemy.com\/v2\/YOUR_ALCHEMY_KEY\",\n      accounts: &#91;\"0xYOUR_PRIVATE_KEY\"]\n    }\n  }\n};\n<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Ganti:<\/p>\n<\/blockquote>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>YOUR_ALCHEMY_KEY<\/code> \u2192 dari <a href=\"https:\/\/dashboard.alchemy.com\">https:\/\/dashboard.alchemy.com<\/a> (gratis daftar)<\/li>\n\n\n\n<li><code>YOUR_PRIVATE_KEY<\/code> \u2192 private key dari MetaMask (jangan share ke siapa pun!)<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Jalankan Deploy Script (nanti kita bahas lebih lanjut)<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>npx hardhat run scripts\/deploy.js --network sepolia\n<\/code><\/pre>\n\n\n\n<p>Jika sukses, smart contract kamu akan <strong>dideploy ke blockchain Sepolia<\/strong>, dan kamu bisa cek di <a href=\"https:\/\/sepolia.etherscan.io\/\">https:\/\/sepolia.etherscan.io\/<\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Ringkasan<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u2705 Sudah install Node.js &amp; Hardhat<\/li>\n\n\n\n<li>\u2705 Sudah punya MetaMask &amp; Sepolia testnet ETH<\/li>\n\n\n\n<li>\u2705 Sudah siapkan struktur proyek<\/li>\n\n\n\n<li>\u2705 Siap untuk menulis dan deploy smart contract<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Persiapan: Apa yang Akan Kita Gunakan? Tools Fungsi Node.js Untuk menjalankan skrip JavaScript (wajib untuk Hardhat) Hardhat Framework smart contract (compile, test, deploy) MetaMask Wallet untuk interaksi dengan blockchain Sepolia Testnet Jaringan Ethereum gratis untuk pengujian Langkah 1 \u2013 Install Node.js \ud83d\udcbb Buka terminal, lalu cek apakah sudah terinstal: Kalau belum ada, silakan install dari:\ud83d\udc49&#8230;<\/p>\n","protected":false},"author":1,"featured_media":24,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,8],"tags":[],"class_list":["post-173","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-projek","category-web3-blockchain"],"_links":{"self":[{"href":"https:\/\/learn.rantissi.my.id\/index.php\/wp-json\/wp\/v2\/posts\/173","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/learn.rantissi.my.id\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/learn.rantissi.my.id\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/learn.rantissi.my.id\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/learn.rantissi.my.id\/index.php\/wp-json\/wp\/v2\/comments?post=173"}],"version-history":[{"count":2,"href":"https:\/\/learn.rantissi.my.id\/index.php\/wp-json\/wp\/v2\/posts\/173\/revisions"}],"predecessor-version":[{"id":175,"href":"https:\/\/learn.rantissi.my.id\/index.php\/wp-json\/wp\/v2\/posts\/173\/revisions\/175"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/learn.rantissi.my.id\/index.php\/wp-json\/wp\/v2\/media\/24"}],"wp:attachment":[{"href":"https:\/\/learn.rantissi.my.id\/index.php\/wp-json\/wp\/v2\/media?parent=173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/learn.rantissi.my.id\/index.php\/wp-json\/wp\/v2\/categories?post=173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/learn.rantissi.my.id\/index.php\/wp-json\/wp\/v2\/tags?post=173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}