码迷,mamicode.com
首页 > 其他好文 > 详细

【比特币】Ethereum: Smart Contract

时间:2016-08-18 16:01:56      阅读:254      评论:0      收藏:0      [点我收藏+]

标签:

Introduction

History

There is a payment called P2SH( pay to script hash) in bitcoin. With this feature, you can compile many interesting scripts( the original form of contract) like this wiki and this.

Here more sample for P2SH:

  • Hash Locked Tx on ZKCP
OP_SHA256
<Y> OP_EQUAL
OP_IF
  <Seller Pubkey>
OP_ELSE
  <block_height+100> OP_CHECKLOCKTIMEVERIFY OP_DROP
  <Buyer Pubkey>
OP_ENDIF
OP_CHECKSIG

But for more complex logical control on contract, such as colored bitcoin, and stake IPO, Bitcoin has no these abilities.

More Inventions

  • Powerful script: a Turing-Complete VM and interperter

  • State stroage: MPT as a database

  • Protection of network from abusing of the powerful script: Gas

Experiment on Ethereum private network

  • Construct a Private network

what happens on block-chain

  • Install a script interpreter: Solidity for example

  • Fund a EOA with ether

  • Create Contract from this EOA

    • write a script
    • compile
    • deploy
    • get address of this contract

what happens on block-chain

  • Call the contract

what happens on block-chain

【比特币】Ethereum: Smart Contract

标签:

原文地址:http://blog.csdn.net/hacode/article/details/52241745

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!