Empty all accounts in a smartcontract for a banking application - solidity

I am working on a sample banking code in solidity. I wanted to use a so called "TakeAllTheMoney" and run function (just to give you an idea about the role of the function).
This function should only be executable by the deployer of the contract and should give him the possibility to take all the money on the bank and transfer it to his account.
Problem: How can I empty also the account of the other user of the bank? Meaning that when a different user - not the deployer of the contract and of the function - uses the contract after the "TakeAllTheMoney" function is employed, he also sees 0 on his account.
Many thanks in advance
function TakeTheMoneyAndRun() public{
require (msg.sender==Owner);
balance[msg.sender] -= balance[msg.sender];
(msg.sender).transfer( address(this).balance );
Expected results after employing this function:
Balance Bank = 0
Balance person that employed contract and function = 0 (since it went on his metamask account or similar)
Balance of every other user = 0
Again, thanks!

You are mixing two things. User's amount in metamask and user sent amount to Bank in your case is Smart Contract and stored in some variable. So the amount you see in the metamask is the amount User own and has no link with the Smart Contract until and unless you send the money to the Smart Contract.
The Smart Contract in your case "Bank" the money sent by the user is store in the Smart Contract and the tracking of money recieve is stored in the array. Smart Contract itself does not holds the record of the previous transaction. So if you want to delete the Smart contract balance tracks of the User you have to empty that particular array. Although it sounds fishy if you want to implement it and wants to make the user accounts to zero in the Smart Contract.

Related

Is auth numbers field guaranteed to be there if the product supports auth

If I check that the institution supports auth as a product, would account number and routing number be guaranteed to be there in the numbers field in the auth response?
Sort of.
If the account is from a US bank account, AND if the call doesn't result in an error, you're guaranteed to get account number and routing number. However, that doesn't mean that all Auth calls will return account + routing number.
For example, Auth if you call Auth on an Item that just has a credit card account, you'll get an error response back [this prevents you from getting billed for calls that don't return anything useful]. Or, if you call Auth on a bank account that is from outside the US, you'll get the numbers associated with the transfer system used by that bank (account number + routing number is a US-only system).

Aggregate several bitcoin addresses into a single wallet

I have a few bitcoin addresses (and private keys) with small amounts on them (0.001 to 0.01 BTC). Obviously sending them one by one to exchange does not worth their value due to high transaction fee.
Is there a way to aggregate them all into a single address to exchange the total amount then
You don't need an exchange to perform bitcoin to bitcoin transactions. You can send the all small amounts to one bitcoin address using any wallet, and the only fee you are facing will be the miner's fee, which is in your control. You can set a very small fee, or no fee at all - that will simply move your transactions to a lower priority. Wait a few days, and they will be confirmed.
If you want to do it using code, check https://github.com/primal100/pybitcointools

Replace By Fee on Bitcoin unconfirmed transaction

I'm trying to Replace By Fee (RBF) an unconfirmed transaction due to low fee which was set more than a week ago (5c5dcb0b21dc6142d789899f5efb31b2deb9366644f83d6dfa6e580f9a8697f0).
To do the replacement, I'm using coinb.in. However, when I fill in my address (1SfmVjR5itYMgFY7jD5meLg8efmmtKfXV) and hit 'Load', the tool shows a zero balance. I know it's not correct, as the transaction is not confirmed yet and as I can check the balance in BlockCypher.
Can anyone explain me what I'm doing wrong?
Should I insert the Input to my wallet manually on coinb.in? If so, where can I find the 'Script'? It doesn't seem right...
There is no "unspent transaction output" at your Address currently so that Coinb.in shows a zero balance.
You can get a raw transaction with here.
After you get it, you can modify the amount of BTC for output with Coinb.in, sign it with your private key and broadcast it.
Hope this is helpful for you.

Hyperledger Online payment use case: front end GO implementation

I am new to hyperledger and online payment.
One scenario I have in mind is: if A is an online shop, B is a consumer. B orders an item from A's shop and pays with Bitcoin/hyperledger. A ships the item to B once the payment is received.
With hyperledger, the process goes:
B sends A the payment via blockchain;
A is able to query how much money A owns;
But the question is:
How does A know if the transaction was from B?
How does A know how much money was sent by B?
How does A know if the transaction from B is for the specific ordered item?
Thanks,
What you'd usually do in Bitcoin is to create a new payment address that is bound to the specific order. The invoice would include that address with instructions to send the specified amount to that address and the recipient could simply wait for an incoming transaction with an output destined for that address.
At this point you'd know which customer has paid for which order, to check the amount just check the output value field in the transaction and compare it to the invoice.

Can balanced accept Bank Account other than country US?

Can balanced accept bank account from other countries apart from US?
If yes how the routing numbers and account number format should be?
Also
When am creating a test bank account using balanced.js, the account type is set to 'checking' even though i sent type as 'savings'. Is the test bank account always has type 'checking'?
No.
https://support.balancedpayments.com/hc/en-us/articles/200135940-Is-Balanced-available-internationally-
https://support.balancedpayments.com/hc/en-us/articles/201886494-International-ACH-Transfers-IATs-Not-currently-available-
As for the account type issue make sure you pass "account_type" instead of "type" for balanced.js v1.1.