Skip to content

Instantly share code, notes, and snippets.

@pmitchev
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save pmitchev/fcee1345e20d70108e37 to your computer and use it in GitHub Desktop.

Select an option

Save pmitchev/fcee1345e20d70108e37 to your computer and use it in GitHub Desktop.

Revisions

  1. pmitchev revised this gist Jan 26, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.py
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ def main():
    packed_data_tx += bytearray.fromhex("f579ff2174f828b6619a70d791db5297c9769c3e3cf06afb99e364f2bfa94c9f")

    print 'Packed Value :', binascii.hexlify(packed_data_tx)
    response_tx = requests.post('http://localhost:29081/o_indexes.bin', data=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))
  2. pmitchev created this gist Jan 20, 2015.
    32 changes: 32 additions & 0 deletions gistfile1.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    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/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()