Skip to content

Instantly share code, notes, and snippets.

@shd101wyy

shd101wyy/test.md

Last active Jun 15, 2018
Embed
What would you like to do?
IELE communication
  • iele_sendTransaction and iele_call:
➜  mantis-1.0-daedalus-rc1 curl -XPOST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"personal_unlockAccount", "params": ["654510a4a13393d9aed326c86bc84df2d5fcfbbf", "4rfv5tgB"], "id": 4}' localhost:8546
{"jsonrpc":"2.0","result":true,"id":4}%                                                                                                                                                                     

➜  mantis-1.0-daedalus-rc1 curl -XPOST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"iele_sendTransaction", "params": [{"from":"654510a4a13393d9aed326c86bc84df2d5fcfbbf", "gasPrice":5000000000, "gasLimit": 1000000, "contractCode": "0x0000004C6303690009666163746F7269616C6800010001618001100042650003026101036600006180011200446500020466000102001B610101030040640000660002F6000103660003FE6700000000", "arguments": []}], "id": 3}' localhost:8546
{"jsonrpc":"2.0","result":"0xb696754c82cc75b2d361b5180fc7f86846c1d54d48c9077c3c87997cb42a88ca","id":3}%                                                                                                     

➜  mantis-1.0-daedalus-rc1 curl -XPOST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"eth_getTransactionReceipt", "params": ["0xb696754c82cc75b2d361b5180fc7f86846c1d54d48c9077c3c87997cb42a88ca"], "id": 4}' localhost:8546
{"jsonrpc":"2.0","result":{"transactionHash":"0xb696754c82cc75b2d361b5180fc7f86846c1d54d48c9077c3c87997cb42a88ca","transactionIndex":"0x0","blockNumber":"0x63d","blockHash":"0x475c3818b7f6a435e695344fd729f6c888260174b6c92252a58c34bdf2e0e53d","cumulativeGasUsed":"0xa11c","gasUsed":"0xa11c","contractAddress":"0x309f858f24a90d181816aa19c368978b55b68fca","logs":[]},"id":4}%                                    ➜  mantis-1.0-daedalus-rc1 curl -XPOST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"iele_call", "params": [{"from":"654510a4a13393d9aed326c86bc84df2d5fcfbbf", "to":"0x309f858f24a90d181816aa19c368978b55b68fca", "gasPrice":500000, "value":0, "function": "@factorial", "arguments": []}, "latest"], "id": 2}' localhost:8546
{"jsonrpc":"2.0","result":[],"id":2}%                                                                                                                                                                       

➜  mantis-1.0-daedalus-rc1 curl -XPOST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"iele_call", "params": [{"from":"654510a4a13393d9aed326c86bc84df2d5fcfbbf", "to":"0x309f858f24a90d181816aa19c368978b55b68fca", "gasPrice":500000, "value":0, "function": "factorial", "arguments": ["0x6"]}, "latest"], "id": 2}' localhost:8546
{"jsonrpc":"2.0","result":["0x02d0"],"id":2}%
  • eth_sendTransaction and iele_call
➜  mantis-1.0-daedalus-rc1 rlp encode '["0x0000004C6303690009666163746F7269616C6800010001618001100042650003026101036600006180011200446500020466000102001B610101030040640000660002F6000103660003FE6700000000", []]'                                   
f853b8500000004c6303690009666163746f7269616c6800010001618001100042650003026101036600006180011200446500020466000102001b610101030040640000660002f6000103660003fe6700000000c0
➜  mantis-1.0-daedalus-rc1 curl -XPOST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"personal_unlockAccount", "params": ["654510a4a13393d9aed326c86bc84df2d5fcfbbf", "4rfv5tgB"], "id": 4}' localhost:8546
{"jsonrpc":"2.0","result":true,"id":4}%                                                                                                                                                                     
➜  mantis-1.0-daedalus-rc1 curl -XPOST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"eth_sendTransaction", "params": [{"from":"654510a4a13393d9aed326c86bc84df2d5fcfbbf", "gasPrice":500000, "value":0, "data": "f853b8500000004c6303690009666163746f7269616c6800010001618001100042650003026101036600006180011200446500020466000102001b610101030040640000660002f6000103660003fe6700000000c0"}], "id": 2}' localhost:8546 
{"jsonrpc":"2.0","result":"0xcd40a09b19acd6296f38778875934b9c423335871721bf30793c9a2ba0b06580","id":2}%                                                                                                     
➜  mantis-1.0-daedalus-rc1 curl -XPOST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"eth_getTransactionReceipt", "params": ["0xcd40a09b19acd6296f38778875934b9c423335871721bf30793c9a2ba0b06580"], "id": 4}' localhost:8546
{"jsonrpc":"2.0","result":{"transactionHash":"0xcd40a09b19acd6296f38778875934b9c423335871721bf30793c9a2ba0b06580","transactionIndex":"0x0","blockNumber":"0x6f7","blockHash":"0x728a9802c24caf130b3a6a72cae9cd373d152d1d296ec73af917e0f5cd8b9cce","cumulativeGasUsed":"0xa11c","gasUsed":"0xa11c","contractAddress":"0xa31c3e625afeddc60a2160f244679251be66c7bc","logs":[]},"id":4}%                                    
➜  mantis-1.0-daedalus-rc1 curl -XPOST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"iele_call", "params": [{"from":"654510a4a13393d9aed326c86bc84df2d5fcfbbf", "to":"0xa31c3e625afeddc60a2160f244679251be66c7bc", "gasPrice":500000, "value":0, "function": "factorial", "arguments": ["0x6"]}, "latest"], "id": 2}' localhost:8546
{"jsonrpc":"2.0","result":["0x02d0"],"id":2}
  • eth_call and eth_sendTransaction
➜  mantis-1.0-daedalus-rc1 rlp encode '["0x0000004C6303690009666163746F7269616C6800010001618001100042650003026101036600006180011200446500020466000102001B610101030040640000660002F6000103660003FE6700000000", []]'                                   
f853b8500000004c6303690009666163746f7269616c6800010001618001100042650003026101036600006180011200446500020466000102001b610101030040640000660002f6000103660003fe6700000000c0
➜  mantis-1.0-daedalus-rc1 curl -XPOST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"personal_unlockAccount", "params": ["654510a4a13393d9aed326c86bc84df2d5fcfbbf", "4rfv5tgB"], "id": 4}' localhost:8546
{"jsonrpc":"2.0","result":true,"id":4}%                                                                                                                                                                     
➜  mantis-1.0-daedalus-rc1 curl -XPOST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"eth_sendTransaction", "params": [{"from":"654510a4a13393d9aed326c86bc84df2d5fcfbbf", "gasPrice":500000, "value":0, "data": "f853b8500000004c6303690009666163746f7269616c6800010001618001100042650003026101036600006180011200446500020466000102001b610101030040640000660002f6000103660003fe6700000000c0"}], "id": 2}' localhost:8546 
{"jsonrpc":"2.0","result":"0xcd40a09b19acd6296f38778875934b9c423335871721bf30793c9a2ba0b06580","id":2}%                                                                                                     
➜  mantis-1.0-daedalus-rc1 curl -XPOST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"eth_getTransactionReceipt", "params": ["0xcd40a09b19acd6296f38778875934b9c423335871721bf30793c9a2ba0b06580"], "id": 4}' localhost:8546
{"jsonrpc":"2.0","result":{"transactionHash":"0xcd40a09b19acd6296f38778875934b9c423335871721bf30793c9a2ba0b06580","transactionIndex":"0x0","blockNumber":"0x6f7","blockHash":"0x728a9802c24caf130b3a6a72cae9cd373d152d1d296ec73af917e0f5cd8b9cce","cumulativeGasUsed":"0xa11c","gasUsed":"0xa11c","contractAddress":"0xa31c3e625afeddc60a2160f244679251be66c7bc","logs":[]},"id":4}%   
➜  mantis-1.0-daedalus-rc1 rlp encode '["factorial", ["0x6"]]'
cc89666163746f7269616cc106
➜  mantis-1.0-daedalus-rc1 curl -XPOST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"eth_call", "params": [{"from":"654510a4a13393d9aed326c86bc84df2d5fcfbbf", "to":"a31c3e625afeddc60a2160f244679251be66c7bc", "gasPrice":800000, "value":0, "data": "cc89666163746f7269616cc106"}, "latest"], "id": 2}' localhost:8546
{"jsonrpc":"2.0","result":"0xc38202d0","id":2}%                                                                                                                                                            
➜  mantis-1.0-daedalus-rc1 rlp decode 0xc38202d0
[ '02d0' ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment