Open michael-holzheu opened 2 years ago
i suppose you can run the code on https://github.com/peercoin/perpera-web on localhost?
Ok, I now got it running in a Docker container with an Ubuntu image and "npm install/start" as described in the README, thanks :+1:!
I assume the private key is not sent to the outside by the script, right?
When I enter the private key, which I got by "dumpprivkey ..." from the peercoin-qt console, "perpera-web" shows me "Your wallet has no funds", which is not true.
In the PeerCoin Explorer I see enough coins on the corresponding public key: https://chainz.cryptoid.info/ppc/address.dws?PRoiyRWKx1HtKQsV2CibjcyHA2B8Fo9B91.htm
Any idea?
The error seems to occur in src/services/Perpera.ts#getFee.
I assume the private key is not sent to the outside by the script, right?
It's only used by the spender to sign the transaction.
The failing function is public/perpera.js:update.add():
const utxos = this.spender.allocate(fee - balance);
if (utxos === null)
throw new Error('Insufficient funds.');
For my sample document and private key the values of "fee" and "balance" are:
The callstack up to this point is as follows:
I now tried to switch to the Peercoin "testnet" by the following change:
git diff src/services/Perpera.ts
diff --git a/src/services/Perpera.ts b/src/services/Perpera.ts
index 91d2f61..f78028e 100644
--- a/src/services/Perpera.ts
+++ b/src/services/Perpera.ts
@@ -4,7 +4,7 @@ export default class PerperaService {
constructor(network?: string) {
this.perpera = window['perpera'];
- this.network = network || window['perpera'].networks['peercoin'];
+ this.network = network || window['perpera'].networks['peercoin-testnet'];
}
public getDocument(hash: string) {
With the corresponding private key for my new peercoins, I now get "WIF invalid" respectively "TypeError: Private key network mismatch".
It seems you are trying to use it on mainnet, so just leave it on mainnet.
I believe that fee calculation logic was extremely out of date. This bit of software is unmaintained for about 4 years.
https://github.com/peercoin/perpera/pull/21
I think this will resolve it.
I believe that fee calculation logic was extremely out of date. This bit of software is unmaintained for about 4 years.
21
I think this will resolve it.
I changed the file public/perpera.js accordingly, but unfortunately it did not fix the problem. The fee is still "1000". I assume that the "balance" is the problem here?
It seems you are trying to use it on mainnet, so just leave it on mainnet.
Nevertheless for development it would be nice to be able to switch to "testnet". Could you tell me what is necessary to do that?
Well, sorry I can't do much to help you out. I'm totally not into frontends or JS ecosystem in general. Unfortunately, the person who wrote this frontend is absent for a while.
But really this should not be so difficult to update, patch and deploy fixed version,
Is your public Web-Frontend (https://perpera.peercoin.net) working for you, or does it show the same problem?
Yes, same problem.
I've figured out it calls now defunct explorer API. I've removed the support for that API from the source. Could you build and try again?
I've figured out it calls now defunct explorer API. I've removed the support for that API from the source. Could you build and try again?
What do I have to do here exactly? You removed the file "explorer.ts" in the "perpera" git repository. I don't find this file in the "perpera-web" git repository.
Now, this lib must be built and included into the perpera-web.
I would like to use "Perpera" to save hashes of documents on the peercoin blockchain.
Up to now I only found your Web-Frontend: https://perpera.peercoin.net
This is almost what I was looking for, but I don't want to paste my private key into an unknown browser window.
Is there any other easy way (e.g. a command line interface) to use "Perpera" without having to transfer the private key via an unsecured connection?