HELP - SPONSORED TX on Mainnet Node

Hi Alexey,

spacibo - it looks like we are nearly through. I do not get any error messages, but the transaction is not added to the blockchain. I am doing the following

  1. initiate a sponsored transaction via POST /assets/transfer with 10zebcoin wavelets
  2. Take the Response Body and copy & paste it to POST /transactions/sign
  3. Take the Response Body from 2) and copy & paste it to /transactions/broadcast

The Response Body of 3) looks okay:

{
“type”: 4,
“id”: “DHCU6F6LMT4yHaKXi3UXZovgUUZKn48ex9L7p4cmptzN”,
“sender”: “3PHrS6VNPRtUD8MHkfkmELavL8JnGtSq5sx”,
“senderPublicKey”: “5v5D5pqzKGBejtvtEeyDJXG28iQwMViu1uuetEcyQp9v”,
“fee”: 10,
“timestamp”: 1534702323889,
“signature”: “4bZ6h9g2M5DNesvc46qqQRjmwL5zbnsy2EDk5dT9LgXPr4k7RY3zVTCyzvjzUE4H3g81Ts62ZvYswU47SNM5X9Q6”,
“version”: 1,
“recipient”: “3PJ3YiQjnHrQt9weTndPf81eY9vKz5yYjut”,
“assetId”: “FN76goSi7hQn6gQ8aezKVwyDvhkWx5ekXbP3sNLWqavN”,
“feeAssetId”: “FN76goSi7hQn6gQ8aezKVwyDvhkWx5ekXbP3sNLWqavN”,
“feeAsset”: “FN76goSi7hQn6gQ8aezKVwyDvhkWx5ekXbP3sNLWqavN”,
“amount”: 1,
“attachment”: “test”
}

Looking up the ID https://nodes.wavesnodes.com/transactions/info/DHCU6F6LMT4yHaKXi3UXZovgUUZKn48ex9L7p4cmptzN says it is not added to the blockchain. Where is the last problem?

Thank you very much !

Hello,

You have to use either 1) or 2) and 3). The assets/transfer do both signing and broadcasting inside.
But in your case it’s not the problem. It’s ok to send the transaction to the blockchain multiple times.
Please, try to do assets/transfer again and post the reply here.

Hi, sure.
I did 1) POST /assets/transfer and receive following Response Body:

{
“type”: 4,
“id”: “DHCU6F6LMT4yHaKXi3UXZovgUUZKn48ex9L7p4cmptzN”,
“sender”: “3PHrS6VNPRtUD8MHkfkmELavL8JnGtSq5sx”,
“senderPublicKey”: “5v5D5pqzKGBejtvtEeyDJXG28iQwMViu1uuetEcyQp9v”,
“fee”: 10,
“timestamp”: 1534702323889,
“signature”: “SJizitHShnKC3m2rkP43c7xksFHCKEug3pZMBCGhfjC2VbRZWxCB4oL2AusvXgLpmdqBmZv4Fno4quq97HPDJnr”,
“version”: 1,
“recipient”: “3PJ3YiQjnHrQt9weTndPf81eY9vKz5yYjut”,
“assetId”: “FN76goSi7hQn6gQ8aezKVwyDvhkWx5ekXbP3sNLWqavN”,
“feeAssetId”: “FN76goSi7hQn6gQ8aezKVwyDvhkWx5ekXbP3sNLWqavN”,
“feeAsset”: “FN76goSi7hQn6gQ8aezKVwyDvhkWx5ekXbP3sNLWqavN”,
“amount”: 1,
“attachment”: “test”
}

Strangely enough this ID is identical to all other attempts to create this transcations. But still it is not in the blockchain: https://nodes.wavesnodes.com/transactions/info/DHCU6F6LMT4yHaKXi3UXZovgUUZKn48ex9L7p4cmptzN

Thanks for a hint.

Yes, if you don’t change the transaction data ID will be the same. But in your case it means that you don’t change transaction timestamp. And this explains everything! Your transaction is just too old. Update the timestamp to the current time and post transaction again. It should work.

Hi Alexey,

I exactly changed it as proposed by the debug-message from swagger. In example I entered an old timestamp and the debug-message proposes:

“Transaction ts 153470323889 is too old. Previous block time: Some(1534702323889)”

changing it to the proposed timestamp 1534702323889, the command gets through and produces the Response Body from above.

I am still wondering what timestamp this is. As my unix UTC machine gives me node:~$ date +%s > 1534941907 - while the node proposes a longer/different timestamp.

Swagger gives you a static example. It’s never changed. Use this clock https://www.epochconverter.com/clock, take timestamp in milliseconds (small one).

Okay, that is the problem - using the epoch timestamp I still get the “too old” error:

{
“error”: 303,
“message”: “Transaction ts 1534943579 is too old. Previous block time: Some(1534702323889)”
}

Should I change the tzdate on my system or use epochdate for CEST (Europe/Berlin)?

Your timestamp is in seconds you can simply add 000 to the end. Where is no need to add a time zone.

Yes !!! This worked ! Thank you so much. I hope that others are now able to reproduce the same steps. I will now together with a developer try to implement the curl json to a fork of the waves ios application. that we want to use as a protoype using “fee-less” transactions.

thank you alexey - that was really helpful.

Maybe write a detailed step by step guide and put it in a blog post or post here for future reference? :slight_smile:

1 Like

I’ve just realised that it is possible simply omit the timestamp field in the request. In this case the node will use current time as timestamp.