Linea测试网保姆式交互教程
去年 12 月,ConsenSys zkEVM 推出私人测试网,该测试网运行三个月,并在前几周内就达到了 150 万笔交易。3 月 28 日,ConsenSys zkEVM 测试网正式上线,并更名为 Linea,简单来看Linea的数据增长是很受关注的,加上ZK目前进展比较迅速. 交互准备: 1,在 Metamask 钱包里存入一点 Goerli ETH,可以点击下方网站领水 2,在 Metamask 钱包中添加 Linea 网络 配置如下: **网络:**Linea RPC 网址: **链号:**59140 货币符号:ETH Block Explorer URL: Linea 汇总和 L1Bridge:0xE87d317eB8dcc9afE24d9f63D6C760e52Bc18A40 L2桥":0xA59477f7742Ba7d51bb1E487a8540aB339d6801d Linea官网:交互教程:1,进入 Linea 的官网,点击 Bridge,先将资金从 Goerli 测试网桥接到 Linea 测试网中跳转到的是 Hop 测试网,需要先链接钱包,然后选择想要兑换的代...
The Ultimate StarkNet Airdrop Guide
StarkNet is a Layer-2 scaling solution for Ethereum that uses Zero-Knowledge proofs to bundle many transactions into a single proof, reducing the load on the Ethereum blockchain. It is one of the most promising layer-2 solutions with great potential to become the most dominant rollup on top of Ethereum. The main reason for that is this is that its underlying technology, STARK proofs, has already been battle tested and used for trading nearly $1B, processing over 380M transactions, and minting...
Unichain Sepolia
Uniswap自己搞得L2网络 https://x.com/unichain Uniswap作为以太坊DEX一哥,推出的 https://x.com/unichain 测试网还是值得体验一下的, 添加网络 名称:Unichain Sepolia 链 ID:1301 RPC URL:http://sepolia.unichain.org 货币符号:以太币 浏览器:http://sepolia.uniscan.xyz 新手保姆级 unichain教程 如下: 1. https://www.okx.com/zh-hans/web3/faucet 进入 用okx钱包领水中心领点 sepolia eth 2. 做跨链交互:进入将sepolia 跨链成 unichain 测试网的eth https://superbridge.app/unichain-sepolia3. 做发送 ETH 交互:直接打开okx钱包,搜索 unichain testnet,然后将eth发送到另一个钱包地址即可(2/) Uniswap 测试网 unichain 交互教程 做部署NFT的交互: ① 进入 https:...
Linea测试网保姆式交互教程
去年 12 月,ConsenSys zkEVM 推出私人测试网,该测试网运行三个月,并在前几周内就达到了 150 万笔交易。3 月 28 日,ConsenSys zkEVM 测试网正式上线,并更名为 Linea,简单来看Linea的数据增长是很受关注的,加上ZK目前进展比较迅速. 交互准备: 1,在 Metamask 钱包里存入一点 Goerli ETH,可以点击下方网站领水 2,在 Metamask 钱包中添加 Linea 网络 配置如下: **网络:**Linea RPC 网址: **链号:**59140 货币符号:ETH Block Explorer URL: Linea 汇总和 L1Bridge:0xE87d317eB8dcc9afE24d9f63D6C760e52Bc18A40 L2桥":0xA59477f7742Ba7d51bb1E487a8540aB339d6801d Linea官网:交互教程:1,进入 Linea 的官网,点击 Bridge,先将资金从 Goerli 测试网桥接到 Linea 测试网中跳转到的是 Hop 测试网,需要先链接钱包,然后选择想要兑换的代...
The Ultimate StarkNet Airdrop Guide
StarkNet is a Layer-2 scaling solution for Ethereum that uses Zero-Knowledge proofs to bundle many transactions into a single proof, reducing the load on the Ethereum blockchain. It is one of the most promising layer-2 solutions with great potential to become the most dominant rollup on top of Ethereum. The main reason for that is this is that its underlying technology, STARK proofs, has already been battle tested and used for trading nearly $1B, processing over 380M transactions, and minting...
Unichain Sepolia
Uniswap自己搞得L2网络 https://x.com/unichain Uniswap作为以太坊DEX一哥,推出的 https://x.com/unichain 测试网还是值得体验一下的, 添加网络 名称:Unichain Sepolia 链 ID:1301 RPC URL:http://sepolia.unichain.org 货币符号:以太币 浏览器:http://sepolia.uniscan.xyz 新手保姆级 unichain教程 如下: 1. https://www.okx.com/zh-hans/web3/faucet 进入 用okx钱包领水中心领点 sepolia eth 2. 做跨链交互:进入将sepolia 跨链成 unichain 测试网的eth https://superbridge.app/unichain-sepolia3. 做发送 ETH 交互:直接打开okx钱包,搜索 unichain testnet,然后将eth发送到另一个钱包地址即可(2/) Uniswap 测试网 unichain 交互教程 做部署NFT的交互: ① 进入 https:...
Share Dialog
Share Dialog

Subscribe to kool

Subscribe to kool
<100 subscribers
<100 subscribers
在编写代码之前,您需要设置一个 Node.js 环境,推荐使用
它是一个基于 IDE 进行编程的浏览器。
1.在 repli 上注册一个免费帐户并登录;
2.点击左上角的create创建;

3.出现提示时选择 Node.js,然后点击Create Repl。

还需要一个以太坊节点来与 Facaster Registry 合约对话。 建议使用 Alchemy 。 如果您是第一次注册,以下步骤可能会略有不同:
1.注册 Alchemy.com ,并登录。

2.选择以太坊作为区块链,点击get started。

3.team name和app name随便取,网络选择Rinkeby,点击Create APP。

4.选择第一个免费的,点击continue。

5.点击跳过。

6.继续点击跳过。

7.点击continue。

8.随便输入什么,点击let‘s go。

9.点击view details。

10.点击view key。

11.找到HTTP的URL,复制v2/后面那部分代码,将其保存在某个地方。

12.切换回 Replit 并转到右侧窗格中的 Shell 选项卡并运行以下代码:
npm install ethers got@11.8.2
这将安装 ethers ,一个用于与 Ethereum 一起工作的库, got ,一个用于发出 HTTP 请求的库。 您可能会看到一些关于缺少 package.json 的警告,您可以忽略这些警告。

1.切换到 Replit 中心窗格中的 index.js 选项卡,然后复制下面的代码片段。 确保将那一堆×换成step1 的第11步保存的代码,点击run。
const { providers, Contract, utils } = require("ethers"); const got = require("got");
const doStuff = async () => { const ALCHEMY_SECRET = 'jeb8oUMpgcUfTe0-1A7_0niISnRpmNhM'; // Replace with your secret const provider = new providers.AlchemyProvider('rinkeby', ALCHEMY_SECRET);
const block = await provider.getBlockNumber(); console.log("The latest Ethereum block is:", block);
const REGISTRY_CONTRACT_ADDRESS = '0xe3Be01D99bAa8dB9905b33a3cA391238234B79D1' const REGISTRY_ABI = [ { name: 'getDirectoryUrl', inputs: [{ internalType: 'bytes32', name: 'username', type: 'bytes32' }], outputs: [{ internalType: 'string', name: '', type: 'string'}], stateMutability: 'view', type: 'function', }, { inputs: [{ internalType: 'address', name: '', type: 'address' }], name: 'addressToUsername', outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], stateMutability: 'view', type: 'function', }, ];
const registryContract = new Contract(REGISTRY_CONTRACT_ADDRESS, REGISTRY_ABI, provider);
const username = 'v'; const byte32Name = utils.formatBytes32String(username); const directoryUrl = await registryContract.getDirectoryUrl(byte32Name); console.log(${username}'s Host is located at: ${directoryUrl} \n);
const directoryResponse = await got(directoryUrl); const directory = JSON.parse(directoryResponse.body); console.log(${username}'s Directory is: ); console.log(directory, '\n');
const addressActivityUrl = directory.body.addressActivityUrl; const addressActivityResponse = await got(addressActivityUrl); const addressActivity = JSON.parse(addressActivityResponse.body); const cast = addressActivity[0]; console.log(${username}'s most recent Cast was: ) console.log(cast, '\n');
const stringifiedCastBody = JSON.stringify(cast.body); const calculatedHash = utils.keccak256(utils.toUtf8Bytes(stringifiedCastBody)); const expectedHash = cast.merkleRoot;
if (calculatedHash !== expectedHash) { console.log(FAILED: the calculated hash ${calculatedHash} does not match the one in the cast: ${expectedHash}); } else { console.log(PASSED: the calculated hash ${calculatedHash} matches the one in the cast); }
const recoveredAddress = utils.verifyMessage(cast.merkleRoot, cast.signature); const expectedAddress = cast.body.address;
if (recoveredAddress !== expectedAddress) { console.log( Failed: the recovered address ${recoveredAddress} does not match the address provided in the cast ${expectedAddress} ); } else { console.log(PASSED: the recovered address ${recoveredAddress} matches the one in the cast); }
const encodedUsername = await registryContract.addressToUsername(expectedAddress); const expectedUsername = utils.parseBytes32String(encodedUsername); const castUsername = cast.body.username;
if (expectedUsername !== castUsername) { console.log(FAILED: ${expectedAddress} does not own ${castUsername}, it owns ${expectedUsername}); } else { console.log(PASSED: ${expectedAddress} owns ${castUsername}); } }
doStuff();
2.

如果这成功完成,您会看到如下消息:
通过:0x012D3606bAe7aebF03a04F8802c561330eAce70A 拥有 v
恭喜 - 你已经在 Farcaster 上构建了你的第一个可以读取用户消息的应用程序! 您还学习了如何验证签名,以便您可以安全地接收来自网络上任何用户的消息!
在编写代码之前,您需要设置一个 Node.js 环境,推荐使用
它是一个基于 IDE 进行编程的浏览器。
1.在 repli 上注册一个免费帐户并登录;
2.点击左上角的create创建;

3.出现提示时选择 Node.js,然后点击Create Repl。

还需要一个以太坊节点来与 Facaster Registry 合约对话。 建议使用 Alchemy 。 如果您是第一次注册,以下步骤可能会略有不同:
1.注册 Alchemy.com ,并登录。

2.选择以太坊作为区块链,点击get started。

3.team name和app name随便取,网络选择Rinkeby,点击Create APP。

4.选择第一个免费的,点击continue。

5.点击跳过。

6.继续点击跳过。

7.点击continue。

8.随便输入什么,点击let‘s go。

9.点击view details。

10.点击view key。

11.找到HTTP的URL,复制v2/后面那部分代码,将其保存在某个地方。

12.切换回 Replit 并转到右侧窗格中的 Shell 选项卡并运行以下代码:
npm install ethers got@11.8.2
这将安装 ethers ,一个用于与 Ethereum 一起工作的库, got ,一个用于发出 HTTP 请求的库。 您可能会看到一些关于缺少 package.json 的警告,您可以忽略这些警告。

1.切换到 Replit 中心窗格中的 index.js 选项卡,然后复制下面的代码片段。 确保将那一堆×换成step1 的第11步保存的代码,点击run。
const { providers, Contract, utils } = require("ethers"); const got = require("got");
const doStuff = async () => { const ALCHEMY_SECRET = 'jeb8oUMpgcUfTe0-1A7_0niISnRpmNhM'; // Replace with your secret const provider = new providers.AlchemyProvider('rinkeby', ALCHEMY_SECRET);
const block = await provider.getBlockNumber(); console.log("The latest Ethereum block is:", block);
const REGISTRY_CONTRACT_ADDRESS = '0xe3Be01D99bAa8dB9905b33a3cA391238234B79D1' const REGISTRY_ABI = [ { name: 'getDirectoryUrl', inputs: [{ internalType: 'bytes32', name: 'username', type: 'bytes32' }], outputs: [{ internalType: 'string', name: '', type: 'string'}], stateMutability: 'view', type: 'function', }, { inputs: [{ internalType: 'address', name: '', type: 'address' }], name: 'addressToUsername', outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], stateMutability: 'view', type: 'function', }, ];
const registryContract = new Contract(REGISTRY_CONTRACT_ADDRESS, REGISTRY_ABI, provider);
const username = 'v'; const byte32Name = utils.formatBytes32String(username); const directoryUrl = await registryContract.getDirectoryUrl(byte32Name); console.log(${username}'s Host is located at: ${directoryUrl} \n);
const directoryResponse = await got(directoryUrl); const directory = JSON.parse(directoryResponse.body); console.log(${username}'s Directory is: ); console.log(directory, '\n');
const addressActivityUrl = directory.body.addressActivityUrl; const addressActivityResponse = await got(addressActivityUrl); const addressActivity = JSON.parse(addressActivityResponse.body); const cast = addressActivity[0]; console.log(${username}'s most recent Cast was: ) console.log(cast, '\n');
const stringifiedCastBody = JSON.stringify(cast.body); const calculatedHash = utils.keccak256(utils.toUtf8Bytes(stringifiedCastBody)); const expectedHash = cast.merkleRoot;
if (calculatedHash !== expectedHash) { console.log(FAILED: the calculated hash ${calculatedHash} does not match the one in the cast: ${expectedHash}); } else { console.log(PASSED: the calculated hash ${calculatedHash} matches the one in the cast); }
const recoveredAddress = utils.verifyMessage(cast.merkleRoot, cast.signature); const expectedAddress = cast.body.address;
if (recoveredAddress !== expectedAddress) { console.log( Failed: the recovered address ${recoveredAddress} does not match the address provided in the cast ${expectedAddress} ); } else { console.log(PASSED: the recovered address ${recoveredAddress} matches the one in the cast); }
const encodedUsername = await registryContract.addressToUsername(expectedAddress); const expectedUsername = utils.parseBytes32String(encodedUsername); const castUsername = cast.body.username;
if (expectedUsername !== castUsername) { console.log(FAILED: ${expectedAddress} does not own ${castUsername}, it owns ${expectedUsername}); } else { console.log(PASSED: ${expectedAddress} owns ${castUsername}); } }
doStuff();
2.

如果这成功完成,您会看到如下消息:
通过:0x012D3606bAe7aebF03a04F8802c561330eAce70A 拥有 v
恭喜 - 你已经在 Farcaster 上构建了你的第一个可以读取用户消息的应用程序! 您还学习了如何验证签名,以便您可以安全地接收来自网络上任何用户的消息!
No activity yet