Author

Topic: Accounts example code (Read 2239 times)

legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
July 20, 2021, 11:28:18 AM
#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, 01:34:38 AM
#4

BTC1GwvLW9qJ8uaYjew3cFvPiqxViWhuU1pKT
1GwvLW9qJ8uaYjew3cFvPiqxViWhuU1pKT
 
brand new
Activity: 0
Merit: 0
May 15, 2022, 01: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: 1
Merit: 0
December 04, 2024, 10:56:09 PM
#2
gud tech
founder
Activity: 364
Merit: 7423
December 10, 2010, 02: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: