elective-stereophonic
elective-stereophonic
Transaction Byte Order Reference
Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest Stable Nxt Client: Nxt 1.11.15 | Latest Experimental Nxt Client: Nxt 1.12.0e

Author Topic: Transaction Byte Order Reference  (Read 2266 times)

jones

  • Hero Member
  • *****
  • Karma: +310/-8
  • Offline Offline
  • Posts: 1043
  • write code not war
    • View Profile
    • jNxt
Transaction Byte Order Reference
« on: November 05, 2014, 05:19:55 am »

I made a quick cheat sheet of what order the bytes are arranged to make a transaction in nxt. It's available for anyone who needs it if you have a project or implementation requiring building of transaction by bytes or just to study the workings of nxt. Attachments and appendages are added to the end, but there are quite a few types of these, so I left them out for now.

http://jnxt.org/tx

I couldn't find a good reference for this, so I made my own (:
Logged
-- Jones NXT-RJU8-JSNR-H9J4-2KWKY

jl777

  • Hero Member
  • *****
  • Karma: +718/-123
  • Offline Offline
  • Posts: 6170
    • View Profile
Re: Transaction Byte Order Reference
« Reply #1 on: November 05, 2014, 05:22:41 am »

I made a quick cheat sheet of what order the bytes are arranged to make a transaction in nxt. It's available for anyone who needs it if you have a project or implementation requiring building of transaction by bytes or just to study the workings of nxt. Attachments and appendages are added to the end, but there are quite a few types of these, so I left them out for now.

http://jnxt.org/tx

I couldn't find a good reference for this, so I made my own (:
very nice!

Do you know the exact format of a generateToken output?

James
Logged
There are over 1000 people in SuperNET slack! http://slackinvite.supernet.org/ automatically sends you an invite

I am just a simple C programmer

jones

  • Hero Member
  • *****
  • Karma: +310/-8
  • Offline Offline
  • Posts: 1043
  • write code not war
    • View Profile
    • jNxt
Re: Transaction Byte Order Reference
« Reply #2 on: November 05, 2014, 05:57:43 am »

I made a quick cheat sheet of what order the bytes are arranged to make a transaction in nxt. It's available for anyone who needs it if you have a project or implementation requiring building of transaction by bytes or just to study the workings of nxt. Attachments and appendages are added to the end, but there are quite a few types of these, so I left them out for now.

http://jnxt.org/tx

I couldn't find a good reference for this, so I made my own (:
very nice!

Do you know the exact format of a generateToken output?

James

from this page of source https://bitbucket.org/JeanLucPicard/nxt/src/656228e5d54c070a85ea918cb1b42eeca707297f/src/java/nxt/Token.java?at=master

this is a tough one..

32 byte public key,
4 byte timestamp (int),
64 byte signature,
some kind of data structure, I'm still looking into it
Logged
-- Jones NXT-RJU8-JSNR-H9J4-2KWKY

jl777

  • Hero Member
  • *****
  • Karma: +718/-123
  • Offline Offline
  • Posts: 6170
    • View Profile
Re: Transaction Byte Order Reference
« Reply #3 on: November 05, 2014, 02:24:13 pm »

I made a quick cheat sheet of what order the bytes are arranged to make a transaction in nxt. It's available for anyone who needs it if you have a project or implementation requiring building of transaction by bytes or just to study the workings of nxt. Attachments and appendages are added to the end, but there are quite a few types of these, so I left them out for now.

http://jnxt.org/tx

I couldn't find a good reference for this, so I made my own (:
very nice!

Do you know the exact format of a generateToken output?

James

from this page of source https://bitbucket.org/JeanLucPicard/nxt/src/656228e5d54c070a85ea918cb1b42eeca707297f/src/java/nxt/Token.java?at=master

this is a tough one..

32 byte public key,
4 byte timestamp (int),
64 byte signature,
some kind of data structure, I'm still looking into it
if you also see how to generate an encrypted message, that would be nice to know
I want to make C versions that can generate/verify tokens and also send/receive encrypted NXT messages
Logged
There are over 1000 people in SuperNET slack! http://slackinvite.supernet.org/ automatically sends you an invite

I am just a simple C programmer

jones

  • Hero Member
  • *****
  • Karma: +310/-8
  • Offline Offline
  • Posts: 1043
  • write code not war
    • View Profile
    • jNxt
Re: Transaction Byte Order Reference
« Reply #4 on: November 05, 2014, 04:28:27 pm »

Figured out token, 160 chars in base 32. As log base 2 of 32 is 5, there are 5 bit to each character. Totaling 160 *5 = 800 bits total, or 100 bytes.

so the token is 32 bytes of public key
4 byte timestamp from nxt epoch
64 byte signature of the first two with the text of the token appended to it in byte format.
« Last Edit: November 05, 2014, 04:30:57 pm by jones »
Logged
-- Jones NXT-RJU8-JSNR-H9J4-2KWKY

jl777

  • Hero Member
  • *****
  • Karma: +718/-123
  • Offline Offline
  • Posts: 6170
    • View Profile
Re: Transaction Byte Order Reference
« Reply #5 on: November 05, 2014, 05:38:47 pm »

Figured out token, 160 chars in base 32. As log base 2 of 32 is 5, there are 5 bit to each character. Totaling 160 *5 = 800 bits total, or 100 bytes.

so the token is 32 bytes of public key
4 byte timestamp from nxt epoch
64 byte signature of the first two with the text of the token appended to it in byte format.
how is the signature calculated?
Logged
There are over 1000 people in SuperNET slack! http://slackinvite.supernet.org/ automatically sends you an invite

I am just a simple C programmer

jones

  • Hero Member
  • *****
  • Karma: +310/-8
  • Offline Offline
  • Posts: 1043
  • write code not war
    • View Profile
    • jNxt
Re: Transaction Byte Order Reference
« Reply #6 on: November 05, 2014, 06:20:03 pm »

Figured out token, 160 chars in base 32. As log base 2 of 32 is 5, there are 5 bit to each character. Totaling 160 *5 = 800 bits total, or 100 bytes.

so the token is 32 bytes of public key
4 byte timestamp from nxt epoch
64 byte signature of the first two with the text of the token appended to it in byte format.
how is the signature calculated?

its a curve25519 signature of the public key + timestamp + text input to the token
Logged
-- Jones NXT-RJU8-JSNR-H9J4-2KWKY

jl777

  • Hero Member
  • *****
  • Karma: +718/-123
  • Offline Offline
  • Posts: 6170
    • View Profile
Re: Transaction Byte Order Reference
« Reply #7 on: November 05, 2014, 06:47:33 pm »

Figured out token, 160 chars in base 32. As log base 2 of 32 is 5, there are 5 bit to each character. Totaling 160 *5 = 800 bits total, or 100 bytes.

so the token is 32 bytes of public key
4 byte timestamp from nxt epoch
64 byte signature of the first two with the text of the token appended to it in byte format.
how is the signature calculated?

its a curve25519 signature of the public key + timestamp + text input to the token
isnt there SHA256 in there somewhere?
I am looking for exact function calls needed to duplicate/verify token

I have a curve25519 function that takes two 256 bit inputs, one of them constrained by flipping some bits, the other can be any 256 bits.

I assume the privkey is one of the parameters and (public key + timestamp + text input) is the other, but the latter needs to map to 256 bits
Logged
There are over 1000 people in SuperNET slack! http://slackinvite.supernet.org/ automatically sends you an invite

I am just a simple C programmer

Zahlen

  • Full Member
  • ***
  • Karma: +26/-4
  • Offline Offline
  • Posts: 228
    • View Profile
Re: Transaction Byte Order Reference
« Reply #8 on: November 05, 2014, 07:11:40 pm »

I made a quick cheat sheet of what order the bytes are arranged to make a transaction in nxt.

Thanks! I'll add this to the wiki.


Edit: This is for just a 'Send NXT' tx right?

32 bytes for Referenced Transaction Full Hash... I hope the DB is compressing all this down.

Any idea about the byte order of a block?
« Last Edit: November 05, 2014, 08:03:07 pm by Zahlen »
Logged

jones

  • Hero Member
  • *****
  • Karma: +310/-8
  • Offline Offline
  • Posts: 1043
  • write code not war
    • View Profile
    • jNxt
Re: Transaction Byte Order Reference
« Reply #9 on: November 05, 2014, 08:11:26 pm »

Figured out token, 160 chars in base 32. As log base 2 of 32 is 5, there are 5 bit to each character. Totaling 160 *5 = 800 bits total, or 100 bytes.

so the token is 32 bytes of public key
4 byte timestamp from nxt epoch
64 byte signature of the first two with the text of the token appended to it in byte format.
how is the signature calculated?

its a curve25519 signature of the public key + timestamp + text input to the token
isnt there SHA256 in there somewhere?
I am looking for exact function calls needed to duplicate/verify token

I have a curve25519 function that takes two 256 bit inputs, one of them constrained by flipping some bits, the other can be any 256 bits.

I assume the privkey is one of the parameters and (public key + timestamp + text input) is the other, but the latter needs to map to 256 bits

ill have to look into it some more.

I made a quick cheat sheet of what order the bytes are arranged to make a transaction in nxt.

Thanks! I'll add this to the wiki.


Edit: This is for just a 'Send NXT' tx right?

32 bytes for Referenced Transaction Full Hash... I hope the DB is compressing all this down.

Any idea about the byte order of a block?

yes, just send nxt, the other types have attachments appended to them.

as for block structure I guess I'll need more charts
Logged
-- Jones NXT-RJU8-JSNR-H9J4-2KWKY

Zahlen

  • Full Member
  • ***
  • Karma: +26/-4
  • Offline Offline
  • Posts: 228
    • View Profile
Re: Transaction Byte Order Reference
« Reply #10 on: November 05, 2014, 08:16:52 pm »

I have a curve25519 function that takes two 256 bit inputs, one of them constrained by flipping some bits, the other can be any 256 bits.

I assume the privkey is one of the parameters and (public key + timestamp + text input) is the other, but the latter needs to map to 256 bits

privkey should be the one constrained by flipping some bits. public key is the one that can be anything. I'm going by the ranges defined in Bernstein's Curve25519 paper (see http://cr.yp.to/ecdh/curve25519-20060209.pdf, last paragraph of section 2)
Logged
 

elective-stereophonic
elective-stereophonic
assembly
assembly