Skip to main content
Requirements added in comments
Source Link
Paul S
  • 4.3k
  • 1
  • 22
  • 48

The reason I'm asking this is because I need to accept Ether payments in my system and I would like to generate a unique account for each deposit,

Don't put ether in raw accounts on a client node, treat a smart contract as an account holder and track the accounts in your smart contract. See multi-sig wallet and other examples on how to track multiple users.

When you wish to send ether, you are sending it from your smart contract, which is one transaction.

It's also more secure to keep ether this way. That's why the multi-sig wallet was invented.

[EDIT, further requirements from comments].

If you just want to track the balance by sender, you would do this in solidity (pseudo-code). If you want to track by customer ID hopefully that's obvious how to change the code.

struct Deposit {
    uint customer_id;
    uint value;
}
mapping (address => Deposit) depositers;
function deposit() { 
    depositsers[msg.sender].value = msg.value;
}

The reason I'm asking this is because I need to accept Ether payments in my system and I would like to generate a unique account for each deposit,

Don't put ether in raw accounts on a client node, treat a smart contract as an account holder and track the accounts in your smart contract. See multi-sig wallet and other examples on how to track multiple users.

When you wish to send ether, you are sending it from your smart contract, which is one transaction.

It's also more secure to keep ether this way. That's why the multi-sig wallet was invented.

The reason I'm asking this is because I need to accept Ether payments in my system and I would like to generate a unique account for each deposit,

Don't put ether in raw accounts on a client node, treat a smart contract as an account holder and track the accounts in your smart contract. See multi-sig wallet and other examples on how to track multiple users.

When you wish to send ether, you are sending it from your smart contract, which is one transaction.

It's also more secure to keep ether this way. That's why the multi-sig wallet was invented.

[EDIT, further requirements from comments].

If you just want to track the balance by sender, you would do this in solidity (pseudo-code). If you want to track by customer ID hopefully that's obvious how to change the code.

struct Deposit {
    uint customer_id;
    uint value;
}
mapping (address => Deposit) depositers;
function deposit() { 
    depositsers[msg.sender].value = msg.value;
}
Source Link
Paul S
  • 4.3k
  • 1
  • 22
  • 48

The reason I'm asking this is because I need to accept Ether payments in my system and I would like to generate a unique account for each deposit,

Don't put ether in raw accounts on a client node, treat a smart contract as an account holder and track the accounts in your smart contract. See multi-sig wallet and other examples on how to track multiple users.

When you wish to send ether, you are sending it from your smart contract, which is one transaction.

It's also more secure to keep ether this way. That's why the multi-sig wallet was invented.