在 IOTA Tangle 上發起一筆交易,必須歷經以下四個步驟:
其中只有 簽名 (signature) 會在 local (錢包端) 執行,其餘 3 個步驟皆以 Restful API 的方式對 IOTA node 進行 request/response. 而 IOTAProxy(此為 fork 後修改過的版本) 專案利用這個特性,將:驗證 2 個之前的交易 (Tips selection) 或 POW (Attach To Tangle) 等loading 較大的 API 進行轉發.
PS. 官方版的 iotaproxy 專案目的正好與修改過的版本相反,官方版其目的在於將 POW (Attach To Tangle) 以外的所有 API 轉發,POW 則留在 local 端的 node 運作,此為因應 LightWallet 上的 light node 皆不支援 POW (Attach To Tangle) 的關係。
$ git clone https://github.com/TimSamshuijzen/iotaproxy
$ cd iotaproxy
$ npm install
Edit index.js to set preferred connection settings. For example:
Run the proxy server:
$ node index.js
您可以透過修改一個錢包來確認您的交易是否有真的被 Relay.
Clone Wallet repo.
$ git clone https://github.com/bahamapascal/CL-Wallet.git
Modify to measure POW duration
$ vi Wallet.py
Search with api.send_transfer:
Run
$ cd CL-Wallet
$ python Wallet.py
Resule
iota.adapter.BadApiResponse: 400 response from node: This operations cannot be executed: The subtangle has not been updated yet.
Relay: Transaction compleated! Cost: 35116 milliseconds.
You can clone all the test script as below from iotaproxy_test_script
Local hardware | Relay hardware |
---|---|
ASUS Tinker Board | IBM X3550 M4 (7914-IA4) |
API Command | Local duration(ms) | Relay duration(ms) |
---|---|---|
getNodeInfo | 1 | 0 |
getNeighbors | 5 | 3 |
getTips | 107 | 28 |
findTransactions | 3 | 2 |
getBalances | 2 | 1 |
getTransactionsToApprove | 38574 | 1 |
attachToTangle | 8326 | 190 |
broadcastTransactions | 1057 | 32 |