How to generate the signature using Public Key & Timestamp?

Hi team ,

How to generate signature using Signature of [Public Key ++ Timestamp] bytes ?

Because i need to get the order book using matcher ( https://matcher.testnet.wavesnodes.com/matcher/orderbook/3sAZVZZwhP9sGG6xUA3snihb1T9HmvsyfrW5GbvRNiD2?activeOnly=false ) .

In this request we need to send signature.

Signature of [Public Key ++ Timestamp] bytes ===>> The public key user key or matcher key ?

So kindly provide the solution ASAP.

You provide your public key, timestamp and signature of them both, the signature on 32 bytes of your public key + 8 bytes of the timestamp provided.

@deemru Okay fine.

I got public key bytes on using this process ==>

base58Decode(‘3sAZVZZwhP9sGG6xUA3snihb1T9HmvsyfrW5GbvRNiD2’).

I am using ts-lib-crypto functions ( https://github.com/wavesplatform/ts-lib-crypto )

But how to get timestamp value to 8 bytes ?

Can you please provide any example ASAP. Please.

I am working on node js.

Please provide the solution.

Unix epoch timestamp is long value (8 bytes integer)
See https://www.epochconverter.com/

@brox

I have use this format ( Math.floor(new Date().getTime()) ) .

Its correct ?

Unfortunately, javascript is alien language to me. I don’t know how to convert number to array of 8 bytes in js

@brox Okay Fine.

If possible to cancel the order using order id ?

Then the cancel order not working when i am using waves-api …

Sample Function

Waves.API.matcher.cancelOrder(‘amountAsset’,‘priceAssetgwkqdn’,‘orderID’,seed.keyPair).then((responseData) => {
console.log(‘responseData’,responseData);
});

Yes, this api call works for me (I use modified Java library WavesJ)
https://matcher.wavesplatform.com/api-docs/index.html#!/matcher/cancel_1