Your FIRST BANK - Problem

maxxflyermaxxflyer Member Posts: 30
edited March 2016 in Solidity
This is a simple bank. Just copy and paste in your MIST wallet.

Can you please tell me why I can't widthdraw money?
Or may be I don' t understand how to use it?

When I deposit I see the money going and added
What do you write in the fields in order to widthdraw?

contract Bank {

address owner;

mapping (address => uint) balances;

// Constructor
function Bank(){
owner = msg.sender;

// This will take the value of the transaction and add to the senders account.
function deposit() returns (bool res) {
// If the amount they send is 0, return false.
if (msg.value <= 0){
return false;
balances[msg.sender] += msg.value;
return true;

// Attempt to withdraw the given 'amount' of Ether from the account.

function withdraw(uint amount) returns (bool res) {

// Skip if someone tries to withdraw 0 or if they don't have
// enough Ether to make the withdrawal.

if (balances[msg.sender] < amount || amount == 0)
return false;
balances[msg.sender] -= amount;
return true;

function remove() {
if (msg.sender == owner){


Sign In or Register to comment.