You will need the ABI. The .methods is an attribute of the contract instance, which you get by using the ABI.
If you are using ethers.js, you can use a shorthand ABI to achieve the same goal:
let abi = ["function approve(address _spender, uint256 _value) public returns (bool success)"]
let provider = ethers.getDefaultProvider('ropsten')
let contract = new ...
For the caller to be able to retrieve the desired information (the stock price), the function would have to emit an event.
That's true for an off-chain caller, for example:
Or is there a situation where the code above is actually practical?
Yes, it (the returned value) is practical for an on-chain ...
A web3 call means you're just reading from a local node, not mutating the state of the blockchain, see What is the difference between a transaction and a call?
As you noticed, avoiding call and just calling the method on the web3 contract instance will mutate the contract state. This is because you are sending a transaction. In web3, sending a transaction ...
I see you modified the question after several valid/correct answers:
Question is: how to invoke GenNextID like a regular function, that is:
call to this function mutates internal state
it returns result returned from the contract's code
You either mutate the state and get a receipt, or you get a response but you don't mutate the ...
You are trying to update the state of your contract and for this you have to execute blockchain transaction, but eth_call is not for firing transactions read more here. What can work for your case is using eth_sendRawTransaction read more here. In params you have to place the transaction data which have to be signed by the private key of the transaction ...
web3.js can be also used in a server side environment, depending of your language implementation, and it is the best way to do it.
Doing it manually is possible, but you will need to encode all the parameters and the signature, and sign the transaction to.
Here is an article with some detail on ethereum transaction format: Inside an Ethereum transaction
I think you are confusing different things:
The string you have pasted 000000000000000000000000000000000000000000000000000000174876e80000... are the parameters that were used to invoke the constructor of the contract.
The data parameter is passed to the contract. The contract can interpret it in any way he wants. But usually solidity contracts follow the ...