Creating an account system I am using the bitcoind account system for my web app, but it doesn't work the way I want it to work. So I want to make my own account system in Laravel(probably opensource).

The main reason for the account system is that I can't know the fee when I send a transaction. With my own account system I can check if the fee is correct and then send the transaction.

But how can I setup a safe account system?

I was thinking about a table with all the bitcoin accounts(I am not using the users table so I can create accounts for an order for example).

Then an address table with all the addresses linked to an account.

But how do I handle incomming transactions? And outgoing transactions?
If I for some reason change something outside my account system, it will probably will break pretty easy.

Do I have to import all the transactions to calculate the right account balances?

And I want to make the system in a way that I can make transactions between accounts, without making a "real" transaction, just like it works now.

I think it isn't that hard without the account-to-account transactions and moving bitcoin addresses to other accounts features, just import all the transactions in the database and calculate the balance for every address. And than sum the address balance for every account, but I need it.

Does this kind of system already exists.
If not can someone help me with thinking this out.
I have the account system working! Only I didn't really test it, so it isn't stable. 
https://github.com/jwz104/bitcoin-accounts

It works with an user, address and transaction table.

There is running a cronjob that registers all received transactions. If the adddress is found in the address table, it will add the transaction with the user id of the address. If the address has no user_id the transaction will not be added because it is a return transaction(Change).

When a transaction is created the package will send the amount of bitcoins to the address, and the bitcoin that are left are send to a return address(Address without user_id) so the user won't pay to much.