I am creating transactions using /transaction/prepare-announce
on NIS 0.6.95 on testnet.
I have noticed on certain transactions there is a leading 0 added to my message.
For eg: If I send “111” as the message when I use /transaction/get?hash=
, the message is now “0111”.
If I send 31 1s instead, (“1111111111111111111111111111111”), there is a leading zero again.
But the same doesn’t happen if I send 32 1s.
I have noticed leading zeroes on more complex messages as well.
What is causing this and what steps can I take to prevent this?
Could you show code used to sent transaction?
I am using curl requests crafted by Postman. Here is an example.
curl --request POST \
--url http://localhost:7890/transaction/prepare-announce \
--header 'content-type: application/json' \
--data '{
"transaction":
{
"timeStamp": 99203203,
"amount": 1000000,
"fee": 100000,
"recipient": "TBUSDIZIACGEVMCLCWIDABBHOF6XUDNIF6A6SR6Q",
"type": 257,
"deadline": 99203916,
"message":
{
"payload": "1111111111111111111111111111111111111111111111111",
"type": 1
},
"version": -1744830463,
"signer": "afe89141fbdd20c0ca1735546545a85ca1ecb7916e00038098263ba449d29a87"
},
"privateKey": ""
}'
The only change between requests is the length of the messages. I’ve tried “111”, “1” * 31, and “1” * 32 ( and timestamps of course). And in all but the last request there seems to be a leading zero.
I think I figured it out. NIS seems to expect a hexadecimal string and not plain text. Thanks for your help.
Sorry for late answer. Great you figured this out yourself.