Somehow i cannot get any result from my backend solidity. i have asimple dapp that takes firstName from input field save in blockchain and then fetch it back and display it on the screen.




handleSubmit = async (event)=>{
    await this.simpleStorageInstance.set(this.state.fName, { from: this.state.account });
    //let name = this.simpleStorageInstance.get.call(this.state.account);

    this.simpleStorageInstance.get({ from: this.state.account }, function (error, result) {
        var name = result;
        this.setState({ firstName: name });


doChange = (e)=>{


render(<div> <form onSubmit={this.handleSubmit}>

<input type="text" name="firsName" onChange={this.doChange}/>
<input type="submit"/></form>


pragma solidity 0.4.24;

contract SimpleStorage {
    string firstName;

    function set(string x) public {
        firstName = x;

    function get() public view returns (string) {
        return firstName;

I get also this error:

Uncaught (in promise) Error: Invalid number of arguments to Solidity function at Object.InvalidNumberOfSolidityArgs (errors.js:25) at SolidityFunction../node_modules/web3/lib/web3/function.js.SolidityFunction.validateArgs (function.js:74) at SolidityFunction../node_modules/web3/lib/web3/function.js.SolidityFunction.toPayload (function.js:90) at SolidityFunction../node_modules/web3/lib/web3/function.js.SolidityFunction.call (function.js:131) at contract.js:135 at new Promise () at contract.js:126

this.simpleStorageInstance.get({ from: this.state.account }

There is no need to pass { from: this.state.account } this while calling a get function.

Refer to this tutorial to understand the difference between read-only calls and potentially state-changing transactions.

Refer to this tutorial in which similar example as you are trying to develop is explained.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.