contrib/spendfrom.py spends coins from a particular address or addresses #2155

pull gavinandresen wants to merge 1 commits into bitcoin:master from gavinandresen:spendfrom changing 3 files +254 −0
  1. gavinandresen commented at 3:27 PM on January 7, 2013: contributor

    This is 'a python geeks coin control.'

    Should be both useful and also a good demonstration of using the raw transactions API.

  2. spendfrom.py sends coins from a particular address or addresses
    Should be both useful and also a pretty good demonstration of
    using the raw transactions API.
    72bb8e1b34
  3. gmaxwell commented at 4:22 PM on January 7, 2013: contributor

    In my own python scripts I've never been clear about this— and hand't bothered to try to test it— can the cast from Decimal to float and then transmission to bitcoind result in turning 1e-8 BTC to fees due to rounding?

  4. BitcoinPullTester commented at 5:09 PM on January 7, 2013: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/72bb8e1b3498a79702e47c2e64895f3b29f9ee45 for binaries and test log.

  5. gavinandresen commented at 5:21 PM on January 7, 2013: contributor

    @gmaxwell:

    Cast from Decimal to float will be safe as long as floats are 64 bits. Checking for that is a good idea: "information about the precision and internal representation of floating point numbers for the machine on which your program is running is available in sys.float_info."

    ... or maybe more straightforward (and more easily portable to other languages) would be a check routine that takes Decimal("20000000.00000003"), converts it to float, json encode/decode, and makes sure precision is not lost in the round-trip.

    mmm, yeah, json encode/decode definitely better, because the json float encoder might decide to round/truncate...

  6. gavinandresen commented at 6:31 PM on January 7, 2013: contributor

    Closing this for now; I found a nasty bug doing more testing (on testnet-- using same address as input and output could lose coins to fees).

    I'm going to rework to sanity-check fees on the final transaction and write a test plan.

  7. gavinandresen closed this on Jan 7, 2013

  8. owlhooter referenced this in commit a80ef04238 on Oct 11, 2018
  9. guruvan referenced this in commit 2ccfffc87d on Nov 8, 2018
  10. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-02 15:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me