MitAh's Blog
2018 *CTF Smart Contract writeup

近期在 DDCTF 和 *CTF 中相继遇到了两道区块链攻击相关的题目,复现题目,记录一下学习过程。

题目链接

https://github.com/sixstars/starctf2018/blob/master/web-smart_contract

基础知识

由于篇幅关系,区块链的基本概念在这里就不多赘述了,网上有很多很好的文章说的比较清楚。
这道题目需要了解的主要是下面几个概念。

UTXO

UTXO 是比特币交易的基本单位,指未花费的交易输出(Unspent Transaction Output)
区块链账本里记录的是一笔又一笔的交易。
每笔交易都要花费若干笔输入,产生若干笔输出,而其所产生的输出,就是“未花费过的交易输出”,也就是 UTXO。
当我们说小p拥有 233 个比特币的时候,实际上指的是区块链账本上有若干笔交易产生的若干个 UTXO 所属人为小p。这些 UTXO 的数额总和是 233。

智能合约

用最简单的话说,智能合约,就是一段写在区块链上的代码,一旦某个事件触发合约中的条款,代码即自动执行。
在本题中 SRC20SmartContract 就是一个智能合约,当我们 buyTokens (StarCoins -> StarTokens)withdraw (StarTokens -> StarCoins) 时,确认交易符合规范后,自动用银行的私钥进行签名,简化交易流程。

染色币

染色币是一种在少量比特币上存储信息的一种元协议,重新用于表达另一种资产。
通过将一笔具体的交易转化为某种证明来指证另外一笔财产。
在这道题中,染色区在 extra 字段,用来指证拥有该染色币的用户的 tokenNum

流程分析

用户初始拥有 100 StarCoins,可以向银行购买和赎回 StarTokens,兑换比例 1:1。
当拥有 200 StarCoins 时即可获得 flag。
首先我们进行两步操作:

  • 购买 100 StarTokens
  • 赎回 100 StarCoins

观察 utxos 发生了哪些变化。

{
    "abbede75-6d12-484c-8b3b-db25f3749084": {
        "amount": 100,
        "hash": "a326de69368593b3d3da98cc2e1709c0b3100e069b5cd749540c56d81a25a794",
        "id": "abbede75-6d12-484c-8b3b-db25f3749084",
        "addr": "8a408198b689a675e3afc74febcda569a80dd5deee9df48cd7a942f7b1226dc6b40d809924640a3f10ff9824aef9f417"
    },
    "68b8fd0f-aa79-409c-a9d4-642f4ff7f7db": {
        "amount": 200,
        "hash": "5a7c04a5f6483b6293ebbcefc0c5b0131e8a0977e30013395409610d69856529",
        "id": "68b8fd0f-aa79-409c-a9d4-642f4ff7f7db",
        "addr": "a3e0da13bc7aacc78b027dd1d7adf284837d1fbe94985453587667df843ec226f5fc30b102151a67cee773b082ac82c9"
    }
}
初始状态

用户拥有

  • abbede75 块 utxo,余额 100

银行拥有

  • 68b8fd0f 块 utxo,余额 200
/* utxos step1 */
{
    "68b8fd0f-aa79-409c-a9d4-642f4ff7f7db": {
        "amount": 200,
        "hash": "5a7c04a5f6483b6293ebbcefc0c5b0131e8a0977e30013395409610d69856529",
        "addr": "a3e0da13bc7aacc78b027dd1d7adf284837d1fbe94985453587667df843ec226f5fc30b102151a67cee773b082ac82c9",
        "id": "68b8fd0f-aa79-409c-a9d4-642f4ff7f7db"
    },
    "bec93d8e-2adc-4425-a4b2-b67394eab024": {
        "id": "bec93d8e-2adc-4425-a4b2-b67394eab024",
        "amount": 0,
        "hash": "c5e342156f090333f4a16c3fea3343db56747e6c0a9648f76f987fa36202d428",
        "addr": "8a408198b689a675e3afc74febcda569a80dd5deee9df48cd7a942f7b1226dc6b40d809924640a3f10ff9824aef9f417",
        "extra": "4bad508f6c27cd65922f389eaccb350b12750c2f228f6f200fb3c8c7345a80cc8eae82de094834e5c3ea83a066409744$$${\"tokenNum\": 100, \"utxo_id\": \"bec93d8e-2adc-4425-a4b2-b67394eab024\"}"
    },
    "ed8b30f7-032e-4540-a3a6-71fd1c24bfff": {
        "amount": 100,
        "hash": "6f711fb7b2ec1c1969508c7a30bc312a35f71d655dd0288b025502bd067680b8",
        "addr": "a3e0da13bc7aacc78b027dd1d7adf284837d1fbe94985453587667df843ec226f5fc30b102151a67cee773b082ac82c9",
        "id": "ed8b30f7-032e-4540-a3a6-71fd1c24bfff"
    }
}
step 1

购买 100 StarTokens

用户拥有的 abbede75 块 utxo 余额 100,被删除。
创建新的 ed8b30f7 块 utxo 余额 100,所属人为银行。
创建新的 bec93d8e 块 utxo 余额 0,tokenNum + 100,所属人为用户。

用户拥有

  • bec93d8e 块 utxo,tokenNum + 100

银行拥有

  • 68b8fd0f 块 utxo,余额 200
  • ed8b30f7 块 utxo,余额 100
/* utxos step2 */
{
    "e1b2eeeb-7169-434a-9e4b-9b08404eec15": {
        "id": "e1b2eeeb-7169-434a-9e4b-9b08404eec15",
        "amount": 0,
        "hash": "25ce287261bac974c560d3d34f9259a3fd6b5d8cb0b338b86ff716d099a2b592",
        "addr": "8a408198b689a675e3afc74febcda569a80dd5deee9df48cd7a942f7b1226dc6b40d809924640a3f10ff9824aef9f417",
        "extra": "2f824be672f5d1193fed5785a1bf93c3d1645c9f01583385acd7bf0aa8036ef740617f720ca995d2f33ca25b261863b8$$${\"tokenNum\": -100, \"utxo_id\": \"e1b2eeeb-7169-434a-9e4b-9b08404eec15\"}"
    },
    "d39a68c1-57c2-4b9a-93ad-cab55eb502f4": {
        "amount": 100,
        "hash": "b7bb6146610657747a807502a1add6319bf12aa3ff197a49b243d765ac25d7d0",
        "addr": "8a408198b689a675e3afc74febcda569a80dd5deee9df48cd7a942f7b1226dc6b40d809924640a3f10ff9824aef9f417",
        "id": "d39a68c1-57c2-4b9a-93ad-cab55eb502f4"
    },
    "68b8fd0f-aa79-409c-a9d4-642f4ff7f7db": {
        "amount": 200,
        "hash": "5a7c04a5f6483b6293ebbcefc0c5b0131e8a0977e30013395409610d69856529",
        "addr": "a3e0da13bc7aacc78b027dd1d7adf284837d1fbe94985453587667df843ec226f5fc30b102151a67cee773b082ac82c9",
        "id": "68b8fd0f-aa79-409c-a9d4-642f4ff7f7db"
    },
    "bec93d8e-2adc-4425-a4b2-b67394eab024": {
        "id": "bec93d8e-2adc-4425-a4b2-b67394eab024",
        "amount": 0,
        "hash": "c5e342156f090333f4a16c3fea3343db56747e6c0a9648f76f987fa36202d428",
        "addr": "8a408198b689a675e3afc74febcda569a80dd5deee9df48cd7a942f7b1226dc6b40d809924640a3f10ff9824aef9f417",
        "extra": "4bad508f6c27cd65922f389eaccb350b12750c2f228f6f200fb3c8c7345a80cc8eae82de094834e5c3ea83a066409744$$${\"tokenNum\": 100, \"utxo_id\": \"bec93d8e-2adc-4425-a4b2-b67394eab024\"}"
    }
}
step 2

赎回 100 StarCoins

银行拥有的 ed8b30f7 块 utxo 余额 100,被删除。
创建新的 d39a68c1 块 utxo 余额 100,所属人为用户。
创建新的 e1b2eeeb 块 utxo 余额 0,tokenNum - 100,所属人为用户。

用户拥有

  • bec93d8e 块 utxo,tokenNum + 100
  • e1b2eeeb 块 utxo,tokenNum - 100
  • d39a68c1 块 utxo,余额 100

银行拥有

  • 68b8fd0f 块 utxo,余额 200

漏洞分析

题目中对 StarTokens 余额的计算存在漏洞。

这段代码的意思是,当一块 utxo 作为一笔交易的输入被使用时,就从 utxos 中删除该块,再把新生成的 utxo 插入 utxos。
在上述的流程分析中可以看的比较清晰。

其中 bec93d8e 块 utxo 和 e1b2eeeb 块 utxo 可以理解为染色币。
这两块 utxo 余额都为 0,而通过 extra 字段的染色来指证用户的 tokenNum

既然这两块染色币都是属于用户的 uxto,那么用户就可以使用他们作为一笔交易的输入。
而当一块 utxo 作为交易输入被使用时,就会从 utxos 中删除,同时也就删除了 extra 字段,对用户 tokenNum 的指证随之被清除。

那么思路就很清晰了,我们可以构造一笔交易,将 e1b2eeeb 块 utxo (tokenNum - 100) 交易给银行。
由于这块 uxto 余额为 0,所以银行只会愉快的收下,并不会返回 StarTokens。
仍然列出操作后的 uxtos 来看。

/* utxos step3 */
{
    "d39a68c1-57c2-4b9a-93ad-cab55eb502f4": {
        "amount": 100,
        "hash": "b7bb6146610657747a807502a1add6319bf12aa3ff197a49b243d765ac25d7d0",
        "addr": "8a408198b689a675e3afc74febcda569a80dd5deee9df48cd7a942f7b1226dc6b40d809924640a3f10ff9824aef9f417",
        "id": "d39a68c1-57c2-4b9a-93ad-cab55eb502f4"
    },
    "68b8fd0f-aa79-409c-a9d4-642f4ff7f7db": {
        "amount": 200,
        "hash": "5a7c04a5f6483b6293ebbcefc0c5b0131e8a0977e30013395409610d69856529",
        "addr": "a3e0da13bc7aacc78b027dd1d7adf284837d1fbe94985453587667df843ec226f5fc30b102151a67cee773b082ac82c9",
        "id": "68b8fd0f-aa79-409c-a9d4-642f4ff7f7db"
    },
    "bec93d8e-2adc-4425-a4b2-b67394eab024": {
        "id": "bec93d8e-2adc-4425-a4b2-b67394eab024",
        "amount": 0,
        "hash": "c5e342156f090333f4a16c3fea3343db56747e6c0a9648f76f987fa36202d428",
        "addr": "8a408198b689a675e3afc74febcda569a80dd5deee9df48cd7a942f7b1226dc6b40d809924640a3f10ff9824aef9f417",
        "extra": "4bad508f6c27cd65922f389eaccb350b12750c2f228f6f200fb3c8c7345a80cc8eae82de094834e5c3ea83a066409744$$${\"tokenNum\": 100, \"utxo_id\": \"bec93d8e-2adc-4425-a4b2-b67394eab024\"}"
    },
    "79cbef40-be54-44e3-832c-ad7d0ce8e41a": {
        "amount": 0,
        "hash": "7f0795c92b64ed856f39e25e46a43da13b03a621b67a1fb472ff0c7258579e2b",
        "addr": "a3e0da13bc7aacc78b027dd1d7adf284837d1fbe94985453587667df843ec226f5fc30b102151a67cee773b082ac82c9",
        "id": "79cbef40-be54-44e3-832c-ad7d0ce8e41a"
    }
}
step 3

e1b2eeeb 块 utxo 交易给银行

用户拥有的 e1b2eeeb 块 utxo 余额 0,tokenNum - 100,被删除。
创建新的 79cbef40 块 utxo 余额 0,所属人为银行。

用户拥有

  • bec93d8e 块 utxo,tokenNum + 100
  • d39a68c1 块 utxo,余额 100

银行拥有

  • 68b8fd0f 块 utxo,余额 200
  • 79cbef40 块 utxo,余额 0

此时,用户就拥有了 100 StarCoins + 100 StarTokens,成功白嫖了银行 100 块。

step 4

接下来只需再向银行购买 100 StarTokens

step 5

然后再全部赎回

用户就拥有 200 StarCoins 了,获得 flag。

一点思考

这里面有一个小问题,为什么不在 step 4 直接赎回 100 StarCoins,而要先买 100 再赎回 200 呢。

因为在 step 3 后,银行仅拥有一块 utxo 68b8fd0f ,余额 200。如果直接赎回,银行需要向用户支付 100。

在实际比特币交易过程中,当用 200 块去付 100 块时,会有一个找零的过程。
生成一个余额为 100 的 utxo 交易给对方,再生成一个 余额为 99.99... 的 uxto 找零给自己,还有一点会奖励给矿工。

而在本题的代码中,作者并没有实现这个找零的过程,只支持整块 utxo 交易,所以我们需要用 200 StarTokens 去换银行的 200 StarCoins。

exp

自认为自己写的 exp 并不如作者给出的优雅。
请读者移步 https://github.com/sixstars/starctf2018/blob/master/web-smart_contract/solve.py

utxos & Blockchain

最后给出整个交易流程后的 utxos & Blockchain,帮助理解。

/* final utxos */
{
    "546ff4c4-a781-4688-9b08-c89e4645c393": {
        "id": "546ff4c4-a781-4688-9b08-c89e4645c393",
        "amount": 0,
        "hash": "c5b18d108d8bce8fed15298fb703d6d52c5ddd2be1031e09e9049b60d7fa9dac",
        "addr": "8a408198b689a675e3afc74febcda569a80dd5deee9df48cd7a942f7b1226dc6b40d809924640a3f10ff9824aef9f417",
        "extra": "9bd3e76fe60df38a4d4d9818df6a46858e99b33ca813e47b942f103643a97ebfcd86135078c2d74df7043d6d5859081b$$${\"tokenNum\": -200, \"utxo_id\": \"546ff4c4-a781-4688-9b08-c89e4645c393\"}"
    },
    "a430275c-db75-4082-9107-527a88cbdbe8": {
        "amount": 100,
        "hash": "83e77c8116aa68798e7642a10fd7d1f3b814f51f8981d889873751d4098698ed",
        "addr": "a3e0da13bc7aacc78b027dd1d7adf284837d1fbe94985453587667df843ec226f5fc30b102151a67cee773b082ac82c9",
        "id": "a430275c-db75-4082-9107-527a88cbdbe8"
    },
    "fbb74452-2539-42af-9606-3e25903d849c": {
        "amount": 200,
        "hash": "decd3f1aaaf6ed7cc2257f86704b30db9729426f6dae5d0e96d0a4f90572e1c2",
        "addr": "8a408198b689a675e3afc74febcda569a80dd5deee9df48cd7a942f7b1226dc6b40d809924640a3f10ff9824aef9f417",
        "id": "fbb74452-2539-42af-9606-3e25903d849c"
    },
    "bec93d8e-2adc-4425-a4b2-b67394eab024": {
        "id": "bec93d8e-2adc-4425-a4b2-b67394eab024",
        "amount": 0,
        "hash": "c5e342156f090333f4a16c3fea3343db56747e6c0a9648f76f987fa36202d428",
        "addr": "8a408198b689a675e3afc74febcda569a80dd5deee9df48cd7a942f7b1226dc6b40d809924640a3f10ff9824aef9f417",
        "extra": "4bad508f6c27cd65922f389eaccb350b12750c2f228f6f200fb3c8c7345a80cc8eae82de094834e5c3ea83a066409744$$${\"tokenNum\": 100, \"utxo_id\": \"bec93d8e-2adc-4425-a4b2-b67394eab024\"}"
    },
    "bbfb11d0-4e05-4aed-b806-72f18b54a983": {
        "id": "bbfb11d0-4e05-4aed-b806-72f18b54a983",
        "amount": 0,
        "hash": "2c95425ce6072c172c393ffc35b4be9d3512ebdb8ed80333f122648669debe51",
        "addr": "8a408198b689a675e3afc74febcda569a80dd5deee9df48cd7a942f7b1226dc6b40d809924640a3f10ff9824aef9f417",
        "extra": "443d4ae1d410a5aea26b85374ebd8f9eae3bf808de72e32ddc6b5dfcd606f012c7627ecdc1137f679fc518336553d7fe$$${\"tokenNum\": 100, \"utxo_id\": \"bbfb11d0-4e05-4aed-b806-72f18b54a983\"}"
    },
    "79cbef40-be54-44e3-832c-ad7d0ce8e41a": {
        "amount": 0,
        "hash": "7f0795c92b64ed856f39e25e46a43da13b03a621b67a1fb472ff0c7258579e2b",
        "addr": "a3e0da13bc7aacc78b027dd1d7adf284837d1fbe94985453587667df843ec226f5fc30b102151a67cee773b082ac82c9",
        "id": "79cbef40-be54-44e3-832c-ad7d0ce8e41a"
    }
}
/* final Blockchain */
{
    "3725630f78b1848f4ec98809846a3fd6d9f0f6961e0e37af5cce579651b57788": {
        "nonce": "step1",
        "prev": "c67195e29436d0292a3c60891e12ee46dc0318ce11798d87450c8838cdd983b9",
        "hash": "3725630f78b1848f4ec98809846a3fd6d9f0f6961e0e37af5cce579651b57788",
        "transactions": [{
            "call_smart_contract": "buyTokens",
            "input": ["abbede75-6d12-484c-8b3b-db25f3749084"],
            "signature": ["82acf7194aac39c555bd4aebad6091c476663d412fdd58893c7dff55c506fcbc4decbf445bb5c24756e89244f416180a"],
            "hash": "7df1f8caed6743ed7e534d9633b9d79651aba2940411a1e85165bbfbbdd23999",
            "output": [{
                "amount": 100,
                "hash": "6f711fb7b2ec1c1969508c7a30bc312a35f71d655dd0288b025502bd067680b8",
                "addr": "a3e0da13bc7aacc78b027dd1d7adf284837d1fbe94985453587667df843ec226f5fc30b102151a67cee773b082ac82c9",
                "id": "ed8b30f7-032e-4540-a3a6-71fd1c24bfff"
            }, {
                "id": "bec93d8e-2adc-4425-a4b2-b67394eab024",
                "amount": 0,
                "hash": "c5e342156f090333f4a16c3fea3343db56747e6c0a9648f76f987fa36202d428",
                "addr": "8a408198b689a675e3afc74febcda569a80dd5deee9df48cd7a942f7b1226dc6b40d809924640a3f10ff9824aef9f417",
                "extra": "4bad508f6c27cd65922f389eaccb350b12750c2f228f6f200fb3c8c7345a80cc8eae82de094834e5c3ea83a066409744$$${\"tokenNum\": 100, \"utxo_id\": \"bec93d8e-2adc-4425-a4b2-b67394eab024\"}"
            }]
        }],
        "height": 1
    },
    "4ecb6bf18890b7123ab815d38fad15d9633edd9dea01b8e6cba8ec292180a32a": {
        "nonce": "step4",
        "prev": "b18db8dfbd0f93b9952eb9460d2cce9938fe3cf9b2148ca6640a812be2ddd3e5",
        "hash": "4ecb6bf18890b7123ab815d38fad15d9633edd9dea01b8e6cba8ec292180a32a",
        "transactions": [{
            "call_smart_contract": "buyTokens",
            "input": ["d39a68c1-57c2-4b9a-93ad-cab55eb502f4"],
            "signature": ["2d86f7e188098efcb69de65648a017fb9ce9d4347b04090b634b5b5cf3e6e0367d423e4676369afde5ed3355b0ba16d8"],
            "hash": "9e0def106786876ac0d5ce28fa7d12c390176f0faa4272ad426ade60fc822b1f",
            "output": [{
                "amount": 100,
                "hash": "83e77c8116aa68798e7642a10fd7d1f3b814f51f8981d889873751d4098698ed",
                "addr": "a3e0da13bc7aacc78b027dd1d7adf284837d1fbe94985453587667df843ec226f5fc30b102151a67cee773b082ac82c9",
                "id": "a430275c-db75-4082-9107-527a88cbdbe8"
            }, {
                "id": "bbfb11d0-4e05-4aed-b806-72f18b54a983",
                "amount": 0,
                "hash": "2c95425ce6072c172c393ffc35b4be9d3512ebdb8ed80333f122648669debe51",
                "addr": "8a408198b689a675e3afc74febcda569a80dd5deee9df48cd7a942f7b1226dc6b40d809924640a3f10ff9824aef9f417",
                "extra": "443d4ae1d410a5aea26b85374ebd8f9eae3bf808de72e32ddc6b5dfcd606f012c7627ecdc1137f679fc518336553d7fe$$${\"tokenNum\": 100, \"utxo_id\": \"bbfb11d0-4e05-4aed-b806-72f18b54a983\"}"
            }]
        }],
        "height": 4
    },
    "b18db8dfbd0f93b9952eb9460d2cce9938fe3cf9b2148ca6640a812be2ddd3e5": {
        "nonce": "step3",
        "prev": "64978731fcc2c8dfbc06ef870d525b89eafd160dde475165a32acb8c11574598",
        "hash": "b18db8dfbd0f93b9952eb9460d2cce9938fe3cf9b2148ca6640a812be2ddd3e5",
        "transactions": [{
            "input": ["e1b2eeeb-7169-434a-9e4b-9b08404eec15"],
            "signature": ["89e21bf51601c480f75d118705f74ec4f70f1fb2283d7666a1a5b4962d9c86af1bcff1f02256a040e2140de8af9dbde0"],
            "hash": "fdad65a97ace685d1f7a612c59fc47b560c4a612c6517a893f5a8d607883e300",
            "output": [{
                "amount": 0,
                "hash": "7f0795c92b64ed856f39e25e46a43da13b03a621b67a1fb472ff0c7258579e2b",
                "addr": "a3e0da13bc7aacc78b027dd1d7adf284837d1fbe94985453587667df843ec226f5fc30b102151a67cee773b082ac82c9",
                "id": "79cbef40-be54-44e3-832c-ad7d0ce8e41a"
            }]
        }],
        "height": 3
    },
    "5ca17885803a96a0452b3fc9f92cb0fb9e5faa9f6c62bfb4444f73fc8f71aebe": {
        "nonce": "step5",
        "prev": "4ecb6bf18890b7123ab815d38fad15d9633edd9dea01b8e6cba8ec292180a32a",
        "hash": "5ca17885803a96a0452b3fc9f92cb0fb9e5faa9f6c62bfb4444f73fc8f71aebe",
        "transactions": [{
            "call_smart_contract": "withdraw",
            "input": ["68b8fd0f-aa79-409c-a9d4-642f4ff7f7db"],
            "signature": ["9513a1bb8f648142ab22cc24badd0e19aa587cb88db2ccf20591e27bcf1cdf78b87c7381ad5890fe74cef180b8b8ce19"],
            "hash": "e065a8118c56c4f02330f5b039f2849a43a1dd2a9cc1a05f561ecb098e57b133",
            "output": [{
                "amount": 200,
                "hash": "decd3f1aaaf6ed7cc2257f86704b30db9729426f6dae5d0e96d0a4f90572e1c2",
                "addr": "8a408198b689a675e3afc74febcda569a80dd5deee9df48cd7a942f7b1226dc6b40d809924640a3f10ff9824aef9f417",
                "id": "fbb74452-2539-42af-9606-3e25903d849c"
            }, {
                "id": "546ff4c4-a781-4688-9b08-c89e4645c393",
                "amount": 0,
                "hash": "c5b18d108d8bce8fed15298fb703d6d52c5ddd2be1031e09e9049b60d7fa9dac",
                "addr": "8a408198b689a675e3afc74febcda569a80dd5deee9df48cd7a942f7b1226dc6b40d809924640a3f10ff9824aef9f417",
                "extra": "9bd3e76fe60df38a4d4d9818df6a46858e99b33ca813e47b942f103643a97ebfcd86135078c2d74df7043d6d5859081b$$${\"tokenNum\": -200, \"utxo_id\": \"546ff4c4-a781-4688-9b08-c89e4645c393\"}"
            }]
        }],
        "height": 5
    },
    "64978731fcc2c8dfbc06ef870d525b89eafd160dde475165a32acb8c11574598": {
        "nonce": "step2",
        "prev": "3725630f78b1848f4ec98809846a3fd6d9f0f6961e0e37af5cce579651b57788",
        "hash": "64978731fcc2c8dfbc06ef870d525b89eafd160dde475165a32acb8c11574598",
        "transactions": [{
            "call_smart_contract": "withdraw",
            "input": ["ed8b30f7-032e-4540-a3a6-71fd1c24bfff"],
            "signature": ["56f27c4bf8cbc14ff34c3cbf77c4c46c215bdeccb2d58bb4b4c4eefefc183713b335b3ba7b0b77e0743cd82b1efceb33"],
            "hash": "f05f656db7abfbdda30f9547f3c287af21a577e7cafe8d63e853d492de685511",
            "output": [{
                "amount": 100,
                "hash": "b7bb6146610657747a807502a1add6319bf12aa3ff197a49b243d765ac25d7d0",
                "addr": "8a408198b689a675e3afc74febcda569a80dd5deee9df48cd7a942f7b1226dc6b40d809924640a3f10ff9824aef9f417",
                "id": "d39a68c1-57c2-4b9a-93ad-cab55eb502f4"
            }, {
                "id": "e1b2eeeb-7169-434a-9e4b-9b08404eec15",
                "amount": 0,
                "hash": "25ce287261bac974c560d3d34f9259a3fd6b5d8cb0b338b86ff716d099a2b592",
                "addr": "8a408198b689a675e3afc74febcda569a80dd5deee9df48cd7a942f7b1226dc6b40d809924640a3f10ff9824aef9f417",
                "extra": "2f824be672f5d1193fed5785a1bf93c3d1645c9f01583385acd7bf0aa8036ef740617f720ca995d2f33ca25b261863b8$$${\"tokenNum\": -100, \"utxo_id\": \"e1b2eeeb-7169-434a-9e4b-9b08404eec15\"}"
            }]
        }],
        "height": 2
    },
    "c67195e29436d0292a3c60891e12ee46dc0318ce11798d87450c8838cdd983b9": {
        "nonce": "The Times 03/Jan/2009 Chancellor on brink of second bailout for bank",
        "prev": "0000000000000000000000000000000000000000000000000000000000000000",
        "hash": "c67195e29436d0292a3c60891e12ee46dc0318ce11798d87450c8838cdd983b9",
        "transactions": [{
            "input": [],
            "signature": [],
            "hash": "965d9e2cc4e63a017e3a46756b7310c9e33d02d909ebded7326900c8285b917f",
            "output": [{
                "amount": 200,
                "hash": "5a7c04a5f6483b6293ebbcefc0c5b0131e8a0977e30013395409610d69856529",
                "addr": "a3e0da13bc7aacc78b027dd1d7adf284837d1fbe94985453587667df843ec226f5fc30b102151a67cee773b082ac82c9",
                "id": "68b8fd0f-aa79-409c-a9d4-642f4ff7f7db"
            }, {
                "amount": 100,
                "hash": "a326de69368593b3d3da98cc2e1709c0b3100e069b5cd749540c56d81a25a794",
                "addr": "8a408198b689a675e3afc74febcda569a80dd5deee9df48cd7a942f7b1226dc6b40d809924640a3f10ff9824aef9f417",
                "id": "abbede75-6d12-484c-8b3b-db25f3749084"
            }]
        }],
        "height": 0
    }
}

总结

第一次接触区块链这个方向,可能有些地方写的不到位,欢迎大家指正。

我好菜啊(

0 评论

分类目录
赞助二维码

支付宝

评论表情