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

移动网站建设书籍推荐看汽车哪个网站好

移动网站建设书籍推荐,看汽车哪个网站好,云南网站建设公司有哪些,深汕特别合作区招聘我们开发了链上限价订单。 它基于一种称为契约的智能合约#xff0c;只有在花费输出的交易满足特定条件时才可以花费输出。 为了演示其工作原理#xff0c;我们实施了以比特币支付的 Ordinals 代币买卖限价订单#xff0c;无需托管人。 它可以运行在任何比特币协议链上…我们开发了链上限价订单。 它基于一种称为契约的智能合约只有在花费输出的交易满足特定条件时才可以花费输出。 为了演示其工作原理我们实施了以比特币支付的 Ordinals 代币买卖限价订单无需托管人。 它可以运行在任何比特币协议链上例如Bitcoin SV和MVC。 限价订单 限价单使买方或卖方通常称为制造商能够确定他们愿意在市场上买卖资产的特定价格。 随后另一个交易者可以选择“接受”该报价并进行交易。 这一过程通常在托管交易所中得到促进交易所暂时持有双方的资金并采用内部结算机制来相应地分配资金。 然而这种方法涉及将资金信任给第三方从而使他们面临因系统黑客或内部盗窃而造成的潜在损失其中第三方可能会消失或盗用资金。 契约 比特币契约 限制了 UTXO 的使用方式。 它是在 sCrypt 中使用 ScriptContext 实现的。 例如做市商可以下一个卖出订单将 10 个 PEPE 代币锁定到契约合约中允许任何购买者提取最多 10 个 PEPE 代币只要他们向卖家支付例如他们移除的每个 PEPE 1000 聪。 如果买方希望交易的金额低于 10 个 PEPE 限制例如 7 个他们可以选择为其余 3 个 PEPE 创建受相同契约约束的代币找零输出。 在这种特殊情况下卖方被确定为做市商买方在限价订单的框架内扮演接受者的角色。 该机制有利于部分履行限价订单的过程。 该限价订单可以看作是 RUN 代币的 OrderLock 和 Ordinals 的 OrdinalLock 的扩展只能进行全额交易。 如果订单未 100% 成交合同还允许卖方取消订单并拿走剩余的 PEPE。 实现 我们使用 BSV-20 同质化代币 作为创建限价订单的示例并用比特币进行交易。 限价卖出订单 一定数量的 BSV-20 代币被锁定在契约智能合约中。 买方可以从智能合约中获取部分或全部代币前提是他在同一合约调用交易中向卖方支付要价。 买家可以通过在同一合约调用交易中将聪转移到买家的地址来兑换 BSV-20 代币。 这是在调用合约的“buy”公共方法时完成的。 还有一种“cancel”方法允许买家在订单未 100% 成交时取回资金。 class BSV20SellLimitOrder extends BSV20V2 {// Total amount of tokens were selling.prop()readonly tokenAmt: bigint// Amount of tokens already sold.prop(true)tokenAmtSold: bigint// The sellers public key.prop()seller: PubKey// Asking price per BSV-20 token unit.prop()pricePerUnit: bigint...method()public buy(amount: bigint, buyerAddr: Addr) {// Check token amount doesnt exceed total.assert(this.tokenAmtSold amount this.tokenAmt,insufficient tokens left in the contract)// Update cleared amount.this.tokenAmtSold amount// Build transfer inscription.const transferInscription BSV20V2.createTransferInsciption(this.id,amount)const transferInscriptionLen len(transferInscription)// Fist output is the contract itself, holding the remaining tokens.// If no tokens are remaining, then terminate the contractconst tokensRemaining this.tokenAmt - this.tokenAmtSoldlet outputs toByteString()if (tokensRemaining 0n) {outputs this.buildStateOutput(1n)}// Ensure the sold tokens are being payed out to the buyer.outputs BSV20V2.buildTransferOutput(pubKey2Addr(this.seller),this.id,amount)// Ensure the next output is paying the to the Bitcoin to the seller.const satsForSeller this.pricePerUnit * amountoutputs Utils.buildPublicKeyHashOutput(hash160(seller), satsForSeller)// Add change output.outputs this.buildChangeOutput()// Check outputs.assert(hash256(outputs) this.ctx.hashOutputs, hashOutputs mismatch)}method()public cancel(buyerSig: Sig) {assert(this.checkSig(buyerSig, this.seller))} }BSV20SellLimitOrder 限价买入订单 限价卖出订单非常相似。 只是这一次智能合约中锁定了一定数量的比特币而不是 BSV-20 代币。 由于智能合约本身无法确认 BSV-20 代币的真实性因此使用了预言机服务。 预言机通过签署其引用以及金额和代币的铭文来保证代币的有效性。 智能合约验证此签名。 class BSV20BuyLimitOrder extends BSV20V2 {// Total amount of tokens were buying.prop()readonly tokenAmt: bigint// Amount of tokens already cleared.prop(true)tokenAmtCleared: bigint// Public key of the oracle, that is used to verify the transfers// genesis.prop()oraclePubKey: RabinPubKey// The buyers public key.prop()buyer: PubKey// Offered price per BSV-20 token unit.prop()pricePerUnit: bigint...method()public sell(oracleMsg: ByteString, oracleSig: RabinSig, sellerAddr: Addr) {// Check oracle signature.assert(RabinVerifier.verifySig(oracleMsg, oracleSig, this.oraclePubKey),oracle sig verify failed)// Get token amount held by the UTXO from oracle message.const utxoTokenAmt byteString2Int(slice(oracleMsg, 36n, 44n))// Check token amount doesnt exceed total.const remainingToClear this.tokenAmt - this.tokenAmtClearedassert(utxoTokenAmt remainingToClear,UTXO token amount exceeds total)// Update cleared amount.this.tokenAmtCleared utxoTokenAmt// Build transfer inscription.const transferInscription BSV20V2.createTransferInsciption(this.id,utxoTokenAmt)const transferInscriptionLen len(transferInscription)// Check that the ordinal UTXO contains the right inscription.assert(slice(oracleMsg, 44n, 44n transferInscriptionLen) transferInscription,unexpected inscription from oracle)// Ensure the tokens are being payed out to the buyer.let outputs BSV20V2.buildTransferOutput(pubKey2Addr(this.buyer),this.id,this.tokenAmt)// Ensure the second output is paying the Bitcoin to the seller.const satsForSeller this.pricePerUnit * utxoTokenAmtoutputs Utils.buildPublicKeyHashOutput(sellerAddr, satsForSeller)// If theres tokens left to be cleared, then propagate contract.if (this.tokenAmtCleared this.tokenAmt) {outputs this.buildStateOutput(this.ctx.utxo.value - satsForSeller)}// Add change output.outputs this.buildChangeOutput()// Check outputs.assert(hash256(outputs) this.ctx.hashOutputs, hashOutputs mismatch)}method()public cancel(buyerSig: Sig) {assert(this.checkSig(buyerSig, this.buyer))} }BSV20BuyLimitOrder
http://www.yayakq.cn/news/4488/

相关文章:

  • 网站建设都用哪个好开发一款社交app需要多少钱
  • 网站建设图书馆管理系统seo服务工程
  • 东莞营销网站建设网站邮箱设置
  • 网站建设的市场定位网页设计优秀作品展示
  • 网站怎么免费做推广网页颜色搭配案例
  • 赣州网站建设专家诚信网站认证怎么做
  • 宁德蕉城住房和城乡建设部网站欧米茄手表价格及图片官方网站
  • 做暧暧小视频免费网站达内教育
  • 福州cms模板建站母婴微网站设计规划
  • 医疗设备响应式网站济南网站制作多少钱一个
  • 网站建设工程师职责wordpress 动态特效
  • 免费ppt模板网站下载四川百度推广排名查询
  • 网站功能建设中商标交易
  • 沟通交流类网站有哪些win7图标不显示wordpress
  • 电子商务网站开发与应用论文58同城北京网站建设
  • 仿网站出售徐州做网站企业
  • 展览设计网站推荐石家庄工程造价信息网官网
  • 淘客客怎么做自己的网站wordpress随机注册
  • 新公司名称核准在哪个网站韶关网站开发
  • 在视频网站中做节目怎么挣钱建设网站目的及功能定位
  • 如何快速的建设网站如何创建wordpress数据库文件
  • 网站建设咨询费用外发加工网1688
  • 继续访问这个网站互联网舆情忻州
  • 如何建设网站论坛高端私人订制网站建设
  • 建设部物业证书查询官方网站悬停提示 wordpress
  • 上海建设摩托车官方网站店铺详情页设计
  • 台州网站策划台州网站策划写作平台有哪些
  • 网站建设图标图片湖北建设网
  • 网站打开很慢怎么做优化手机网站底部导航
  • 外贸soho怎么做网站做海外购网站