If I understand your question correctly you want to be able to see who has deposited Eth to your contract address. This is what event logs are for.
(1) Create a contract where there is an event every time there is a transaction. e.g something like:
contract someContract {
address public owner;
// Set the owner of the contract to be the creator of the contract i.e. you
function someContract() {
owner = msg.sender;
}
// This is an event
event DepositMade(address _from, uint value);
event WithdrawalMade(address _to, uint value);
//Catch all function
function() {
// generate an event when someone sends you Eth
if (msg.value > 0)
DepositMade(msg.sender, msg.value);
}
// Only the owner of the site can withdraw Eth
modifier admin { if (msg.sender == owner) _ }
function withdraw(uint amount, address recipient) admin {
if(recipient.send(amount))
WithdrawalMade(msg.sender, msg.value);
else throw;
}
}
The important bits are defining an event type event DepositMade(address _from, uint value)
and generating an event when something happens DepositMade(msg.sender, msg.value);
these events are stored in the event log associated with the address of the deployed contract instance.
(2) You retrieve the events on this contract using rpc eth_newFilter
or web3.eth.filter
e.g something like:
var filter = web3.eth.filter({fromBlock:0, toBlock: 'latest', address: contractAddress, 'topics':['0x' + web3.sha3('DepositMade(hexstring,uint256)')]});
filter.watch(function(error, result) {
if(!error) console.log(result);
})
The web3.eth.filter
command only goes though the blocks' logs. When you create (resp. receive) a transaction from (resp. to) your address, it does not ensue that a log entry has been created.
Creating a log entry is an action that needs to be done explicitly. So scanning all the blocks is indeed the way to go.
To avoid scanning every time, you ought to save your findings in a regular database.
Best Answer
If you look at the VM trace, you can see that the 100 Finney transactions ran into Out-of-Gas exceptions. In the case of an exception, all value included in the transaction is returned to the sender.
To answer the second part of your question, I would use http://live.ether.camp as your block explorer, since it shows contract-produced transactions and errors.
To be clear, while contracts cannot initiate transactions, they can send ether to other addresses. Since these operations are not separate transactions but side-effects of the contract's execution, they are often not listed with the other transactions, creating confusion.
On the ether.camp explorer, these balance transfers are listed as "internal transactions", underneath the transaction that produced them.
On the etherchain explorer, they are listed as "contract invoked transactions", directly underneath the contract that initiated them. It is less clear that these are part of the transaction above, but if you click the parent transaction has, you will see "invoked" transactions listed