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);
})
This is a fundamental difference between Bitcoin and Ethereum.
In Ethereum having multiple accounts is not like having multiple unspent transactions in Bitcoin, because each Ethereum account has it's own private key and a balance.
Therefore you would have to separately sign each payment from each account - in effect creating a separate transactions everytime.
There are two points that I see with this, the first is that with short block times, you are not penalised in terms of lost time if you are creating multiple payments, and the second is that the fees for each payment are applicable for each payment rather than one overall calculated fee.
If all the accounts were part of a multisig-ring payment this might work however, but it is not very flexible if you only wanted to use one account for something.
Best Answer
If you're using web3j/web3js, you can do it programmatically. I use web3j and I have this in my code: