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
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.
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"
}