I am receiving following error while cardano integration on sandtest mode…
Shelley command failed: query utxo Error: A query from a certain era was applied to a ledger from a different era: EraMismatch {ledgerEraName = “Byron”, otherEraName = “Shelley”}
I am running this code…
CARDANO_CLI_PATH,
“query”, “utxo”,
“–testnet-magic”, CARDANO_NETWORK_MAGIC,
“–address”, walletAddress
].join(" "));
console.log(rawUtxoTable);
// Calculate total lovelace of the UTXO(s) inside the wallet address
const utxoTableRows = rawUtxoTable.data.trim().split(’\n’);
let totalLovelaceRecv = 0;
let isPaymentComplete = false;
for(let x = 2; x < utxoTableRows.length; x++) {
const cells = utxoTableRows.split(" ").filter(i => i);
total
LovelaceRecv += parseInt(cells[2]);
}
Also i set DB Socket variable “export CARDANO_NODE_SOCKET_PATH=”/home/neerajlinux/relay/db/node.socket"
When the node is started, it has to download the blockchain from other nodes and update its own view of what the current status is. For mainnet, this takes something in the range of 24 hourse, for testnet, it might be less, but I don’t know.
If you, in the future, had the node offline for some time, it will also need to synchronise quite a lot of data. It will not take that much, but can be several minutes, depending on how long it was offline.
Yes, you have to start the node and let it run. Either in a separate terminal or as a service.
You can query if it is ready as, for example, described here:
(Although you don’t have to compare the slot number with the latest slot manually, anymore. Newer versions of cardano-cli will give you a percentage directly.)
That version is very old. Current version is 1.34.1. You should really start with a newer version.
thank you sir for your kind reply, it was all very helpful…
We are currently running this on our local windows machine ( server ), if we need to run this code on live server, how should we run it? I mean we just put this JS file thats generated on LIVE server and it works automatically and gets connected to some CARDANO server?
CARDANO_CLI_PATH,
“query”, “utxo”,
“–testnet-magic”, CARDANO_NETWORK_MAGIC,
“–address”, walletAddress
].join(" "));
console.log(rawUtxoTable);
// Calculate total lovelace of the UTXO(s) inside the wallet address
const utxoTableRows = rawUtxoTable.data.trim().split(’\n’);
let totalLovelaceRecv = 0;
let isPaymentComplete = false;
for(let x = 2; x < utxoTableRows.length; x++) {
const cells = utxoTableRows.split(" ").filter(i => i);
totalLovelaceRecv += parseInt(cells[2]);
}
// Determine if the total lovelace received is more than or equal to
// the total expected lovelace and displaying the results.
isPaymentComplete = totalLovelaceRecv >= TOTAL_EXPECTED_LOVELACE;
And is there way for us to know that node has been synced successfully?
You can run a node on a local machine or on a server.
Depends on what you want to do.
I cannot see, what your Javascript code is supposed to do. The beginning is missing. But it looks like it just checks if a certain amount of ADA is available on an address.
This snippet can only run on a machine, where cardano-node and cardano-cli are installed and cardano-node is running.
As described in the article I linked.
cardano-cli query tip --testnet-magic 1097911063 (for testnet) or cardano-cli query tip --mainnet will show you, how far the node is synced.
Hello Sir, thank you so much, it worked after upgrading cardano to 1.34.1, we are finally able to install cardano on our local server and also did it on LIVE server…
sir, should i close this topic as my issue has been resolved?
But i have another question, we have a website, we want to integrate this cardano with our cart of our website, how should we do that? Because when we look at the documentation, all instructions are in CMD format but how should we bring it on our website cart system?
Should i open a new topic for it, please guide sir…
Personally, I don’t care much. The “solution” function is used very infrequently and inconsistently in this forum. Traffic is low enough that it does not really matter.
Probably better in a new topic with a more specific title.
And it’s also a very broad question.
We would have to know more. What technology stack do your developers use? What experience do they have?
A forum cannot sketch the whole application for you.
You could put a node on your web server and do cardano-cli and other invocations from the server-side part of your application. But that’s not really what I would do.
You can use blockfrost.io or similar APIs to query the blockchain from your application. They have language bindings for a lot of languages that you maybe use in your project.