Last active
August 29, 2015 14:13
-
-
Save pmitchev/fcee1345e20d70108e37 to your computer and use it in GitHub Desktop.
Cryptonote RPC get_o_indexes.bin Python example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import binascii | |
| import requests | |
| import struct | |
| def main(): | |
| packed_data_tx = struct.pack('@I I B', 16847105, 16908545, 1) # signiture | |
| packed_data_tx += struct.pack('@B B 4s', 4, 4, "txid") # type?, length, text | |
| packed_data_tx += struct.pack('@B', 10) + bytearray.fromhex("80") # type, strarray? | |
| packed_data_tx += bytearray.fromhex("f579ff2174f828b6619a70d791db5297c9769c3e3cf06afb99e364f2bfa94c9f") | |
| print 'Packed Value :', binascii.hexlify(packed_data_tx) | |
| response_tx = requests.post('http://localhost:29081/get_o_indexes.bin', data=packed_data_tx) | |
| print response_tx.status_code | |
| print(binascii.hexlify(response_tx.content)) | |
| print struct.unpack('@Q', '1c00000000000000') | |
| # 6a04b45400000000 | |
| # 1c00000000000000 | |
| # Response | |
| # 011101010101020101 - #signiture | |
| # 08 - # don't know? | |
| # 096f5f696e646578657385 - 9 char string (o_inputs) | |
| # 1c00000000000000005200000000000000540000000000000055000000000000006900000000000000d9000000000000004d03000000000000 - 7 inputs, no idea what those are | |
| # struct.unpack('@Q', binascii.unhexlify('1c00000000000000')) ? | |
| # 067374617475730a - 6 chars status | |
| # 084f4b - why use string for 2 chars? make it int | |
| # don't know what this does | |
| # print response_tx.text | |
| if __name__ == "__main__": | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment