dposlib
package aims to provide a simple API to ARK blockchain and forks.
- Send Ѧ to
AUahWfkfr5J4tYakugRbfow7RWVTK35GPW
- Vote
arky
on Ark blockchain and earn Ѧ weekly
- Ark
- mainet :
ark
- devnet :
dark
- forks
- Persona :
prs
- Ripa :
ripa
- Phantom :
xph
- Persona :
- mainet :
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': []}}
>>> 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}
>>> rest.use("dark")
>>> # 0,0,0 = devnet, account, index
>>> ldg = dposlib.core.api.NanoS(0,0,0)
>>> ldg
{
"address": "DEVx3osw9Rj1wZhoUf2dMbPmmUN9P3XFpb",
"balance": 69.9939675,
"isDelegate": true,
"publicKey": "025993c687f1e3418e0aa47b6ab091e414b51c45b32a107745c01c124652112c7a",
}
>>> ldg.derivationPath
"44'/1'/0'/0'/0"
>>> ldg.send(1, "DGuuCwJYoEheBAC4PZTBSBasaDHxg2e6j7")
{'data': {'accept': ['7445b0748aae8778bcd73d2ca40d8cc19ffee7b68ea89f05e1934b96dd73ed2f'], 'broadcast': ['7445b0748aae8778bcd73d2ca40d8cc19ffee7b68ea89f05e1934b96dd73ed2f'], 'excess': [], 'invalid': []}}
>>> ldg.upVote("darktoons")
{'data': {'accept': ['c13791c8ca0cbcd8ef62a722a4a157fa6aa97a86770f988d9a6dc3234b562bc2'], 'broadcast': ['c13791c8ca0cbcd8ef62a722a4a157fa6aa97a86770f988d9a6dc3234b562bc2'], 'excess': [], 'invalid': []}}
>>> dposlib.core.api.NanoS.fromDerivationPath("44'/1'/0'/0/0")
{
"address": "DDC7kWToyvfKa8dvRTXitr7o5FHMVKtBve",
"balance": 95.20477813,
"publicKey": "038473178d89988b1f8428efe758b99ebf1d49c47b679f3f4a9cdc0829fa6ece2b",
"vote": "03a02b9d5fdd1307c2ee4652ba54d492d1fd11a7d1bb3f3a44c4a05e79f19de933"
}
- First rebrand
- ARK packaging improvement (
v1
andv2
) - LISK packaging improvement (
v09
andv10
) - ARK dynamicFee implementation
- Network API created
- Packaging improvement
- REST requests header bugfix (ubuntu)
- 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
- compatibility with both ark-core v2 devnet and mainnet
- Ark-core v 2.1.x compatibility
- 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
- 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
0.1.9 current work
- doc writing
- unittest
- CLI