LaserCat (@lasercat) • Hey
LaserCat (@lasercat) • Hey
Publications
- Very good, love!
- Longing for life
- The first BRC721 collection is in Ordinals.
https://magiceden.io/ordinals/marketplace/bitcat
- 总结一些新的 #OrdinalsNFT #BRC20 项目,没做过研究,好坏自辩,只是提供一些 #ALPHA 信息,DYOR,小心骗子,不定期更新,自己微信视图文字提取吧,可能下次会加上 #BitcoinStamps #SRC20 的项目
- Spring!!!
- 任务平台主推的一些“热门货”, 你做做也没啥。 如果是一些不入流的, 没啥人做的“赔钱货”, 那不如多睡会觉。 虽然风浪越大鱼越贵, 但是一些项目可能明年才发币, 你这两个月就把钱亏完, 是不是就吃不到鱼了。
- NFT在现货交易方面已相对成熟,也超过十几家的交易平台,而衍生品方面才刚刚开始起步,这跟当初DeFi类似,先是DEX和借贷起来(Uniswap、Aave等),后来是衍生品(GMX、DYDX、GNS、Lyra)。NFT衍生品方面,目前有nftcall、nftperp都还处于刚开始发展的阶段,需要点时间。
- 做 #LayerZero 的时候顺便做下EigenLayer的测试网,这个叙事很大,提前埋伏:
1、换测试币:https://testnetbridge.com(用ARB或者OP,GAS很低)
2、质押eth测试币获取reth:http://testnet.rocketpool.net
3、质押reth:http://goerli.eigenlayer.xyz
换测试币用的就是Layer0的技术,顺便几把Layer0刷了~
- 都散了吧。有Bot已经做出来自动交互了 这一次zksync的女巫规则可能比大家想象的要严格的多
- 0.18 EMint 好几张,天天稳定上涨 📈 挂单率越来越低,持卡空投,质押产出,分红?都还没出来,就这么拉,牛逼啊!
- atem要空投了,大家可以看看.
https://airdrop.atem.io/
- 比特币28800,一定会马上突破30000?
就像比特币48800,一定会突破50000?
我中期看涨不变,也是持现货看涨,但我觉得这一两周出现洗盘的可能性还是蛮大的。大饼二饼都是在证书关卡之下摩擦。继续等待洗盘或者突破买入机会来加仓。
#BTC #ETH #LDO #OP #ARB #RPL
- 错过了 $ARB 还有什么能撸?
这里整理了 11 个顶级参投且还未发币的 #Layer2 项目汇总,以方便大家参考!
喜欢记得转发 + 收藏!谢谢大家!
- @CryptoGPT_org
$GPT #CryptoGPT
$GPT Ai领域新公链,有点意思,市值小,期待新产品
- 小狐狸钱包可添加 zkSync Era 网络
传送门:https://chainlist.org/?search=324
- zkSync Era 主网上线,全面开放,大家都可以体验了! 🎁
传送门:https://portal.zksync.io/bridge
- 币安到底是个什么情况?有大佬知道吗?
- 连续4周内每周执行价值至少100美元的代币交换,可以获得忠诚用户OAT,一周内将获得20美元的奖励,并有资格在第二季度获得$arbs代币空投。
传送门:http://arbitrumswap.com
做完之后需要填表:https://docs.google.com/forms/d/e/1FAIpQLSf3_l7YD0WESUvQtXmLCzC1RlhCE9_lBIQEmK7n7CDCYSRzPA/
- 【验证@starky_wtf】(重要)
使用 Starknet 资产对您的 Discord 频道进行令牌门禁
在Starknet ID 的discord里面找到 #bot-command频道并输入指令 /starky-connect+“你的SN Goerli地址”
转到此链接:并在网络上验证您的Starknet身份:Goerli!点击链接跳转!
- 全网最全starkgate生态空投埋伏教程
https://mirror.xyz/dashboard/edit/ZwEn_d2FxnyhevjnGxjpLdX83pNu4h8UcSvcZu46zmE…
建议循序渐进几十个号几个大项目资金推波滚动,做好表格,划分好任务,让操作做起来感觉有规律,看起来又无规律比如13579,12345,12457,14791等等。
- 这一讲,我们将介绍ethers.js的`Provider`类,然后利用它连接上Infura节点,读取链上的信息。
`Provider`类
`Provider`类是对以太坊网络连接的抽象,为标准以太坊节点功能提供简洁、一致的接口。在`ethers`中,`Provider`不接触用户私钥,只能读取链上信息,不能写入,这一点比`web3.js`要安全。
除了之前介绍的默认提供者`defaultProvider`以外,`ethers`中最常用的是`jsonRpcProvider`,可以让用户连接到特定节点服务商的节点。
`jsonRpcProvider`创建节点服务商的API Key
首先,你需要去节点服务商的网站注册并创建`API Key`。在`WTF Solidity极简教程`的工具篇,我们介绍了Infura和Alchemy两家公司`API Key`的创建方法,大家可以参考。
连接Infura节点
这里,我们用Infura节点作为例子。在创建好Infura API Key之后,就可以利用`ethers.provider.JsonRpcProvider()`方法来创建`Provider`变量。`JsonRpcProvider()`以节点服务的`url`作为参数。
在下面这个例子中,我们分别创建连接到`ETH`主网和`Goerli`测试网的`provider`:
*`// 利用Infura的rpc节点连接以太坊网络`*
*`// 填入Infura API Key, 教程:https://github.com/AmazingAng/WTFSolidity/blob/main/Topics/Tools/TOOL02_Infura/readme.md`*
`const INFURA_ID = ''`
*`// 连接以太坊主网`*
`const providerETH = new ethers.providers.JsonRpcProvider(`https://mainnet.infura.io/v3/${INFURA_ID}`)`
*`// 连接Goerli测试网`*
`const providerGoerli = new ethers.providers.JsonRpcProvider(`https://goerli.infura.io/v3/${INFURA_ID}`)`
利用`Provider`读取链上数据
`Provider`类封装了一些方法,可以便捷的读取链上数据:
**1.** 利用`getBalance()`函数读取主网和测试网V神的`ETH`余额:
` *// 1. 查询vitalik在主网和Goerli测试网的ETH余额`*
`console.log("1. 查询vitalik在主网和Goerli测试网的ETH余额");`
`const balance = await providerETH.getBalance(`vitalik.eth`);`
`const balanceGoerli = await providerGoerli.getBalance(`vitalik.eth`);`
` *// 将余额输出在console(主网)`*
`console.log(`ETH Balance of vitalik: ${ethers.utils.formatEther(balance)} ETH`);`
` *// 输出Goerli测试网ETH余额`*
`console.log(`Goerli ETH Balance of vitalik: ${ethers.utils.formatEther(balanceGoerli)} ETH`);`
**2.** 利用`getNetwork()`查询`provider`连接到了哪条链,`homestead`代表`ETH`主网:
` *// 2. 查询provider连接到了哪条链`*
`console.log("\n2. 查询provider连接到了哪条链")`
`const network = await providerETH.getNetwork();`
`console.log(network);`
**3.** 利用`getBlockNumber()`查询当前区块高度:
` *// 3. 查询区块高度`*
`console.log("\n3. 查询区块高度")`
`const blockNumber = await providerETH.getBlockNumber();`
`console.log(blockNumber);`
**4.** 利用`getGasPrice()`查询当前`gas price`,返回的数据格式为`BigNumber`,可以用`BigNumber`类的`toNumber()`或`toString()`方法转换成数字和字符串。
` *// 4. 查询当前gas price`*
`console.log("\n4. 查询当前gas price")`
`const gasPrice = await providerETH.getGasPrice();`
`console.log(gasPrice);`
**5.** 利用`getFeeData()`查询当前建议的`gas`设置,返回的数据格式为`BigNumber`。
` *// 5. 查询当前建议的gas设置`*
`console.log("\n5. 查询当前建议的gas设置")`
`const feeData = await providerETH.getFeeData();`
`console.log(feeData);`
**6.** 利用`getBlock()`查询区块信息,参数为要查询的区块高度:
` *// 6. 查询区块信息`*
`console.log("\n6. 查询区块信息")`
`const block = await providerETH.getBlock(0);`
`console.log(block);`
**7.** 利用`getCode()`查询某个地址的合约`bytecode`,参数为合约地址,下面例子中用的主网`WETH`的合约地址:
` *// 7. 给定合约地址查询合约bytecode,例子用的WETH地址`*
`console.log("\n7. 给定合约地址查询合约bytecode,例子用的WETH地址")`
`const code = await providerETH.getCode("0xc778417e063141139fce010982780140aa0cd5ab");`
`console.log(code);`
总结
这一讲,我们将介绍ethers.js的`Provider`类,并用Infura的节点API Key创建了`jsonRpcProvider`,读取了`ETH`主网和`Goerli`测试网的链上信息。
- 这一讲,我们会介绍`ethers.js`库,javascript在线编辑器`playcode`,并且我们会写第一个程序`HelloVitalik`:查询V神的`ETH`余额,并输出在`console`中。
ethers.js简述
`ethers.js`是一个完整而紧凑的开源库,用于与以太坊区块链及其生态系统进行交互。如果你要写Dapp的前端,你就需要用到`ethers.js`。
与更早出现的`web3.js`相比,它有以下优点:
代码更加紧凑:`ethers.js`大小为116.5 kB,而`web3.js`为590.6 kB。更加安全:`Web3.js`认为用户会在本地部署以太坊节点,私钥和网络连接状态由这个节点管理(实际并不是这样);`ethers.js`中,`Provider`提供器类管理网络连接状态,`Wallet`钱包类管理密钥,安全且灵活。原生支持`ENS`。
开发工具1. VScode
你可以使用本地`vscode`进行开发。你需要安装Node.js,然后利用包管理工具`npm`安装`ethers`库:
`npm install --save ethers`
2. playcode
playcode是一个在线编译`javascript`的平台,你不需要配置`Nodejs`就可以运行`.js`文件,非常方便。且要比更知名的`codesandbox`快一百倍。
本教程将用`playcode`做演示。你需要在官网注册一个免费账号,然后点击`OPEN PLAYGROUND`以`Javascript`模版创建一个新项目,然后将代码写在自动生成的`script.js`中即可。
HelloVitalik
现在,让我们用`ethers`编写第一个程序`HelloVitalik`:查询V神的`ETH`余额,并输出在`console`中。整个程序只需要6行,非常简单!
**注意**:在`playcode`上第一次运行可能会提示`module not found`,这是因为`ethers`库还没有安装,只需要点击`install`按钮安装即可。
`import { ethers } from "ethers";`
`const provider = ethers.getDefaultProvider();`
`const main = async () => {`
`const balance = await provider.getBalance(`vitalik.eth`);`
`console.log(`ETH Balance of vitalik: ${ethers.utils.formatEther(balance)} ETH`);`
`}`
`main()`
我们逐行分析这个程序:
1. 导入`ethers`
第一行的作用是导入已经安装好的`ethers`库:
`import { ethers } from "ethers";`
如果在`playcode`平台上,免费账号不能安装外部库。我们可以直接从`ethers`的CDN导入(出于安全考虑,仅用于教学):
`import { ethers } from "https://cdn-cors.ethers.io/lib/ethers-5.6.9.esm.min.js";`
2. 连接以太坊
在`ethers`中,`Provider`类是一个为以太坊网络连接提供抽象的类,它提供对区块链及其状态的只读访问。我们声明一个`provider`用于连接以太坊网络。`ethers`内置了一些公用`rpc`,方便用户连接以太坊:
`const provider = ethers.getDefaultProvider();`
**注意:**`ethers`内置的`rpc`访问速度有限制,仅测试用,生产环境还是要申请个人`rpc`。
3. 声明`async`函数
由于和区块链交互不是实时的我们需要用到js的`async/await`语法糖。每次和链交互的调用需要用到`await`,再把这些这些用`async`函数包裹起来,最后再调用这个函数。
`const main = async () => {`
` *//...`*
`}`
`main()`
4. 获取v神地址的`ETH`余额
我们可以利用`Provider`类的`getBalance()`函数来查询某个地址的`ETH`余额。由于`ethers`原生支持`ENS`域名,我们不需要知道具体地址,用`ENS`域名`vitalik.eth`就可以查询到以太坊创始人豚林-vitalik的余额。
`const balance = await provider.getBalance(`vitalik.eth`);`
5. 转换单位后在`console`中输出
我们从链上获取的以太坊余额以`wei`为单位,而`1 ETH = 10^18 wei`。我们打印在`console`之前,需要进行单位转换。`ethers`提供了功能函数`formatEther`,我们可以利用它将`wei`转换为`ETH`。
`console.log(`ETH Balance of vitalik: ${ethers.utils.formatEther(balance)} ETH`);`
如果你使用的是vscode开发工具的话,你需要在vscode控制台输入以下命令
`node 01_HelloVitalik/HelloVitalik.js`
这样,你就能在控制台中看到v神的`ETH`余额了:`1951 ETH`。当然这不是v神的全部持仓,他有多个钱包,`vitalik.eth`应该只是他用的比较频繁的一个热钱包。
总结
这是WTF Ethers极简教程的第一讲,我们介绍了`ethers.js`,并完成了第一个使用`ethers`的程序`HelloVitalik`,查询v神钱包的`ETH`余额。
**课后作业**:在图4和图5中,v神的`ETH`余额并不一样。第一张余额为`2251 ETH`,而第二张变为了`1951 ETH`,减少`300 ETH`。其实,两张图片对应v神在`2022.07.30`和`2022.07.31`的持仓。那么,这一天v神用`300 ETH`干了什么?
ethers官方文档:https://docs.ethers.io/v5/
- I just subscribed to PKU’ Blockchain's Substack https://pkublockchain.substack.com/subscribe?r=j3578&utm_medium=web&utm_campaign=pss
- In the age of digital wonder, Where transactions can be done in a thunder, Cryptocurrencies reign supreme, As the world's newest monetary dream.
From Bitcoin to Ethereum, The value of these assets soars, Decentralized, secure and fast, They've opened up financial doors.
No need for banks or governments, With digital wallets as our new covenant, We send and receive with ease, And our wealth is safe from thieves.
But as with any innovation, Challenges arise with no hesitation, Regulation and volatility, Remind us of digital currencies' fragility.
Yet hope remains, as technology evolves, And the world around us resolves, To embrace this new form of currency, And realize its full potential for humanity.
In the age of digital wonder, Cryptocurrencies continue to thunder, A new era of finance has begun, And with it, a future that's bright like the sun.
- Digital currencies, also known as cryptocurrencies, are a form of decentralized digital assets that operate using cryptography. Unlike traditional currencies, digital currencies are not backed by a government or financial institution and rely on a decentralized ledger technology, such as blockchain, to maintain and verify transactions.
One of the most well-known digital currencies is Bitcoin, which was created in 2009. Since then, thousands of other digital currencies have emerged, each with their own unique features and use cases.
Digital currencies offer several benefits over traditional currencies, including faster and cheaper transactions, increased privacy and security, and the ability to bypass traditional financial institutions. However, they also come with their own set of risks and challenges, such as volatility and regulatory uncertainty.
Despite these challenges, the adoption of digital currencies continues to grow, with many businesses and individuals now accepting them as a legitimate form of payment. As the technology and infrastructure supporting digital currencies continues to evolve, it is likely that they will play an increasingly important role in the global economy in the years to come.
- Proof of Argentinian 🇦🇷
- Just getting started in web3 vs. when it all clicks. The deeper you go, the brighter it gets.
@rabbithole.lens