
Debank 中文交互教程
大多数人已经知道了Debank及其工作原理。这是一个具有社交排名的投资组合跟踪器网站。重要的是Debank 还没有发币。本文是讨论如何尽早参与该项目的指南。 内容包括: •创建个人资料和排名。 •Debank layer 2帐户创建。 •关于“ Debank HI” •体验“HI” •投票治理 一.创建个人资料和排名细节。 1- 连接钱包: < https://debank.com> 2- 连接您的Twitter帐户并验证您的电子邮件ID。 3- 尽量提高您的积分,并至少在前25000名用户中。4 - 以下是排名系统如何工作以及如何赚取一些积分的指南:Web3 Social Ranking rules | NotionWhat is Web3 Social Ranking?https://fortune-secretary-199.notion.site排名系统聚焦点: a.账户余额尽量保持至少1000U的余额。 b.增加你在以太坊和第2层的交互频次。 C.更多关注者=更多的积分。 二、Debank第2层帐户创建: 1- 注册: < https://debank.com/acco...
撸空投服务器的一些基本知识
前言:由于现在的撸毛教程越来越多,撸毛越来越卷,一些拉人头或者简单的测试网交互的撸毛任务获得的奖励越来越少,多数撸毛党开始进阶学习之路,开始做一些项目的激励测试网搭建节点的空投任务,毕竟门槛提高了参与的人就少了,获得的官方空投就多了。 但是由于很多小白没有接触过编程知识,导致做一些关于服务器相关的空投激励任务时难以下手,很多概念非常模糊,所以望而却步,错失很多好的空投大毛(如之前的Apt、Hft等项目)。 所以这里写一篇关于服务器知识的普及教程,不深入讲,小白们大概明白一些概念就可以,这样就能顺利按照一些搭建测试网节点相关的空投教程来正确使用服务器。关于服务器的基础知识(纯小白解释,浅尝辄止)一. 服务器是什么?百科解释:服务器是计算机的一种,它比普通计算机运行更快、负载更高、价格更贵。服务器在网络中为其它客户机(如PC机、智能手机、ATM等终端甚至是火车系统等大型设备)提供计算或者应用服务。服务器具有高速的CPU运算能力、长时间的可靠运行、强大的I/O外部数据吞吐能力以及更好的扩展性。 简单理解:服务器就是高性能的电脑。二. 云服务器是什么?百科解释:云服务器是一种简单高效、安...

Aleo Prover节点搭建教程
1.简介Aleo 是第一个支持私有和可编程应用程序的去中心化开源平台。 使用零知识证明协议,提供更私密和更个性化的 Web 体验。可以在不透露信息本身的情况下证明某事的真实性。 Aleo 已获得2亿美金的B轮融资,与Aptos、Sui等明星公链量级相当。Aptos的测试网给参与节点搭建者空投了300APT,价值6000U。因此Aleo理论上也是妥妥的大毛。 Aleo官方discord 明牌空投:Aleo官方discord关于空投的说明Aleo官方discord关于空投的说明 2500万个Aleo代币,将分配给开发者、白帽测试、证明者(我们现在要做的)和验证者。 具体的分配规则尚不清晰,请斟酌投入成本,自行判断是否参与。 Testnet 3的第二阶段 prover 已于 2022年11月10日开启,目前是准备阶段,4-8周后正式开始。2.构建指南2.1 要求 以下是运行 Aleo 节点的最低要求: CPU : 16 核 (首选 32 核) RAM:16GB内存(32GB优先) 存储:128GB 磁盘空间 网络:10 Mbps的上传和下载带宽 系统:Ubuntu 20.04...
Try to be a financial independencer.

Debank 中文交互教程
大多数人已经知道了Debank及其工作原理。这是一个具有社交排名的投资组合跟踪器网站。重要的是Debank 还没有发币。本文是讨论如何尽早参与该项目的指南。 内容包括: •创建个人资料和排名。 •Debank layer 2帐户创建。 •关于“ Debank HI” •体验“HI” •投票治理 一.创建个人资料和排名细节。 1- 连接钱包: < https://debank.com> 2- 连接您的Twitter帐户并验证您的电子邮件ID。 3- 尽量提高您的积分,并至少在前25000名用户中。4 - 以下是排名系统如何工作以及如何赚取一些积分的指南:Web3 Social Ranking rules | NotionWhat is Web3 Social Ranking?https://fortune-secretary-199.notion.site排名系统聚焦点: a.账户余额尽量保持至少1000U的余额。 b.增加你在以太坊和第2层的交互频次。 C.更多关注者=更多的积分。 二、Debank第2层帐户创建: 1- 注册: < https://debank.com/acco...
撸空投服务器的一些基本知识
前言:由于现在的撸毛教程越来越多,撸毛越来越卷,一些拉人头或者简单的测试网交互的撸毛任务获得的奖励越来越少,多数撸毛党开始进阶学习之路,开始做一些项目的激励测试网搭建节点的空投任务,毕竟门槛提高了参与的人就少了,获得的官方空投就多了。 但是由于很多小白没有接触过编程知识,导致做一些关于服务器相关的空投激励任务时难以下手,很多概念非常模糊,所以望而却步,错失很多好的空投大毛(如之前的Apt、Hft等项目)。 所以这里写一篇关于服务器知识的普及教程,不深入讲,小白们大概明白一些概念就可以,这样就能顺利按照一些搭建测试网节点相关的空投教程来正确使用服务器。关于服务器的基础知识(纯小白解释,浅尝辄止)一. 服务器是什么?百科解释:服务器是计算机的一种,它比普通计算机运行更快、负载更高、价格更贵。服务器在网络中为其它客户机(如PC机、智能手机、ATM等终端甚至是火车系统等大型设备)提供计算或者应用服务。服务器具有高速的CPU运算能力、长时间的可靠运行、强大的I/O外部数据吞吐能力以及更好的扩展性。 简单理解:服务器就是高性能的电脑。二. 云服务器是什么?百科解释:云服务器是一种简单高效、安...

Aleo Prover节点搭建教程
1.简介Aleo 是第一个支持私有和可编程应用程序的去中心化开源平台。 使用零知识证明协议,提供更私密和更个性化的 Web 体验。可以在不透露信息本身的情况下证明某事的真实性。 Aleo 已获得2亿美金的B轮融资,与Aptos、Sui等明星公链量级相当。Aptos的测试网给参与节点搭建者空投了300APT,价值6000U。因此Aleo理论上也是妥妥的大毛。 Aleo官方discord 明牌空投:Aleo官方discord关于空投的说明Aleo官方discord关于空投的说明 2500万个Aleo代币,将分配给开发者、白帽测试、证明者(我们现在要做的)和验证者。 具体的分配规则尚不清晰,请斟酌投入成本,自行判断是否参与。 Testnet 3的第二阶段 prover 已于 2022年11月10日开启,目前是准备阶段,4-8周后正式开始。2.构建指南2.1 要求 以下是运行 Aleo 节点的最低要求: CPU : 16 核 (首选 32 核) RAM:16GB内存(32GB优先) 存储:128GB 磁盘空间 网络:10 Mbps的上传和下载带宽 系统:Ubuntu 20.04...
Try to be a financial independencer.

Subscribe to ChiefDavid

Subscribe to ChiefDavid
>100 subscribers
>100 subscribers
Share Dialog
Share Dialog
2019年12月,Alchemy完成1500万美元A轮融资,资方为Pantera Capital,斯坦福大学,Coinbase,三星等。
2021年4月,Alchemy以5.05亿美元估值完成8000万美元B轮融资,Coatue和Addition领投,DFJ Growth、K5 Global、Chainsmokers(烟鬼组合)、演员Jared Leto和Glazer家族参投。
2021年10月,Alchemy以35亿美元估值完成2.5亿美元C轮融资,由a16z领投的。
2022年2月,Alchemy以102亿美元估值完成2亿美元融资,Lightspeed与Silver Lake领投。
Alchemy是一个背景强大、经费充足、踏实做事、没有发币的团队,这样的项目不刷,难道去刷土狗吗?
并且,Alchemy计划将新资金用于推广Web3采用,这方面的一些举措包括推出Web3 University,就是现在的 Road to Web3 活动,活动为期10周,每周一个NFT。看了下nft数量极少,估计由于任务难度大,很多小伙伴直接放弃,这样的项目若是空投,绝对是大毛。

官方原版教程链接,其中有长达1小时30分钟的视频教程还有大篇幅的文字教程,并且有错误。我按照我的做法给大家一个易于操作的图文教程。
先按照上述教程安装Nodejs,共分为5步,前3步做完就正常了,我没有做第4和第5步,不放心可以做一下。最新版本号如下:

再按照这个教程安装VScode。
1.按win+R调出命令框,输入cmd,进入控制台。

2.输入mkdir BuyMeACoffee-contracts按回车创建文件夹,再输入cd BuyMeACoffee-contracts 按回车进入该文件夹。

3.输入npm init -y 开始新项目。

4.输入npx hardhat创建示例项目。

5.之后连按三下回车,出现下图。

6.按照提示输入下面代码,坐等安装完毕。出现警告不管。
npm install --save-dev "hardhat@^2.10.1" "@nomicfoundation/hardhat-toolbox@^1.0.1"

7.打开vscode,点击file,点击open folder。

8.找到刚才创建的BuyMeACoffee-contracts文件夹,点击选择文件夹。

9.打开后如图所示。

10.右键rename将合约文件lock.sol重命名为 BuyMeACoffee.sol

11.BuyMeACoffee.sol代码替换成下面的并保存!(不保存没用啊,要点保存)
//SPDX-License-Identifier: Unlicense
// contracts/BuyMeACoffee.sol
pragma solidity ^0.8.0;
// Switch this to your own contract address once deployed, for bookkeeping!
// Example Contract Address on Goerli: 0xDBa03676a2fBb6711CB652beF5B7416A53c1421D
contract BuyMeACoffee {
// Event to emit when a Memo is created.
event NewMemo(
address indexed from,
uint256 timestamp,
string name,
string message
);
// Memo struct.
struct Memo {
address from;
uint256 timestamp;
string name;
string message;
}
// Address of contract deployer. Marked payable so that
// we can withdraw to this address later.
address payable owner;
// List of all memos received from coffee purchases.
Memo[] memos;
constructor() {
// Store the address of the deployer as a payable address.
// When we withdraw funds, we'll withdraw here.
owner = payable(msg.sender);
}
/**
* @dev fetches all stored memos
*/
function getMemos() public view returns (Memo[] memory) {
return memos;
}
/**
* @dev buy a coffee for owner (sends an ETH tip and leaves a memo)
* @param _name name of the coffee purchaser
* @param _message a nice message from the purchaser
*/
function buyCoffee(string memory _name, string memory _message) public payable {
// Must accept more than 0 ETH for a coffee.
require(msg.value > 0, "can't buy coffee for free!");
// Add the memo to storage!
memos.push(Memo(
msg.sender,
block.timestamp,
_name,
_message
));
// Emit a NewMemo event with details about the memo.
emit NewMemo(
msg.sender,
block.timestamp,
_name,
_message
);
}
/**
* @dev send the entire balance stored in this contract to the owner
*/
function withdrawTips() public {
require(owner.send(address(this).balance));
}
}
1.将deploy.js重命名为buy-coffee.js
并将代码替换成下面的:(不保存没用啊,要点保存)
const hre = require("hardhat");
// Returns the Ether balance of a given address.
async function getBalance(address) {
const balanceBigInt = await hre.ethers.provider.getBalance(address);
return hre.ethers.utils.formatEther(balanceBigInt);
}
// Logs the Ether balances for a list of addresses.
async function printBalances(addresses) {
let idx = 0;
for (const address of addresses) {
console.log(`Address ${idx} balance: `, await getBalance(address));
idx ++;
}
}
// Logs the memos stored on-chain from coffee purchases.
async function printMemos(memos) {
for (const memo of memos) {
const timestamp = memo.timestamp;
const tipper = memo.name;
const tipperAddress = memo.from;
const message = memo.message;
console.log(`At ${timestamp}, ${tipper} (${tipperAddress}) said: "${message}"`);
}
}
async function main() {
// Get the example accounts we'll be working with.
const [owner, tipper, tipper2, tipper3] = await hre.ethers.getSigners();
// We get the contract to deploy.
const BuyMeACoffee = await hre.ethers.getContractFactory("BuyMeACoffee");
const buyMeACoffee = await BuyMeACoffee.deploy();
// Deploy the contract.
await buyMeACoffee.deployed();
console.log("BuyMeACoffee deployed to:", buyMeACoffee.address);
// Check balances before the coffee purchase.
const addresses = [owner.address, tipper.address, buyMeACoffee.address];
console.log("== start ==");
await printBalances(addresses);
// Buy the owner a few coffees.
const tip = {value: hre.ethers.utils.parseEther("1")};
await buyMeACoffee.connect(tipper).buyCoffee("Carolina", "You're the best!", tip);
await buyMeACoffee.connect(tipper2).buyCoffee("Vitto", "Amazing teacher", tip);
await buyMeACoffee.connect(tipper3).buyCoffee("Kay", "I love my Proof of Knowledge", tip);
// Check balances after the coffee purchase.
console.log("== bought coffee ==");
await printBalances(addresses);
// Withdraw.
await buyMeACoffee.connect(owner).withdrawTips();
// Check balances after withdrawal.
console.log("== withdrawTips ==");
await printBalances(addresses);
// Check out the memos.
console.log("== memos ==");
const memos = await buyMeACoffee.getMemos();
printMemos(memos);
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
如果你粘贴的是官网的,记得把第五行那个位置换成ethers!!!(如下图所示)

2.在控制台输入npx hardhat run scripts/buy-coffee.js,出现下图就对了。

1.右键点击scipts,点击new file,创建一个名为deploy.js的文件。


2.在deploy.js中粘贴以下代码。(不保存没用啊,要点保存)
// scripts/deploy.js
const hre = require("hardhat");
async function main() {
// We get the contract to deploy.
const BuyMeACoffee = await hre.ethers.getContractFactory("BuyMeACoffee");
const buyMeACoffee = await BuyMeACoffee.deploy();
await buyMeACoffee.deployed();
console.log("BuyMeACoffee deployed to:", buyMeACoffee.address);
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
3.在控制台输入npx hardhat run scripts/deploy.js ,并按回车,出现下面那句BuyMeACoffee deployed to: 0x5FbDB2315678afecb367f032d93F642f64180aa3就对了。

4.打开你的 hardhat.config.js文件,您将看到一些示例部署代码。 删除它并将此版本粘贴到其中。记得保存。
// hardhat.config.js
require("@nomiclabs/hardhat-ethers");
require("@nomiclabs/hardhat-waffle");
require("dotenv").config()
// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more
const GOERLI_URL = process.env.GOERLI_URL;
const PRIVATE_KEY = process.env.PRIVATE_KEY;
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: "0.8.4",
networks: {
goerli: {
url: GOERLI_URL,
accounts: [PRIVATE_KEY]
}
}
};
5.在控制台输入npm install dotenv,安装dotenv。如图所示。

6.在控制台输入echo test>.env 创建一个.env文件

在这里可以看到。

7.将以下代码粘贴进.env
GOERLI_URL=https://eth-goerli.alchemyapi.io/v2/<your api key>
GOERLI_API_KEY=<your api key>
PRIVATE_KEY=<your metamask api key>

注意:第7步的这三行代码不是最终的,三行全部要换成自己对应的链接,在哪里找,往下看。
8.替换GOERLI_URL。
注册一个 Alchemy帐户。进入dashboard,点击create app。

然后如下设置,点击create app。

点击view key

复制HTTPS的框内内容,切换到vscode,粘贴到如下位置。


9.替换GOERLI_API_KEY。
将API KEY框内内容复制,然后切换到vscode粘贴到如下位置。


10.替换PRIVATE_KEY。
点击metamask右上角三个点,然后点击账户详情。

点击导出私钥。

将下图内容复制。

粘贴到这里,然后保存。

11.访问 https://www.goerlifaucet.com 并使用您的 Alchemy 帐户登录以获得一些免费的测试以太币。

12.运行部署脚本npx hardhat run scripts/deploy.js --network goerli ,发现报错,把缺的这个装上去就好了,见13步。

13.直接输入npm install --save-dev @nomiclabs/hardhat-waffle 安装第11步的缺的包。安装时有一堆warn不需要管。

14.再运行npx hardhat run scripts/deploy.js --network goerli ,出现下面那行BuyMeACoffee deployed to: 某个地址(这个地址记得复制粘贴下来)就对了。

1.右键点击script创建withdraw.js文件,将下列代码粘贴进去。
// scripts/withdraw.js
const hre = require("hardhat");
const abi = require("../artifacts/contracts/BuyMeACoffee.sol/BuyMeACoffee.json");
async function getBalance(provider, address) {
const balanceBigInt = await provider.getBalance(address);
return hre.ethers.utils.formatEther(balanceBigInt);
}
async function main() {
// Get the contract that has been deployed to Goerli.
const contractAddress="0xDBa03676a2fBb6711CB652beF5B7416A53c1421D";
const contractABI = abi.abi;
// Get the node connection and wallet connection.
const provider = new hre.ethers.providers.AlchemyProvider("goerli", process.env.GOERLI_API_KEY);
// Ensure that signer is the SAME address as the original contract deployer,
// or else this script will fail with an error.
const signer = new hre.ethers.Wallet(process.env.PRIVATE_KEY, provider);
// Instantiate connected contract.
const buyMeACoffee = new hre.ethers.Contract(contractAddress, contractABI, signer);
// Check starting balances.
console.log("current balance of owner: ", await getBalance(provider, signer.address), "ETH");
const contractBalance = await getBalance(provider, buyMeACoffee.address);
console.log("current balance of contract: ", await getBalance(provider, buyMeACoffee.address), "ETH");
// Withdraw funds if there are funds to withdraw.
if (contractBalance !== "0.0") {
console.log("withdrawing funds..")
const withdrawTxn = await buyMeACoffee.withdrawTips();
await withdrawTxn.wait();
} else {
console.log("no funds to withdraw!");
}
// Check ending balance.
console.log("current balance of owner: ", await getBalance(provider, signer.address), "ETH");
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
如图所示,记得保存。

2.在控制台输入npx hardhat run scripts/withdraw.js ,运行后如下图就行。

1.在此处访问官方示例项目,并创建您自己的副本以进行修改: 官方示例项目

2.点击fork repl。

3.进入该界面,没用过replit的要注册一下。

4.下面那一串合约地址换成你在step4 的第14步得到的BuyMeACoffee deployed to:冒号后面的地址。

5.在 pages/index.js 中按ctrl+f将名称字符串更新为您自己的名称。

6.点击run,出现如图所示即可。

7.点击publish。

8.一直点下一步,最后publish即可。






这张图链接记得保存.

9.进入自己创建的网站试着几笔打赏就可以了。

提交链接。
注意,最后一步提交内容为
step4 第14步的地址;
step6第8步最后一张图的链接;
你自己的replit主页链接。
领取链接。
2019年12月,Alchemy完成1500万美元A轮融资,资方为Pantera Capital,斯坦福大学,Coinbase,三星等。
2021年4月,Alchemy以5.05亿美元估值完成8000万美元B轮融资,Coatue和Addition领投,DFJ Growth、K5 Global、Chainsmokers(烟鬼组合)、演员Jared Leto和Glazer家族参投。
2021年10月,Alchemy以35亿美元估值完成2.5亿美元C轮融资,由a16z领投的。
2022年2月,Alchemy以102亿美元估值完成2亿美元融资,Lightspeed与Silver Lake领投。
Alchemy是一个背景强大、经费充足、踏实做事、没有发币的团队,这样的项目不刷,难道去刷土狗吗?
并且,Alchemy计划将新资金用于推广Web3采用,这方面的一些举措包括推出Web3 University,就是现在的 Road to Web3 活动,活动为期10周,每周一个NFT。看了下nft数量极少,估计由于任务难度大,很多小伙伴直接放弃,这样的项目若是空投,绝对是大毛。

官方原版教程链接,其中有长达1小时30分钟的视频教程还有大篇幅的文字教程,并且有错误。我按照我的做法给大家一个易于操作的图文教程。
先按照上述教程安装Nodejs,共分为5步,前3步做完就正常了,我没有做第4和第5步,不放心可以做一下。最新版本号如下:

再按照这个教程安装VScode。
1.按win+R调出命令框,输入cmd,进入控制台。

2.输入mkdir BuyMeACoffee-contracts按回车创建文件夹,再输入cd BuyMeACoffee-contracts 按回车进入该文件夹。

3.输入npm init -y 开始新项目。

4.输入npx hardhat创建示例项目。

5.之后连按三下回车,出现下图。

6.按照提示输入下面代码,坐等安装完毕。出现警告不管。
npm install --save-dev "hardhat@^2.10.1" "@nomicfoundation/hardhat-toolbox@^1.0.1"

7.打开vscode,点击file,点击open folder。

8.找到刚才创建的BuyMeACoffee-contracts文件夹,点击选择文件夹。

9.打开后如图所示。

10.右键rename将合约文件lock.sol重命名为 BuyMeACoffee.sol

11.BuyMeACoffee.sol代码替换成下面的并保存!(不保存没用啊,要点保存)
//SPDX-License-Identifier: Unlicense
// contracts/BuyMeACoffee.sol
pragma solidity ^0.8.0;
// Switch this to your own contract address once deployed, for bookkeeping!
// Example Contract Address on Goerli: 0xDBa03676a2fBb6711CB652beF5B7416A53c1421D
contract BuyMeACoffee {
// Event to emit when a Memo is created.
event NewMemo(
address indexed from,
uint256 timestamp,
string name,
string message
);
// Memo struct.
struct Memo {
address from;
uint256 timestamp;
string name;
string message;
}
// Address of contract deployer. Marked payable so that
// we can withdraw to this address later.
address payable owner;
// List of all memos received from coffee purchases.
Memo[] memos;
constructor() {
// Store the address of the deployer as a payable address.
// When we withdraw funds, we'll withdraw here.
owner = payable(msg.sender);
}
/**
* @dev fetches all stored memos
*/
function getMemos() public view returns (Memo[] memory) {
return memos;
}
/**
* @dev buy a coffee for owner (sends an ETH tip and leaves a memo)
* @param _name name of the coffee purchaser
* @param _message a nice message from the purchaser
*/
function buyCoffee(string memory _name, string memory _message) public payable {
// Must accept more than 0 ETH for a coffee.
require(msg.value > 0, "can't buy coffee for free!");
// Add the memo to storage!
memos.push(Memo(
msg.sender,
block.timestamp,
_name,
_message
));
// Emit a NewMemo event with details about the memo.
emit NewMemo(
msg.sender,
block.timestamp,
_name,
_message
);
}
/**
* @dev send the entire balance stored in this contract to the owner
*/
function withdrawTips() public {
require(owner.send(address(this).balance));
}
}
1.将deploy.js重命名为buy-coffee.js
并将代码替换成下面的:(不保存没用啊,要点保存)
const hre = require("hardhat");
// Returns the Ether balance of a given address.
async function getBalance(address) {
const balanceBigInt = await hre.ethers.provider.getBalance(address);
return hre.ethers.utils.formatEther(balanceBigInt);
}
// Logs the Ether balances for a list of addresses.
async function printBalances(addresses) {
let idx = 0;
for (const address of addresses) {
console.log(`Address ${idx} balance: `, await getBalance(address));
idx ++;
}
}
// Logs the memos stored on-chain from coffee purchases.
async function printMemos(memos) {
for (const memo of memos) {
const timestamp = memo.timestamp;
const tipper = memo.name;
const tipperAddress = memo.from;
const message = memo.message;
console.log(`At ${timestamp}, ${tipper} (${tipperAddress}) said: "${message}"`);
}
}
async function main() {
// Get the example accounts we'll be working with.
const [owner, tipper, tipper2, tipper3] = await hre.ethers.getSigners();
// We get the contract to deploy.
const BuyMeACoffee = await hre.ethers.getContractFactory("BuyMeACoffee");
const buyMeACoffee = await BuyMeACoffee.deploy();
// Deploy the contract.
await buyMeACoffee.deployed();
console.log("BuyMeACoffee deployed to:", buyMeACoffee.address);
// Check balances before the coffee purchase.
const addresses = [owner.address, tipper.address, buyMeACoffee.address];
console.log("== start ==");
await printBalances(addresses);
// Buy the owner a few coffees.
const tip = {value: hre.ethers.utils.parseEther("1")};
await buyMeACoffee.connect(tipper).buyCoffee("Carolina", "You're the best!", tip);
await buyMeACoffee.connect(tipper2).buyCoffee("Vitto", "Amazing teacher", tip);
await buyMeACoffee.connect(tipper3).buyCoffee("Kay", "I love my Proof of Knowledge", tip);
// Check balances after the coffee purchase.
console.log("== bought coffee ==");
await printBalances(addresses);
// Withdraw.
await buyMeACoffee.connect(owner).withdrawTips();
// Check balances after withdrawal.
console.log("== withdrawTips ==");
await printBalances(addresses);
// Check out the memos.
console.log("== memos ==");
const memos = await buyMeACoffee.getMemos();
printMemos(memos);
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
如果你粘贴的是官网的,记得把第五行那个位置换成ethers!!!(如下图所示)

2.在控制台输入npx hardhat run scripts/buy-coffee.js,出现下图就对了。

1.右键点击scipts,点击new file,创建一个名为deploy.js的文件。


2.在deploy.js中粘贴以下代码。(不保存没用啊,要点保存)
// scripts/deploy.js
const hre = require("hardhat");
async function main() {
// We get the contract to deploy.
const BuyMeACoffee = await hre.ethers.getContractFactory("BuyMeACoffee");
const buyMeACoffee = await BuyMeACoffee.deploy();
await buyMeACoffee.deployed();
console.log("BuyMeACoffee deployed to:", buyMeACoffee.address);
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
3.在控制台输入npx hardhat run scripts/deploy.js ,并按回车,出现下面那句BuyMeACoffee deployed to: 0x5FbDB2315678afecb367f032d93F642f64180aa3就对了。

4.打开你的 hardhat.config.js文件,您将看到一些示例部署代码。 删除它并将此版本粘贴到其中。记得保存。
// hardhat.config.js
require("@nomiclabs/hardhat-ethers");
require("@nomiclabs/hardhat-waffle");
require("dotenv").config()
// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more
const GOERLI_URL = process.env.GOERLI_URL;
const PRIVATE_KEY = process.env.PRIVATE_KEY;
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
solidity: "0.8.4",
networks: {
goerli: {
url: GOERLI_URL,
accounts: [PRIVATE_KEY]
}
}
};
5.在控制台输入npm install dotenv,安装dotenv。如图所示。

6.在控制台输入echo test>.env 创建一个.env文件

在这里可以看到。

7.将以下代码粘贴进.env
GOERLI_URL=https://eth-goerli.alchemyapi.io/v2/<your api key>
GOERLI_API_KEY=<your api key>
PRIVATE_KEY=<your metamask api key>

注意:第7步的这三行代码不是最终的,三行全部要换成自己对应的链接,在哪里找,往下看。
8.替换GOERLI_URL。
注册一个 Alchemy帐户。进入dashboard,点击create app。

然后如下设置,点击create app。

点击view key

复制HTTPS的框内内容,切换到vscode,粘贴到如下位置。


9.替换GOERLI_API_KEY。
将API KEY框内内容复制,然后切换到vscode粘贴到如下位置。


10.替换PRIVATE_KEY。
点击metamask右上角三个点,然后点击账户详情。

点击导出私钥。

将下图内容复制。

粘贴到这里,然后保存。

11.访问 https://www.goerlifaucet.com 并使用您的 Alchemy 帐户登录以获得一些免费的测试以太币。

12.运行部署脚本npx hardhat run scripts/deploy.js --network goerli ,发现报错,把缺的这个装上去就好了,见13步。

13.直接输入npm install --save-dev @nomiclabs/hardhat-waffle 安装第11步的缺的包。安装时有一堆warn不需要管。

14.再运行npx hardhat run scripts/deploy.js --network goerli ,出现下面那行BuyMeACoffee deployed to: 某个地址(这个地址记得复制粘贴下来)就对了。

1.右键点击script创建withdraw.js文件,将下列代码粘贴进去。
// scripts/withdraw.js
const hre = require("hardhat");
const abi = require("../artifacts/contracts/BuyMeACoffee.sol/BuyMeACoffee.json");
async function getBalance(provider, address) {
const balanceBigInt = await provider.getBalance(address);
return hre.ethers.utils.formatEther(balanceBigInt);
}
async function main() {
// Get the contract that has been deployed to Goerli.
const contractAddress="0xDBa03676a2fBb6711CB652beF5B7416A53c1421D";
const contractABI = abi.abi;
// Get the node connection and wallet connection.
const provider = new hre.ethers.providers.AlchemyProvider("goerli", process.env.GOERLI_API_KEY);
// Ensure that signer is the SAME address as the original contract deployer,
// or else this script will fail with an error.
const signer = new hre.ethers.Wallet(process.env.PRIVATE_KEY, provider);
// Instantiate connected contract.
const buyMeACoffee = new hre.ethers.Contract(contractAddress, contractABI, signer);
// Check starting balances.
console.log("current balance of owner: ", await getBalance(provider, signer.address), "ETH");
const contractBalance = await getBalance(provider, buyMeACoffee.address);
console.log("current balance of contract: ", await getBalance(provider, buyMeACoffee.address), "ETH");
// Withdraw funds if there are funds to withdraw.
if (contractBalance !== "0.0") {
console.log("withdrawing funds..")
const withdrawTxn = await buyMeACoffee.withdrawTips();
await withdrawTxn.wait();
} else {
console.log("no funds to withdraw!");
}
// Check ending balance.
console.log("current balance of owner: ", await getBalance(provider, signer.address), "ETH");
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
如图所示,记得保存。

2.在控制台输入npx hardhat run scripts/withdraw.js ,运行后如下图就行。

1.在此处访问官方示例项目,并创建您自己的副本以进行修改: 官方示例项目

2.点击fork repl。

3.进入该界面,没用过replit的要注册一下。

4.下面那一串合约地址换成你在step4 的第14步得到的BuyMeACoffee deployed to:冒号后面的地址。

5.在 pages/index.js 中按ctrl+f将名称字符串更新为您自己的名称。

6.点击run,出现如图所示即可。

7.点击publish。

8.一直点下一步,最后publish即可。






这张图链接记得保存.

9.进入自己创建的网站试着几笔打赏就可以了。

提交链接。
注意,最后一步提交内容为
step4 第14步的地址;
step6第8步最后一张图的链接;
你自己的replit主页链接。
领取链接。
No activity yet