ascribe / transactions Goto Github PK
View Code? Open in Web Editor NEW๐ transactions: Bitcoin for humans
License: Apache License 2.0
๐ transactions: Bitcoin for humans
License: Apache License 2.0
mainly for simplification purposes, such that instead of having something like:
class transactions.services.service.BitcoinService(testnet=False)
we can have something like:
class transactions.services.BitcoinService(testnet=False)
and perhaps, simplifying further:
class transactions.services.Bitcoin(testnet=False)
or alternatively:
class transactions.BitcoinService(testnet=False)
must take care of putting this in a different release, and possibly documenting it as a breaking change
I'm not 100% certain, but it would seem that Alice's transfers should be signed with her private key (i.e. alice_private_key
), instead of Goofy's, in these two examples:
https://github.com/ascribe/transactions/blame/master/docs/source/theory.rst#L287
https://github.com/ascribe/transactions/blame/master/docs/source/theory.rst#L303
this is more of a proposal with the intent of simplifying the interface
Transaction.create()
appears simpler and less redundant than
Transaction.simple_transaction()
since sign_transaction
is a member method of Transactions
sign
would be sufficient
more clearly:
Transactions.sign_transaction()
could be simplified to:
Transactions.sign()
a proposal to simplify the interface and remove redundancy
Transaction.build()
appears simpler and less redundant than
Transaction.build_transaction()
Since build_transaction
appears to be more of a helper method to support simple_transaction
, perhaps we could name it _build()
to emphasize it is meant to be used more as an internal helper method.
Also, if we do rename simple_transaction
to create
as proposed in issue #12 build
and create
are somewhat synonymous, so perhaps using _build
could help in preventing confusion.
Or perhaps, a more explicit name such as create_helper
could be better.
Traceback (most recent call last):
File "/home/semyon/Programming/Python/bitcoin/main.py", line 8, in <module>
tx = transactions.create(alice, (bob, 117432))
File "/home/semyon/Programming/Python/bitcoin/venv/lib/python3.6/site-packages/transactions/transactions.py", line 114, in simple_transaction
inputs, change = self._select_inputs(from_address, amount, n_outputs, min_confirmations=min_confirmations)
File "/home/semyon/Programming/Python/bitcoin/venv/lib/python3.6/site-packages/transactions/transactions.py", line 172, in _select_inputs
unspents = self.get(address, min_confirmations=min_confirmations)['unspents']
File "/home/semyon/Programming/Python/bitcoin/venv/lib/python3.6/site-packages/transactions/transactions.py", line 84, in get
txs = self._service.list_transactions(hash, account=account, max_transactions=max_transactions)
File "/home/semyon/Programming/Python/bitcoin/venv/lib/python3.6/site-packages/transactions/services/blockrservice.py", line 43, in list_transactions
results = self.make_request(url)
File "/home/semyon/Programming/Python/bitcoin/venv/lib/python3.6/site-packages/transactions/services/blockrservice.py", line 33, in make_request
data = response.json()
File "/home/semyon/Programming/Python/bitcoin/venv/lib/python3.6/site-packages/requests/models.py", line 896, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Process finished with exit code 1
code:
from transactions import Transactions
alice = 'mwPGBZJFoiELLADPES6E4JphUbw25Ju923'
bob = 'mySjpEjdrGsfhnmgX7rtcTtb7R9XGauwiV'
transactions = Transactions(testnet=True)
tx = transactions.create(alice, (bob, 6117432))
tx_signed = transactions.sign(tx, 'cTKusFK7wT8eGPXbfqLWJgQUEyg37BJmHpMJJ5ze3S******')
transactions.push(tx_signed)
Or mock the blockr api.
this will allow us to easily present the content of the readme on PYPI via the long_description
keyword argument in the setup.py
for a simple example see https://github.com/pypa/sampleproject/blob/master/setup.py#L16
from transactions import Transactions
Traceback (most recent call last):
File "", line 1, in
File "/home/ubuntu/env/lib/python3.5/site-packages/transactions/init.py", line 1, in
from transactions import Transactions # noqa
ImportError: cannot import name 'Transactions'
I'm a dumbass and put an apostrophe in mine, and thus cannot get my funds hahaha.
I'm getting this error when trying to build a simple_transaction and the address returns 0 transactions. Was a bit confusing initially:
File "/usr/local/lib/python2.7/site-packages/transactions/services/blockrservice.py", line 50, in list_transactions
for tx in results['txs']:
TypeError: list indices must be integers, not unicode
When the response data looks like this:
[{u'txs': [], u'limit_txs': 200, u'nb_txs': 0, u'nb_txs_displayed': 0, u'address': u"(u''"}, {u'txs': [], u'limit_txs': 200, u'nb_txs': 0, u'nb_txs_displayed': 0, u'address': u" u'1Lo9DHhZZsoZJdyVrkcTot3Ha6mjNcmgw7')"}]
We should change the contributing section since I am not the only one developing.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.