普通人绝对想不到,比特币能在2024年达到这个价值,早知道的话,我当初就是破釜沉舟也得买一个啊。
No ordinary man could have expected #xff0c; Bitcoin could have reached that value by 2024; if I had known, #xff0c; I had to buy one, too.
而在4月19号,也将迎来比特币再次减半。减半并不是说玩家手中的比特币要被突然减去一半,而是在后续的挖矿过程中,奖励减半。他的机制就是每开采210000个区块后,奖励减半。比如以前的旷工算出来1 + 1 = 2;后,可以得到10块钱奖励,那么4月19号以后,你费电,费机器,通过算出1 + 1 = 2;后,只能得到5块钱奖励了。
And on April 19 xff0c; it will also halve Bitcoin again. Half by half does not mean that the player's bitcoin is suddenly reduced by half xff0c; half by half in the follow-up mining process xff0c; half by half. His mechanism is xff0c; half by half. For example, one & #43; 1 #61; 2xff1b; xff0c; after xff0c; after April 19; your electricity #xff0c; your machine #xff0c; by counting 1 & #43; 1 & #61; 2ff1b; ff0c; after 5 dollars.
很多人欣喜若狂,哎呀,数量要减少啦,价格又要飙升啦,赶紧入手吧。我倒觉得大可不必,他涨他的,减少啥呀减少,后续的增长减半,又不是后续从玩家手中缩减,至于价格,你信不信,你不买他就飙升,你一买那个价格曲线就调过来。我反正不买。去年有个人玩数藏被坑了50W,据说有工资,有父母的钱,还有借的,你说这不是瞎闹嘛。更糟糕的是,这小伙儿,是个程序员。
A lot of people are excited about xff0c; xff0c; quantity is going down; prices are going up again xff0c; prices are going up xff0c; let's get started. I don't think he's going to have to xff0c; he's going up his xff0c; what's going down xff0c; what's going on xff0c; what's going on xff0c; what's going on xff0c; what's going on xff0c; what's going on xff0c; what's going on xff0c; what's going on xff0c; what's going on is not going on.
目录
Catalogue
?
1 sat
sat ,可以喊它为“聪”,当然不是他很聪明,而是有个叫“中本聪”的玩意,他是比特币的创始人,所以人们为了纪念这个“人”,将费率命名为“聪”。
Sat & #xff0c; it can be called "Hear" & #xff0c; it is certainly not he who is smart #xff0c; it is a thing called "Middle-Hear" & #xff0c; he is the founder of Bitcoin & #xff0c; so people remember this person & #xff0c; and the rate is named "Hear".
比如你这次交易需要给旷工多少钱,人们就说需要多少聪。比特币的最小单位是聪,一亿聪就等于一个比特币啦。如果你有空余时间,很感兴趣,可以来一聪试试水。所以每聪表示0.00000001BTC。
For example, how much you're going to pay for truancy xff0c; people say how much. The smallest unit of bitcoin is xff0c; 100 million is a bitcoin. If you have time left, xff0c; xff0c; you can try water. So every hearing is 0.000001 BTC.
2 获取当前比特币的价格
如果你在开发web3网站,那么肯定会涉及到获取当前比特币价格的需求。但这个价格变化非常快,几乎每秒都在波动,所以要不要频繁获取,你看自己需求而定,有时候产品会要求一分钟,十分钟这样。
If you're developing web3 & #xff0c; then there's certainly a demand for the current bitcoin price. But this price changes very quickly xff0c; it fluctuates almost every second xff0c; so you want to get xff0c more frequently; you see your needs xff0c; sometimes the product requires a minute xff0c; 10 minutes.
获取代码如下:
The following codes are obtained: xff1a;
这个price 字段就是需要获取的价格
This
3 封装获取价格方法?
因为这个方法是异步的,肯定会有很多地方需要使用,所以需要将方法封装起来,返回一个promise这样,当其他地方需要的时候,通过async / await 的方式获取价格,代码如下:
Because it's a step-by-step xff0c; there's bound to be a lot of places to use xff0c; there's a need to encapsulate the method xff0c; to return a promise like xff0c; xff0c when needed elsewhere; to get prices xff0c through async/await; code xff1a;
4 根据聪和比特币价格,换算美元价格
比如某一笔服务费是2000聪,那么根据聪和比特币的比例换算,看代码:
For example, a service fee of 2,000 deaf #xff0c; conversion of xff0c based on the ratio of deaf and bitcoin; look at code xff1a;
但是需要注意的是,这样换算下来,必定是一个长小数,所以需要前端用toFixed(2)来转换一下用于展示。
But what needs to be noted is xff0c; this translates xff0c; it must be a long decimal xff0c; so the front end needs to convert to match(2) for presentation.
但如果得到的这个数值还要用于计算,就需要用foFixed(2)以前的数值来计算,更精确一些。?
But this value is also used to calculate & #xff0c; a previous value infoFixed(2) is needed to calculate & #xff0c; is it more accurate?
?
?
注册有任何问题请添加 微信:MVIP619 拉你进入群
打开微信扫一扫
添加客服
进入交流群
发表评论