Solidity code to change value of name

0 votes

I am following tutorial and I have two tasks to do.

  1. setName function should allow setting value of name
  2. increaseCounter should increase the counter by 10 whenever it is called

I have completed writing the other methods and it works fine but I’m stuck with this. Can someone tell how can I implement this?

Jul 30, 2018 in Blockchain by digger
• 26,740 points
1,216 views

1 answer to this question.

0 votes

Try this for setName:

function setName(string _name) public {

    name = _name;

  }

And this for increaseCounter:

function increaseCounter() public {

    counter += 10;

  }

This should work.

answered Jul 30, 2018 by slayer
• 29,370 points

Related Questions In Blockchain

+1 vote
1 answer

I am unable to change port of composer-rest-server. Please help!

Use full format for running a business ...READ MORE

answered Mar 27, 2018 in Blockchain by Christine
• 15,790 points
1,128 views
+1 vote
1 answer

what is use of msg.sender in solidity code?

msg.sender(address) function indicated the sender of the ...READ MORE

answered Apr 25, 2018 in Blockchain by Shashank
• 10,400 points
9,142 views
0 votes
1 answer

How to set web3 solidity variable value?

The setLog transaction has not yet been mined by ...READ MORE

answered Jul 6, 2018 in Blockchain by Christine
• 15,790 points
2,126 views
0 votes
1 answer

How to get return value of external function?

You can do this. I have shared ...READ MORE

answered Aug 13, 2018 in Blockchain by digger
• 26,740 points
1,931 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,927 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,455 views
0 votes
1 answer
0 votes
1 answer

How to get return value from solidity contract?

Once you call a constant function, you ...READ MORE

answered Aug 16, 2018 in Blockchain by slayer
• 29,370 points
5,044 views
0 votes
1 answer

How to get value from solidity contract using java?

web3j caters for this very use case. It ...READ MORE

answered Sep 28, 2018 in Blockchain by slayer
• 29,370 points
2,027 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP