Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it necessary to add a new method to generate digest in transaction information? as follows #102

Open
wdd906 opened this issue Apr 19, 2023 · 2 comments

Comments

@wdd906
Copy link

wdd906 commented Apr 19, 2023

    String digest = Base58.encode(hashTypedData("TransactionData", txBytes));

public byte[] hashTypedData(String typeTag, byte[] data) {
byte[] typeTagBytes = String.format("%s::", typeTag).getBytes();
byte[] dataWithTag = new byte[typeTagBytes.length + data.length];
System.arraycopy(typeTagBytes, 0, dataWithTag, 0, typeTagBytes.length);
System.arraycopy(data, 0, dataWithTag, typeTagBytes.length, data.length);
Blake2b.Blake2b256 blake2b256 = new Blake2b.Blake2b256();
return blake2b256.digest(dataWithTag);
}

@wdd906 wdd906 changed the title Is there a new way to generate digest in transaction information? Is it necessary to add a new method to generate digest in transaction information? Apr 19, 2023
@wdd906 wdd906 changed the title Is it necessary to add a new method to generate digest in transaction information? Is it necessary to add a new method to generate digest in transaction information? as follows Apr 19, 2023
@GrapeBaBa
Copy link
Owner

@wdd906 Sorry for late, it can be added. Can you describe what is your use case here?

@wdd906
Copy link
Author

wdd906 commented May 6, 2023

@GrapeBaBa To get the transaction hash for offline sign.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants