0
votes

I am new to blockchain technology and trying to understand somethings(Etheruem, Truffle, DApps etc.) here and there from the internet. From Ethereum official website,

Create a cryptocurrency contract in Ethereum

I am trying to specifically understand these functions

approve(address _spender, uint _value) returns (bool success) {...}

approveAndCall(address _spender, uint _value, bytes _extraData) returns (bool success) {...}

transferFrom(address _from, address _to, uint _value) returns (bool success) {...}

and lastly this function() {throw;}

This contract code

contract tokenRecipient {
  function receiveApproval(address _from, uint _value, address _token, bytes _extraData);
}

and this declaration mapping (address => mapping (address => uint) ) public allowance;

2

2 Answers

0
votes

First function basically takes address to where coin is to send and the value to be sent and return boolean value. Other function is for transfer value and takes sender and reciever address and returns again bookean value for success or failure.

0
votes

I posted this question on Ethereum Stackchange and got the answer. Follow the comments also.

How does a token contract work?