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
Bugs in documentation & how to use the client with the rust server #59
Comments
Hi @et4te. As for your question about signature. If you declare and sign transaction there is no need to declare var keyA = Exonum.keyPair();
var CreateWalletTransaction = Exonum.newMessage({
network_id: 0,
protocol_version: 0,
service_id: 1,
message_id: 1,
size: 40,
fields: {
pub_key: {type: Exonum.PublicKey, size: 32, from: 0, to: 32},
name: {type: Exonum.String, size: 8, from: 32, to: 40}
}
});
var walletData = {
pub_key: keyA.publicKey,
name: "Someone"
};
var transactionSignature = Exonum.sign(keyA.secretKey, walletData, CreateWalletTransaction);
var walletJson = {
network_id: 0,
protocol_version: 0,
service_id: 1,
message_id: 1,
body: walletData,
signature: transactionSignature
};
fetch('http://127.0.0.1:8000/api/services/some_chain/v1/wallets/transaction', {method: 'POST', body: JSON.stringify(walletJson)})
.then(result => {
console.log(result);
})
.catch(error => {
console.log(error);
}); Let us know whether this helped you. |
Thanks for the quick reply. This solves all the problems and the code works when changed to use newMessage instead of newType. |
fixed in #60 |
Hey peeps,
Thanks for providing such great open source libraries. Found some issues.
Documentation has bugs e.g:
Where Exonum.Hash seems to actually be 32-bytes rather than 8 and thus the actual size is wrong and causes a runtime error.
There is no mention of where the above signature actually comes from nor any mention of the primitives required to form a keyPair (even though it is mandatory to know that tweetnacl is the underlying cryptographic library being used). If you use Exonums default way of signing the body and follow the docs the result doesn't work:
Which begs the question how do you form the signature as per the curl requests in the documentation in order to match what is expected?
The text was updated successfully, but these errors were encountered: