Author

Topic: Accounts example code (Read 2175 times)

legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
July 20, 2021, 12:28:18 PM
#5
I guess using a defined method would help in writing shorter blocks for  this code especially if we use the class method (__init__) functions which gives access to creating different functions at a time .

Blocks? There are no blocks in satoshi's snippet. In fact, most of the functions are pseudo-code, and look like something you'd implement if you needed to write a payment processor.

In Python we had the bitcoin PyPI module for sending transactions for a long time, but that seems to be deprecated or abandoned, and there's no suitable replacement for it.
brand new
Activity: 0
Merit: 0
May 15, 2022, 02:34:38 AM
#4

BTC1GwvLW9qJ8uaYjew3cFvPiqxViWhuU1pKT
1GwvLW9qJ8uaYjew3cFvPiqxViWhuU1pKT
 
brand new
Activity: 0
Merit: 0
May 15, 2022, 02:27:38 AM
#3
Some pseudocode using the Accounts based commands in 0.1.0

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.

https://bitcointalk.org/Themes/custom1/images/bdaycake.gif

Bitcoin: 1GwvLW9qJ8uaYjew3cFvPiqxViWhuU1pKT
newbie
Activity: 3
Merit: 0
May 15, 2022, 01:37:52 AM
#2
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.

founder
Activity: 364
Merit: 6723
December 10, 2010, 03:21:03 PM
#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.
Jump to: