觀察與實驗 === # 交易如何確認? iota.lib.py : [get_inclusion_states](https://github.com/iotaledger/iota.lib.py/blob/08230b0d836cbf365c561631a69e55e869473f3f/iota/api.py#L293) 函數的註解: :::info Get the inclusion states of a set of transactions. This is for determining if a transaction was accepted and confirmed by the network or not. You can search for multiple tips (and thus, milestones) to get past inclusion states of transactions. :param transactions: List of transactions you want to get the inclusion state for. :param tips: List of tips (including milestones) you want to search for the inclusion state. ::: iota.lib.js : [getLatestInclusion](https://github.com/iotaledger/iota.lib.js/blob/5e16142efca77e4680f10d1c99b000f23e01652d/lib/api/api.js#L458) ```java= var latestMilestone = nodeInfo.latestSolidSubtangleMilestone; return self.getInclusionStates(hashes, Array(latestMilestone), callback); ``` 可以看到需要Coo發起的交易hash , 才能正確的判斷某筆交易是確認的 一些 $\color{blue}{getInclusionStates}$ 的結果 :::info curl http://node.deviceproof.org:14265 -X POST -H 'Content-Type: application/json' -H 'X-IOTA-API-Version: 1' -d '{"command": "getInclusionStates", "transactions": ["FBPFOAJOCXKYCXNMHMTLFFLBHGIUFKPZATJPBYHGLZKNAPXKYMEEUWRHBEHAX9PHCEQLXPVUDSNGA9999"], "tips": ["ZHIVIWXBDENIVTSZWPVYHDPWWSRREMEN9DFBCBHOULNIYOYROKTBZGMLWYJFOJSQFGFRQUUFCBC9A9999"]}' ::: 結果 :::info {"states":[false],"duration":1} ::: "ZHIVIWXBDENIVTSZWPVYHDPWWSRREMEN9DFBCBHOULNIYOYROKTBZGMLWYJFOJSQFGFRQUUFCBC9A9999" 是 "FBPFOAJOCXKYCXNMHMTLFFLBHGIUFKPZATJPBYHGLZKNAPXKYMEEUWRHBEHAX9PHCEQLXPVUDSNGA9999" 的 Trunk 把"ZHIVIWXBDENIVTSZWPVYHDPWWSRREMEN9DFBCBHOULNIYOYROKTBZGMLWYJFOJSQFGFRQUUFCBC9A9999" 換掉 換掉的command如下 :::info curl http://node.deviceproof.org:14265 -X POST -H 'Content-Type: application/json' -H 'X-IOTA-API-Version: 1' -d '{"command": "getInclusionStates", "transactions": ["FBPFOAJOCXKYCXNMHMTLFFLBHGIUFKPZATJPBYHGLZKNAPXKYMEEUWRHBEHAX9PHCEQLXPVUDSNGA9999"], "tips": ["FBPFOAJOCXKYCXNMHMTLFFLBHGIUFKPZATJPBYHGLZKNAPXKYMEEUWRHBEHAX9PHCEQLXPVUDSNGA9999"]}' ::: 結果 :::info {"states":[true],"duration":1} ::: # transactionToApprove的流程 ###### tags: `IOTA`