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

怎样登网站wordpress xiu 5.2

怎样登网站,wordpress xiu 5.2,企业wordpress主题下载地址,做阿里巴巴类似的网站控制 BSV-20 代币的分配 在上一篇文章中#xff0c;我们展示了智能合约可以在铸造后控制 BSV-20 代币的转移。 今天#xff0c;我们演示如何控制此类代币的分发/发行。 无Tick模式 BSV-20 在 V2 中引入了无Tick模式#xff0c;并采用了与 V1 不同的方法。 部署 (Deploy) … 控制 BSV-20 代币的分配 在上一篇文章中我们展示了智能合约可以在铸造后控制 BSV-20 代币的转移。 今天我们演示如何控制此类代币的分发/发行。 无Tick模式 BSV-20 在 V2 中引入了无Tick模式并采用了与 V1 不同的方法。 部署 (Deploy) 要部署和铸造供应量为 21000000 的代币请写入以下 JSONContentTypeapplication/bsv-20 { p: bsv-20,op: deploymint,amt: 21000000,sym: sCrypt,dec: 10 }请注意与 V1 不同没有指定的 tick 字段因此无 tick。 sym 字段仅代表代币名称不用于建立代币的索引。 发行 (Issue) 要发行上述 10000 个代币您可以使用以下 JSON 创建转移铭文: { p: bsv-20,op: transfer,id: 3b313338fa0555aebeaf91d8db1ffebd74773c67c8ad5181ff3d3f51e21e0000_1amt: 10000, }代币不是通过 tick 来标识而是通过 id 字段来标识该字段由交易 ID 和部署代币的输出索引组成格式为 _。 此外第一个发行交易必须从部署交易中支出因为整个供应量是立即铸造的而铸造交易不会从中支出并且它们在 V1 中是分开的。 这意味着代币的每笔交易都可以追溯到该代币的创世部署并且每笔交易都位于植根于创世交易的 DAG有向无环图中。 这使得 BSV-20 索引器能够更有效地扩展因为它不必扫描整个区块链并排序铸币交易以强制“first is first”铸币。 有关 BSV-20 代币 V2 工作原理的更多详细信息请阅读官方文档。 公平发布 与 ERC-20 代币相比BSV-20 V1 代币的一个显着特点是公平发行。 具体来说一旦有人在 BSV-20 上部署代币交易每个人都有相同的机会领取代币。 发行人不能免费预留一部分即没有预挖。 如果在 V2 无代码模式下部署时一次性铸造出总供应量是否可以保持公平发布 答案是肯定的。 我们在部署时没有将整个供应锁定在标准发行人地址P2PKH 脚本中而是将其锁定在智能合约中。 任何人都可以调用智能合约并且可以在其中执行任何分配策略。 在上图中每个方框代表一个代币 UTXO堆叠的 UTXO 位于同一笔交易中。 第二笔交易花费了第一笔部署交易的 UTXO如第一个箭头所示并创建了两个 UTXO 创世时相同合约的衍生副本但剩余供应量减少新发行的代币。 交易链一直持续到整个代币供应被发行为止。 请注意任何人都可以调用该合约。 我们列出了一些分发策略作为示例。 速率限制 根据这项策略任何人都可以领取代币只要距离最后一次领取的时间超过 5 分钟即可。 合约如下。 export class BSV20Mint extends BSV20V2 {prop(true)supply: bigintprop()maxMintAmount: bigintprop(true)lastUpdate: bigintprop()timeDelta: bigintconstructor(id: ByteString,max: bigint,dec: bigint,supply: bigint,maxMintAmount: bigint,lastUpdate: bigint,timeDelta: bigint) {super(id, max, dec)this.init(...arguments)this.supply supplythis.maxMintAmount maxMintAmountthis.lastUpdate lastUpdatethis.timeDelta timeDelta}method()public mint(dest: Addr, amount: bigint) {// Check time passed since last mint.assert(this.timeLock(this.lastUpdate this.timeDelta),time lock not yet expired)// Update last mint timestamp.this.lastUpdate this.ctx.locktime// Check mint amount doesnt exceed maximum.assert(amount this.maxMintAmount, mint amount exceeds maximum)// Update supply.this.supply - amount// If there are still tokens left, then// build state output inscribed with leftover tokens.let outputs toByteString()if (this.supply 0n) {outputs this.buildStateOutputFT(this.supply)}// Build FT P2PKH output to dest paying specified amount of tokens.outputs BSV20V2.buildTransferOutput(dest, this.id, amount)// Build change output.outputs this.buildChangeOutput()assert(hash256(outputs) this.ctx.hashOutputs, hashOutputs mismatch)} }合约源代码 第 6-12 行强制执行速率限制。 第 26-30 行确保不超过供应量。 如果是第 38-52 行将创建一个包含相同合约但具有更新状态的输出剩余供应量。 第 55-58 行向目标地址发出令牌。 迷你工作量证明 该策略确保任何人都可以领取代币只要她发现随机数满足某些特定的难度要求就像比特币的工作量证明PoW一样。 export class Pow20 extends SmartContract {// ...method(SigHash.ANYONECANPAY_ALL)public mint(nonce: ByteString,lock: ByteString,trailingOutputs: ByteString) {if (len(this.id) 0n) {this.id this.ctx.utxo.outpoint.txid int2ByteString(this.ctx.utxo.outpoint.outputIndex, 4n)}this.pow this.validatePOW(nonce)const reward this.calculateReward()this.supply - rewardlet stateOutput toByteString()if (this.supply 0n) {stateOutput this.buildStateOutput(1n)}const rewardOutput Utils.buildOutput(this.buildInscription(lock, reward),1n)const outputs: ByteString stateOutput rewardOutput trailingOutputsassert(hash256(outputs) this.ctx.hashOutputs,invalid outputs hash ${stateOutput} ${rewardOutput} ${trailingOutputs})}method()calculateReward(): bigint {let reward this.rewardif (this.supply this.reward) {reward this.supply}return reward}method()validatePOW(nonce: ByteString): ByteString {const pow hash256(this.pow nonce)const test rshift(Utils.fromLEUnsigned(pow), 256n - this.difficulty)assert(test 0n, pow invalid pow)return pow} }归功于: David Case ICO 可以实施一项策略以便任何人都可以通过以无需信任的方式将比特币发送到特定地址来接收代币类似于首次代币发行ICO。 在上图中添加了第三个输出用于比特币支付该输出在合约中进行验证。 export class BSV20Mint extends SmartContract {// ...method()public mint(dest: Addr, amount: bigint) {// If first mint, parse token id and store it in a state varif (this.isFirstMint) {this.tokenId BSV20Mint.txId2Ascii(this.ctx.utxo.outpoint.txid) toByteString(_, true) BSV20Mint.int2Ascii(this.ctx.utxo.outpoint.outputIndex)this.isFirstMint false}// Check if tokens still available.assert(this.totalSupply - this.alreadyMinted amount,not enough tokens left to mint)// Update already minted amount.this.alreadyMinted amountlet outputs toByteString()if (this.alreadyMinted ! this.totalSupply) {// If there are still tokens left, then// build state output inscribed with leftover tokens.const leftover this.totalSupply - this.alreadyMintedconst transferInscription BSV20Mint.getTransferInsciption(this.tokenId,leftover)const stateScript slice(this.getStateScript(),this.prevInscriptionLen) // Slice prev inscriptionoutputs Utils.buildOutput(transferInscription stateScript, 1n)// Store next inscription length, so we know how much to slice in the next iteration.this.prevInscriptionLen len(transferInscription)}// Build P2PKH output to dest paying specified amount of tokens.const script1 BSV20Mint.getTransferInsciption(this.tokenId, amount) Utils.buildPublicKeyHashScript(dest)outputs Utils.buildOutput(script1, 1n)// Calculate total price for minted amount and enforce payment to ICO address.const priceTotal this.icoPrice * amountoutputs Utils.buildPublicKeyHashOutput(this.icoAddr, priceTotal)// Build change output.outputs this.buildChangeOutput()assert(hash256(outputs) this.ctx.hashOutputs, hashOutputs mismatch)} }
http://www.pierceye.com/news/911729/

相关文章:

  • 网站木马文件删除青岛黄岛网站建设公司电话
  • 一个网站做网站地图的目的企业网站建设框架图
  • 网站建设 swot分析深圳市龙华区繁华吗
  • h5 小米网站模板直接通过ip访问网站
  • 公司建设个网站制作装饰公司网站
  • 高质量的网站内容建设做网站信科网站建设
  • 网站建设倒计时模板学校室内设计效果图
  • 海东营销网站建设公司东莞网络优化排名
  • 株洲网站建设服务建筑公司怎么注册
  • 心理学网站的建设网站开发公司比较有名
  • 需要做网站设计海南网页制作
  • 开发网站有什么用仿站小工具官网
  • 支付宝网站登录入口个人微信公众号如何推广
  • 北京网站制作net2006常见的营销型网站
  • 设计建设网站公司天津市建设信息网官网
  • 企业网站建站 费用比较有名的个人网站
  • 网站规划与开发设计企业班组建设案例
  • 招聘网站开发设计做网站 免费字体
  • 网站上传程序流程桐城住房和城乡建设局网站
  • 回力网站建设初衷ps可以做网站吗
  • 广州网站建设市场佛山专业做网站公司哪家好
  • 四川省凉亭建设工程有限公司网站的博客wordpress
  • 搭建一个网站需要多少钱?如何做网站二级域名
  • 广德县住房和城乡建设网站wordpress网站维护教程
  • 在网站上显示地图金湖县网站建设
  • 网站域名区别吗模板和网站是一体的吗
  • 百度网盟推广怎么选择投放网站抖音seo代理
  • 电商wordpress网站优化百度
  • phpcms v9 网站搬家南通网站设计专家
  • 延安网站建设推广黄骅市网站建设价格