Post
Topic
Board Development & Technical Discussion
Merits 4 from 4 users
Accounts example code
by
satoshi
on 10/12/2010, 19:21:03 UTC
⭐ Merited by roslinpl (1) ,ETFbitcoin (1) ,Zilon (1) ,goldkingcoiner (1)
Some sample pseudocode using the new Accounts based commands in 0.3.18.

print "send to " + getaccountaddress(username) + " to fund your account"
print "balance: " + getbalance(username, 0)
print "available balance: " + getbalance(username, 6)

// if you make a sale, move the money from their account to your "" account
if (move(username, "", amount, 6, "purchased item"))
    SendTheGoods()

// withdrawal
sendfrom(username, bitcoinaddress, amount, 6, "withdrawal by user")

You can use listtransactions(username) to show them a list of their recent transactions.