BitShares Forum
Main => Technical Support => Topic started by: TechnoL0g on June 04, 2018, 02:05:12 pm
-
Need help with working examples of decode memo on bitsharesjs.
node -v 8.11.1
I get the transaction history:
{
from: '<BTS Address>',
to: '<BTS Address>',
nonce: '<random>',
message: '<encrypted message>'
}
What sequence of steps is needed to perform the decryption?
by doing:
Aes.decrypt_with_checksum(
private_key,
public_key,
memo.nonce,
memo.message
).toString("utf-8");
getting an error: transfer memo exception ...
~TypeError: private_key.get_shared_secret is not a function.
~node_modules\bitsharesjs\dist\ecc\src\aes.js:97
Has anyone encountered a similar problem?
-
Something like this.
If you have private key of `memo.to`:
Aes.decrypt_with_checksum(
PublicKey.fromPublicKeyString(memo.from),
PrivateKey.fromWif(private_key),
memo.nonce,
memo.message
).toString("utf-8");
-
Something like this.
If you have private key of `memo.to`:
Aes.decrypt_with_checksum(
PublicKey.fromPublicKeyString(memo.from),
PrivateKey.fromWif(private_key),
memo.nonce,
memo.message
).toString("utf-8");
Thanks a friend, it helped me with the above problem!
But now a new one has appeared: AssertionError [ERR_ASSERTION]: Expecting key to begin with GPH, instead got BTS
I need to specify the main blockchain type? but where, heh ..
I found the config in bitsharesjs-ws, probably do not look in the right direction.
It is only necessary to decrypt memo, this should not be a big problem.
Unfortunately in the documentation, I could not find any specifications for this particular issue, only python lib.
-
Problem Solved.
First it was necessary to connect to the Bitshares network and initialize:
import {Apis} from "bitsharesjs-ws";
import {PrivateKey, key, PublicKey, Aes} from "../lib";
Apis.instance("wss://bitshares.openledger.info/ws", true).init_promise.then((res) => {
console.log("connected to:", res[0].network);
code..
}
Thx you for helping the newcomer!