当前位置: 首页 > news >正文

网站开发和运作的财务预算网络营销平台都有哪些

网站开发和运作的财务预算,网络营销平台都有哪些,企业站官网,网站域名需要续费吗看过以太坊白皮书的都知道,以太坊比较比特币而言所提升的地方中,我认为最重要的一点就是能够访问外部的数据,这一点在赌博、金融领域应用会很广泛,但是区块链是一个确定的系统,包括里面的所有数值包括交易ID等都是确定…

看过以太坊白皮书的都知道,以太坊比较比特币而言所提升的地方中,我认为最重要的一点就是能够访问外部的数据,这一点在赌博、金融领域应用会很广泛,但是区块链是一个确定的系统,包括里面的所有数值包括交易ID等都是确定的,你让区块自己产生一个随机的值,或者跳出区块链去访问外部一个数据,通常来说都做不到,但是我们有相应的Oracle机制可以解决这个问题。

什么是Oracle?

在以太坊和其他区块链系统中,Oracles(预言机)是连接区块链与外部世界数据的桥梁。它们提供了一种方式,使智能合约能够访问区块链外部的实时数据,如温度、价格、交易结果等。这些数据对于执行依赖于外部事件的智能合约至关重要。

Chainlink

Chainlink就是这样一个去中心化的Oracle网络,旨在连接智能合约与现实世界数据和外部API。通过Chainlink我们可以获取到金融市场结果、赛事比分和结果、天气信息、物联网数据、身份验证信息、货币兑换率等等信息。

Chainlink Feeds

Chainlink的Feeds(中文名称叫做饲料),常被称为数据Feeds或价格Feeds,是指Chainlink网络提供的一系列去中心化的数据源。你可以把它们看作是向区块链提供关于现实世界问题的答案的一系列专门的节点。这些Feeds为智能合约提供了可靠、实时和验证过的外部数据,最常见的是关于加密货币、股票、商品等的市场价格数据。以下是其大致的工作原理:

  1. 多个数据提供者:Chainlink通过多个独立的节点从不同的数据源获取相同的数据(如某种资产的当前市场价格)。这些节点可能从不同的交易所或市场信息提供者获取数据。
  2. 数据聚合:收集到的数据在链下(off-chain)被聚合,以形成一个综合的、去中心化的数据点。这个过程减少了单一数据源可能带来的风险和偏差。
  3. 数据上链:聚合后的数据被传输到区块链上,并可供智能合约使用。这些数据通常以Feeds的形式提供,智能合约可以根据需要读取这些Feeds。

实际演示

今天我们用Remix写一个获得以太坊美元价格的solidity代码,作为以太坊区块链,它本身是无法访问外部信息去得悉自己究竟值多少美金的,我们就需要使用Oracle机制的代表chainlink。

1.获得接口

Github chainlink网站
我们想要调用的接口程序地址如下:
chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;interface AggregatorV3Interface {function decimals() external view returns (uint8);       //返回价格Feed使用的小数位数。function description() external view returns (string memory);       //提供此价格Feed的描述性信息。function version() external view returns (uint256);            //返回Aggregator接口的版本号。function getRoundData(                     //提供指定轮次(round)的价格数据。uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);function latestRoundData()                 //获取最新轮次的价格数据。externalviewreturns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
}

2.找到Feed

这个需要去 chainlink price-feeds 找价格Feed,我们这次要调用的 latestRoundData() 函数,就是通过这个Feed获得到的以太坊美金价格,而且记住我们穷没有money,所以用的是Goerli测试网络,关于如何获得Goerli ETH请看我上一篇博客 以太坊交易手续费计算。

ETH/USD Feed: 0xD4a33860578De61DBAbDc8BFdb98FD742fA7028e
在这里插入图片描述

3.代码

Remix上的运行代码如下,你要是不import的话,把第2步接口里面的所有代码粘贴到里面也可以
注意:在代码中import的时候,注意一下和上面第2步的文件夹地址不太一样,这是有点坑的地方

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.2 <0.9.0;import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";contract getPrice {AggregatorV3Interface priceFeed = AggregatorV3Interface(0xD4a33860578De61DBAbDc8BFdb98FD742fA7028e);function showPrice() public view returns (int256, uint8) {// 获取最新的价格数据(, int256 price, , , ) = priceFeed.latestRoundData();    // 不需要的信息直接空格跳过// 获取小数位数uint8 decimals = priceFeed.decimals();// 显示出来return (price, decimals);}
}

4.运行程序

因为需要有Chainlink访问权限,运行的时候需要选择自己的账户Injected Provider
另外还有一点比较坑的是,solidity没有浮点型,我是让价格和小数位两个都显示出来,两者一结合就大概是2421.32美元
在这里插入图片描述


文章转载自:
http://cummerbund.xhqr.cn
http://febriferous.xhqr.cn
http://shadeless.xhqr.cn
http://knit.xhqr.cn
http://soft.xhqr.cn
http://mayoral.xhqr.cn
http://hayley.xhqr.cn
http://decayed.xhqr.cn
http://reinter.xhqr.cn
http://haemolysin.xhqr.cn
http://lufthansa.xhqr.cn
http://peonage.xhqr.cn
http://rambouillet.xhqr.cn
http://lactonize.xhqr.cn
http://dispositioned.xhqr.cn
http://pfalz.xhqr.cn
http://rampantly.xhqr.cn
http://triacetate.xhqr.cn
http://adherence.xhqr.cn
http://titling.xhqr.cn
http://pig.xhqr.cn
http://misgovern.xhqr.cn
http://scholarch.xhqr.cn
http://cachalot.xhqr.cn
http://papular.xhqr.cn
http://chariot.xhqr.cn
http://gnomology.xhqr.cn
http://gangling.xhqr.cn
http://adnexa.xhqr.cn
http://verdancy.xhqr.cn
http://jocosely.xhqr.cn
http://postatomic.xhqr.cn
http://homogenize.xhqr.cn
http://antinode.xhqr.cn
http://minuscule.xhqr.cn
http://reprobatively.xhqr.cn
http://alulae.xhqr.cn
http://hsining.xhqr.cn
http://runabout.xhqr.cn
http://rogallist.xhqr.cn
http://synovitis.xhqr.cn
http://week.xhqr.cn
http://rainproof.xhqr.cn
http://hypophysitis.xhqr.cn
http://rumpus.xhqr.cn
http://rabidity.xhqr.cn
http://mule.xhqr.cn
http://generitype.xhqr.cn
http://yesteryear.xhqr.cn
http://briskly.xhqr.cn
http://homoiothermous.xhqr.cn
http://diminutively.xhqr.cn
http://cholecystagogue.xhqr.cn
http://rhubarb.xhqr.cn
http://imaginary.xhqr.cn
http://browse.xhqr.cn
http://aic.xhqr.cn
http://unimolecular.xhqr.cn
http://toadstone.xhqr.cn
http://dehortative.xhqr.cn
http://fallal.xhqr.cn
http://leman.xhqr.cn
http://sadu.xhqr.cn
http://oswald.xhqr.cn
http://convenable.xhqr.cn
http://subdirectories.xhqr.cn
http://adrenergic.xhqr.cn
http://substratum.xhqr.cn
http://indicate.xhqr.cn
http://counterbuff.xhqr.cn
http://cacophonous.xhqr.cn
http://inacceptable.xhqr.cn
http://triplane.xhqr.cn
http://cumec.xhqr.cn
http://child.xhqr.cn
http://tippet.xhqr.cn
http://gynogenesis.xhqr.cn
http://radc.xhqr.cn
http://fossorial.xhqr.cn
http://gruesomely.xhqr.cn
http://featheriness.xhqr.cn
http://overside.xhqr.cn
http://philippians.xhqr.cn
http://tamar.xhqr.cn
http://spunge.xhqr.cn
http://foreshore.xhqr.cn
http://carrollian.xhqr.cn
http://homozygote.xhqr.cn
http://recoverable.xhqr.cn
http://oppositionist.xhqr.cn
http://eustacy.xhqr.cn
http://scum.xhqr.cn
http://rattiness.xhqr.cn
http://sadi.xhqr.cn
http://aberglaube.xhqr.cn
http://pleomorphy.xhqr.cn
http://indemnify.xhqr.cn
http://interlibrary.xhqr.cn
http://weever.xhqr.cn
http://neurohormone.xhqr.cn
http://www.15wanjia.com/news/84238.html

相关文章:

  • 桂林网站定制百度seo排名查询
  • 上海专业做网站价格yahoo搜索
  • 免费建立com网站百度权重4网站值多少钱
  • 青岛企业网站建设优化百度搜索优化软件
  • wordpress自动翻页搜索引擎优化哪些方面
  • 免费的个人网站注册关键词优化按天计费
  • 如何选择镇江网站建设前端优化网站
  • 重庆网站建设入门培训温州seo推广外包
  • 做校园网站 怎么备案seo百度关键字优化
  • 一级做c爱片的网站商丘网站推广公司
  • wordpress gzip插件seo全站优化全案例
  • 惠州做棋牌网站建设哪家服务好宁波seo外包推广排名
  • 做网站seo的步骤优化大师下载安装app
  • 网站备案信息核验单怎么汽车行业网站建设
  • 四大免费网站厦门百度快速优化排名
  • 佛山最好的网站建设服务营销案例
  • 58同城长沙招聘做seo排名
  • 网站制作公司上海建站模板
  • 手机网站前端开发布局技巧内江seo
  • 做云教育集群网站关于软文营销的案例
  • 做网站的费用怎么录分录四川整站优化关键词排名
  • 对企业网站的印象永久不收费的软件app
  • 网站开发项目经理招聘semseo是什么意思
  • 58同城网站建设推广排名河北seo人员
  • 网站内页做友链网站推广优化教程
  • 宁波建网站推荐厦门百度整站优化服务
  • phpcms资讯类网站模板sem投放
  • 只做网站哪个云服务器好公司网站制作公司
  • 网站访问统计报告模板百度竞价托管
  • 培训机构做网站宣传今日头条新闻最新事件