light api compatible with main ARK and LISK forks
Project description
dposlib
package aims to provide a simple API to ARK blockchain and forks.
Support this project
- Send Ѧ to
AUahWfkfr5J4tYakugRbfow7RWVTK35GPW
- Vote
arky
on Ark blockchain and earn Ѧ weekly
Quick View
Available network
- Ark
- mainet :
ark
- devnet :
dark
- forks
- Persona :
prs
- Ripa :
ripa
- Phantom :
xph
- Persona :
- mainet :
Overview
Import REST API
>>> from dposlib import rest
>>> rest.use("dark")
Bake Transaction:
>>> from dposlib.blockchain import Transaction
>>> tx = Transaction(
... amount=100000000,
... recipientId="DRgh1n8oyGHDE6xXVq4yhh3sSajAr7uHJY",
... secret="secret",
... secondSecret="secondSecret")
>>> tx.finalize()
>>> tx
{
"amount": 100000000,
"fee": 1830000,
"id": "5a90ea87fb8848c3402e5d6da5d34651eee01124387aa4f499c84621e03dd791",
"recipientId": "DRgh1n8oyGHDE6xXVq4yhh3sSajAr7uHJY",
"senderPublicKey": "03a02b9d5fdd1307c2ee4652ba54d492d1fd11a7d1bb3f3a44c4a05e79f19de933",
"signSignature": "3045022100f297bf2241eb1603c4e91552416bbd900f1335684d3bb8751a043b5ae4569948022067c166322df1374222589d81b4ea52d56d93db8eab7be59a258420cbc6217360",
"signature": "304402205e609776d7d04a659ab8057e269c26e8b611ed4952ffb6b1af9c9bca19a9e3c50220755b8e2a10783bab0e7da95229e358d8e9e4628241a39640869fb8bf856a953a",
"timestamp": 45690392,
"type": 0
}
Broadcast transaction
>>> rest.POST.api.transactions(transactions=[tx])
{'data': {'broadcast': ['5a90ea87fb8848c3402e5d6da5d34651eee01124387aa4f499c84621e03dd791'], 'excess': [], 'invalid': [], 'accept': []}}
Network API
>>> rest.use("ark")
>>> dlgt = dposlib.core.api.Delegate("arky") # get delegate by username
>>> dlgt.forged()
{'fees': 3294.7, 'forged': 227230.7, 'rewards': 223936.0}
>>> dlgt.address
'ARfDVWZ7Zwkox3ZXtMQQY1HYSANMB88vWE'
>>> blk = dlgt.lastBlock() # get last forged block
>>> blk
{
"blockSignature": "304402200a496a628c2741537538f0492f9d683d3c4f1b30c8dd03c33ad8fbe79d08b6eb02206cdec7e1210db53a3ca22da30912479ff3644d3a1ed1d878417d5965f34dfd6d",
"confirmations": 68,
"generatorId": "ARfDVWZ7Zwkox3ZXtMQQY1HYSANMB88vWE",
"generatorPublicKey": "030da05984d579395ce276c0dd6ca0a60140a3c3d964423a04e7abe110d60a15e9",
"height": 5862354,
"id": "1894085440657345411",
"numberOfTransactions": 0,
"payloadHash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"payloadLength": 0,
"previousBlock": "11181074894913507025",
"reward": 2.0,
"timestamp": 47535768,
"totalAmount": 0.0,
"totalFee": 0.0,
"totalForged": 2.0,
"version": 0
}
>>> blk.transactions()
[]
>>> wlt = dposlib.core.api.Wallet(dlgt.address) # get wallet by address
>>> wlt.balance
2537.42979112
>>> for elem in [(tx["recipientId"], tx["amount"]) for tx in wlt.lastTransactions(2)]:
... print(elem)
...
('AHMXV6UdkVxsTwMqeoeqdpotRRmGZZaAtj', 0.08403461)
('AUahWfkfr5J4tYakugRbfow7RWVTK35GPW', 329.32420472)
>>> wlt.link("secret passphrase here")
>>> wlt.send(1, "ARfDVWZ7Zwkox3ZXtMQQY1HYSANMB88vWE")
{'transactionIds': ['bbce72e7a76f5f71209c8ab29b4b4299a409241dfc77835150459a34bd5a5c16'], 'success': True}
Version
0.1.0
- First rebrand
0.1.1
- ARK packaging improvement (
v1
andv2
) - LISK packaging improvement (
v09
andv10
) - ARK dynamicFee implementation
- Network API created
0.1.2
- Packaging improvement
0.1.3
- REST requests header bugfix (ubuntu)
0.1.4
- Python 2.x compatibility fix
- dposlib.core.Transaction.sign does not set fees anymore
- dposlib.core.Transaction.finalize set fees before signature
- dposlib.core.Transaction fee management improved
0.1.5
- compatibility with both ark-core v2 devnet and mainnet
0.1.6
- Ark-core v 2.1.x compatibility
0.1.7
- added
transaction
andrest
MarkDown documentation files - dposlib.core.api is both python 2.x and 3.x compliant
- added Webhook api (experimental)
- fee data initialisation improvement
- transaction broadcasting improvement
- peer selection improvement
- Lisk blockchain and forks developpement frozen
0.1.8 current work
- added ark v2.4 compatibility
- api wallet link using getpass library
- added ledger nano S support (transaction type 0, 1, 2 & 3)
- peer selection now checks syncing status
TODO
- doc writing
- unittest
- wallet
- CLI
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dposlib-0.1.8.tar.gz
(25.5 kB
view details)
File details
Details for the file dposlib-0.1.8.tar.gz
.
File metadata
- Download URL: dposlib-0.1.8.tar.gz
- Upload date:
- Size: 25.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf212160dc67d0da4d4b28591ef965cec68fd91d35882fa34a21715ff9f45ebd |
|
MD5 | 36a951d433b7a77dbb1b7fd66572df3c |
|
BLAKE2b-256 | f7cab90725874fef9b86442c891fcc886c0bfb0269579c536af2b50e8656672a |