当前位置:网站首页>Commission contract on BSV (3)
Commission contract on BSV (3)
2022-06-22 01:47:00 【Scrypt smart contract】
Before , We introduced two ways to entrust bitcoin : One is in Script level , The other is Transaction level .
We generalize the former to delegate to any script / Intelligent contract , Not just the public key . It allows a person to authorize any smart contract to spend a person's bitcoin .

The full code is shown below :
contract DelegateToScript {
PubKey owner;
public function delegate(Sig ownerSig, bytes delegatedScript, PubKey derivedPubKey, PubKey X, int lambda, SigHashPreimage txPreimage) {
require(Tx.checkPreimage(txPreimage));
// ensure delegated script is signed by the owner
require(Oracle.verifyData(delegatedScript, ownerSig, this.owner, derivedPubKey, X, lambda, txPreimage));
// use delegated script as the new locking script, while maintaining value
bytes output = Utils.buildOutput(delegatedScript, SigHash.value(txPreimage));
require(hash256(output) == SigHash.hashOutputs(txPreimage));
}
}
The first 9 Line to check if the delegate script is signed and therefore by the owner to grant authorization . The first 12 Xing He 13 Line usage OP_PUSH_TX Ensure that the delegate script enters the output of the expense transaction as a new lock script , Be similar to Pay to Script Hash (P2SH) The simulation .
边栏推荐
- LeetCode 5218. 个位数字为 K 的整数之和(枚举)
- ShardingSphere-proxy-5.0.0分布式哈希取模分片实现(四)
- [number theory] leetcode1010 Pairs of Songs With Total Durations Divisible by 60
- Cache consistency of arm
- 打造跨境电商成功范式:亚马逊云科技助力卖家布局下一个增长点
- 功能测试——MySQL数据库简介
- Google multi user anti Association tool
- SAP MM 进口采购业务中供应商多送或者少送场景的处理
- 2022年中国手机银行年度专题分析
- 【第 13 章 基于霍夫曼图像压缩重建--Matlab深度学习实战图像处理应用】
猜你喜欢

Divide the list into boxes and draw a histogram through pyechart

The Sandbox 与《时代周刊》达成合作,在元宇宙建立“纽约时报广场”

SQL operation: with expression and its application

Brief introduction to jpom: simple and light low intrusive online construction, automatic deployment, daily operation and maintenance, and project monitoring software

Point cloud registration -- 4pcs principle and Application

华为云发布桌面IDE-CodeArts

飞桨中国行-苏州站,线上线下限时报名通道已开启!

第 08 章 基于知识库的手写体数字识别MATLAB深度学习应用实战

Creating a successful paradigm for cross-border e-commerce: Amazon cloud technology helps sellers lay out the next growth point

2022年Q1手机银行用户规模达6.5亿,加强ESG个人金融产品创新
随机推荐
Intranet learning notes (3)
Record the use process of webscraper
LeetCode 5242. 兼具大小写的最好英文字母
修改字典的方法
【AMD 综合求职经验分享618】
【Proteus仿真】INT0和INT1中断计数
出现IOError: No translation files found for default language zh-cn.的解决方法
同济、阿里获CVPR最佳学生论文,李飞飞获黄煦涛奖,近6000人线下参会
Amazon evaluation browser, core knowledge points of Amazon evaluation risk control
Application of C language dynamic memory function
2022年中国手机银行年度专题分析
【第 07 章 基于主成分分析的人脸二维码识别MATLAB深度学习实战案例】
第 21 章 路面裂缝检测识别系统设计--matlab深度学习实战
【第 14 章 基于主成分分析的图像压缩和重建--matlab深度学习实战案例】
对标Copilot,国内首个:自然语言一键生成方法级代码aiXcoder XL来了
Navicat连接不到MySQL
【第 02 章 基于形态学的权重自适应图像去噪技术-全套系统MATLAB智能驾驶深度学习】
【第 01 章 基于直方图优化的图像去雾技术-全套系统MATLAB智能驾驶深度学习】
英伟达笔试面试题整理DIY
第 08 章 基于知识库的手写体数字识别MATLAB深度学习应用实战