I have created my own crypto-currency and tried sending it to an address through my ethereum wallet but can anyone tell me that how can I use this crypto-currency in another smart contract for transactions instead of ether?

1 Answer 1


If you created an ERC20 standard contract, then you would have to reference the token contract in the new contract. Specifically the transferFrom method.

This is just a sample of what it could look like:

// Please don't use this code as it might contain security issues...
// It's just an example!

// Contract interface
contract TheTokenContract {
    // Copy Method Headers
    function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);

contract YourNewContract {

    // Send TheToken
    function sendTheToken(address _from, address _to, uint256 _value) public {

        // Set token contract address
        address tokenContractAddress = <TokenAddress>;

        // Connect to TheTokenContract
        TheTokenContract token = TheTokenContract(tokenContractAddress);

        // Use TheTokenContract methods from Contract interface
        bool sendSuccess = token.transferFrom(_from, _to, _value);


  • I have tried what you have said but getting an error which says "It seems this transaction will fail.If you submit it,it may consume all the gas you provide" while executing that contract. Can you help me to resolve it? Jan 30, 2018 at 4:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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