Is from thesponsor value 10000000 gas 3000000 considered as a transaction object

0 votes

I was going through the IDM Example for Ethereum smart contract and i came across the following code:


ss.pledge("Good luck with the run!", {from: thesponsor, value: 10000000, gas: 3000000});

and the pledge function is as follows:

function pledge(bytes32 _message) {

  if (msg.value == 0 || complete || refunded) throw;

  pledges[numPledges] = Pledge(msg.value, msg.sender, _message);



I am getting a little confused here. Is the solidity seeing {from: thesponsor, value: 10000000, gas: 3000000} as a

msg object that is used to transfer ethers? If yes, then if i write a json object with the keywords "from"and "value",

would it make a fund transaction accidentally?

Jul 25, 2018 in Blockchain by slayer
• 29,350 points

1 answer to this question.

0 votes

Yes, {from: thesponsor, value: 10000000, gas: 3000000} is considered and interpreted as a transactionObject. Let me

explain why it is so. Any transaction on Ethereum that causes a state change(create, update or delete) requires a

transactionObject. So in the above code mentioned in your question, it is interpreted as a transactionObject.

Look at the example of the pledge function mentioned below:

1   // add a new pledge

2   function pledge(bytes32 _message) {

3    if (msg.value == 0 || complete || refunded) throw;

4    pledges[numPledges] = Pledge(msg.value, msg.sender, _message);

5    numPledges++;


In this code snippet, you can see that lines 4 and 5 cause state change. To cause these state changes, it is required that you provide gas. The pledge function also has a msg.value which is the Ethereum amount you want to send in the pledge and it is denoted by value.

To know the structure of the transactionObject and to know more about it, you can visit:

answered Jul 25, 2018 by digger
• 26,740 points

Related Questions In Blockchain

0 votes
2 answers

Is it possible to modify a variable value from another contract?

No, you can't directly edit a variable ...READ MORE

answered Sep 24, 2018 in Blockchain by Sai
+1 vote
1 answer

How does a miner get to know that a transaction is verified by all the nodes?

Contrary to the popular belief, it is ...READ MORE

answered Mar 27, 2018 in Blockchain by Johnathon
• 9,090 points
0 votes
1 answer

How can we decrypt a transaction payload when confidentiality is on?

You can try the following: you can only ...READ MORE

answered May 3, 2018 in Blockchain by Shashank
• 10,400 points
0 votes
1 answer

How a transaction validity is verified in blockchain?

Blockchain has the records the of all ...READ MORE

answered May 11, 2018 in Blockchain by Johnathon
• 9,090 points
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
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 vote
5 answers

Where does the smart contracts stored and executed on blockchain?

Ethereum smart contracts are executed on EVM ...READ MORE

answered May 3, 2018 in Blockchain by Shashank
• 10,400 points
0 votes
1 answer
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP