3

I want to develop a method in a smart contract that act as a listener, what i mean is when i use eth.sendTransaction(from:, to:@ of smart contract) it will be executed, without calling any smart contract's methods, thank you

2 Answers 2

1

If I understood you correctly, you need a method which can be called without transaction. You need to add keyword constant to your function name and it will not modify the state, so you can run it without transactions.

pragma solidity ^0.4.11;
contract c{
    function f() constant returns(uint){
        return 1;
    }
}

If you need a fallback function which was my second idea, please follow the manual how to create functions that are triggered when the function signature does not match any of the available functions in a Solidity contract.

0
0

This is probably not what you are looking for but it could help others

Bloopi allows you to subscribe to the balance function of an ERC20 token contract:

args = {contract_id:"", wallet_address:""}
Bloopi::API::Token.balance(args)

{
  "balance": 9999939500000,
  "contract_address": "0xAF0f6FD6D97bf619bF3b1bEEa80175F2c7F5DD91"
}

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.