{ "info": { "author": "Zhuoer Wang", "author_email": "", "bugtrack_url": null, "classifiers": [], "description": "# neb.py\n\nneb.py is the Nebulas compatible Python API.\nUsers can sign/send transactions and deploy/call smart contract with it.\n\n## Installation\n\nYou can install this library via pip:\n```sh\npip install neb-py\n```\n\n## Usage\n\nplease refer to [examples](/nebpysdk/example) to learn how to use neb.py.\n\n#### Account\n\n```python\nfrom nebpysdk.src.account.Account import Account\n# generate a new account\naccount = Account()\naccount2 = Account.new_account() #another way to create account\npriv_key = \"6c41a31b4e689e1441c930ce4c34b74cc037bd5e68bbd6878adb2facf62aa7f3\"\naccount3 = Account(priv_key) #create account with given priv_key\n\n# export account\naccount_json = account.to_key(bytes(\"passphrase\".encode()))\nprint(account_json)\n\n# load account\naccount = Account.from_key(account_json, bytes(\"passphrase\".encode()))\nprint(account.get_address_str())\nprint(account.get_private_key())\nprint(account.get_public_key())\n\n```\n\n#### API\n\n```python\nfrom nebpysdk.src.client.Neb import Neb\nimport json\nneb = Neb(\"https://testnet.nebulas.io\")\n\n# getNebState\nprint(neb.api.getNebState().text)\n\n# latestIrreversibleBlock\nprint(neb.api.latestIrreversibleBlock().text)\n```\n\n#### Transaction\n\n```python\nfrom nebpysdk.src.account.Account import Account\nfrom nebpysdk.src.core.Address import Address\nfrom nebpysdk.src.core.Transaction import Transaction\nfrom nebpysdk.src.core.TransactionBinaryPayload import TransactionBinaryPayload\nfrom nebpysdk.src.core.TransactionCallPayload import TransactionCallPayload\nfrom nebpysdk.src.client.Neb import Neb\nimport json\n\nneb = Neb(\"https://testnet.nebulas.io\")\nkeyJson = '{\"version\":4,\"id\":\"814745d0-9200-42bd-a4df-557b2d7e1d8b\",\"address\":\"n1H2Yb5Q6ZfKvs61htVSV4b1U2gr2GA9vo6\",\"crypto\":{\"ciphertext\":\"fb831107ce71ed9064fca0de8d514d7b2ba0aa03aa4fa6302d09fdfdfad23a18\",\"cipherparams\":{\"iv\":\"fb65caf32f4dbb2593e36b02c07b8484\"},\"cipher\":\"aes-128-ctr\",\"kdf\":\"scrypt\",\"kdfparams\":{\"dklen\":32,\"salt\":\"dddc4f9b3e2079b5cc65d82d4f9ecf27da6ec86770cb627a19bc76d094bf9472\",\"n\":4096,\"r\":8,\"p\":1},\"mac\":\"1a66d8e18d10404440d2762c0d59d0ce9e12a4bbdfc03323736a435a0761ee23\",\"machash\":\"sha3256\"}}';\npassword = 'passphrase'\n\n# prepare from&to addr\nfrom_account = Account.from_key(keyJson, bytes(password.encode()))\nfrom_addr = from_account.get_address_obj()\nto_addr = Address.parse_from_string(\"n1JmhE82GNjdZPNZr6dgUuSfzy2WRwmD9zy\")\nprint(\"from_addr\", from_addr.string())\nprint(\"to_addr \", to_addr.string())\n\n# prepare transaction, get nonce first\nresp = neb.api.getAccountState(from_addr.string()).text\n\nprint(resp)\nresp_json = json.loads(resp)\nprint(resp_json)\nnonce = int(resp_json['result']['nonce'])\n\nchain_id = 1001\n# PayloadType\npayload_type = Transaction.PayloadType(\"binary\")\n# payload\npayload = TransactionBinaryPayload(\"test\").to_bytes()\n# gasPrice\ngas_price = 1000000\n# gasLimit\ngas_limit = 20000\n\n# binary transaction example\ntx = Transaction(chain_id, from_account, to_addr, 0, nonce + 1, payload_type, payload, gas_price, gas_limit)\ntx.calculate_hash()\ntx.sign_hash()\nprint(neb.api.sendRawTransaction(tx.to_proto()).text)\n\n\n# call type\nto_addr = Address.parse_from_string(\"n1oXdmwuo5jJRExnZR5rbceMEyzRsPeALgm\")\nfunc = \"get\"\narg = '[\"nebulas\"]'\npayload = TransactionCallPayload(func, arg).to_bytes()\npayload_type = Transaction.PayloadType(\"call\")\ntx = Transaction(chain_id, from_account, to_addr, 0, nonce + 1, payload_type, payload, gas_price, gas_limit)\ntx.calculate_hash()\ntx.sign_hash()\nprint(neb.api.sendRawTransaction(tx.to_proto()).text)\n\n```\n\n## Join in!\n\nWe are happy to receive bug reports, fixes, documentation enhancements, and other improvements.\n\nPlease report bugs via the github issue\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/nebulasio/neb.py", "keywords": "", "license": "LICENSE.txt", "maintainer": "", "maintainer_email": "", "name": "neb-py", "package_url": "https://pypi.org/project/neb-py/", "platform": "", "project_url": "https://pypi.org/project/neb-py/", "project_urls": { "Homepage": "https://github.com/nebulasio/neb.py" }, "release_url": "https://pypi.org/project/neb-py/0.4.3.1/", "requires_dist": [ "certifi (==2018.4.16)", "chardet (==3.0.4)", "Crypto (==1.4.1)", "cytoolz (==0.9.0.1)", "eth-hash (==0.1.3)", "eth-keyfile (==0.5.1)", "eth-keys (==0.2.0b3)", "eth-utils (==1.0.3)", "idna (==2.6)", "Naked (==0.1.31)", "protobuf (==3.5.2.post1)", "pycryptodome (==3.6.6)", "pycurl (==7.43.0.1)", "pyscrypt (==1.6.2)", "pysha3 (==1.0.2)", "PyYAML (==3.12)", "requests (==2.18.4)", "shellescape (==3.4.1)", "six (==1.11.0)", "toolz (==0.9.0)", "urllib3 (==1.22)" ], "requires_python": "", "summary": "Nebulas Python SDK", "version": "0.4.3.1" }, "last_serial": 5275818, "releases": { "0.4.1": [ { "comment_text": "", "digests": { "md5": "42cb6920335bcec8799028325af7f49a", "sha256": "cb01c983a150e8c812fd8007cae7ed0f5d488cfb174170200e6737d48297403d" }, "downloads": -1, "filename": "neb_py-0.4.1-py3-none-any.whl", "has_sig": false, "md5_digest": "42cb6920335bcec8799028325af7f49a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 274410, "upload_time": "2018-06-26T08:09:25", "url": "https://files.pythonhosted.org/packages/05/7f/68cbd71f3f5197ddca5b59dfe34fb1f8c58cb6ad5011726166e730625f5f/neb_py-0.4.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "15c2aefee89e12d640cd3a1db56c9119", "sha256": "ff3a4926adabf428d1e5251e6eeb95a64cee85e74d705cabf9beb514f641fa9b" }, "downloads": -1, "filename": "neb-py-0.4.1.tar.gz", "has_sig": false, "md5_digest": "15c2aefee89e12d640cd3a1db56c9119", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 211029, "upload_time": "2018-06-26T08:09:27", "url": "https://files.pythonhosted.org/packages/d5/ec/3ac26ea9319ab3bb6a77dd3bbbe1044111f9a94d0ab3c2f72b70ae83e8e2/neb-py-0.4.1.tar.gz" } ], "0.4.2": [ { "comment_text": "", "digests": { "md5": "9ea97079688fe610a305215243c53c94", "sha256": "30d22a01f8788421513db9c58716fee2faed7c6cf0bdb4c5890cbe6a12c86642" }, "downloads": -1, "filename": "neb_py-0.4.2-py3-none-any.whl", "has_sig": false, "md5_digest": "9ea97079688fe610a305215243c53c94", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 274414, "upload_time": "2018-08-28T12:34:31", "url": "https://files.pythonhosted.org/packages/5c/2a/7b1b7215b6009279ae3dde0b0432ce4d025a56bcbfcf6bcbb4440f0999fd/neb_py-0.4.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ec190ed1f6faedc1e5a483ba4ad83537", "sha256": "5d3193aa5a8822d1c7b524996d52ea41c04f1f6996312733878072a5fbe51e74" }, "downloads": -1, "filename": "neb-py-0.4.2.tar.gz", "has_sig": false, "md5_digest": "ec190ed1f6faedc1e5a483ba4ad83537", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 211055, "upload_time": "2018-08-28T12:34:33", "url": "https://files.pythonhosted.org/packages/05/f8/93f35da38ba7356a08a471e5801ab78d62ddd1938f9e979f6fbe11916348/neb-py-0.4.2.tar.gz" } ], "0.4.3": [ { "comment_text": "", "digests": { "md5": "322fb9579d712a79a08991facd0cd765", "sha256": "c2399cc3b1ef7158b79cc04ccb2a3bdb02f154dcac3eeb3999e7eabaca011bff" }, "downloads": -1, "filename": "neb_py-0.4.3-py3-none-any.whl", "has_sig": false, "md5_digest": "322fb9579d712a79a08991facd0cd765", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 274675, "upload_time": "2018-08-29T06:59:07", "url": "https://files.pythonhosted.org/packages/2a/0e/bb244153c84eed0295139b18a0f223498734bd68fa415f39e5e930173559/neb_py-0.4.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "67518ad16ae341b64af3c3714c3210e7", "sha256": "9c9218adee10c89cb24a076c15c731dd1b7276a089698f956111bc3369745555" }, "downloads": -1, "filename": "neb-py-0.4.3.tar.gz", "has_sig": false, "md5_digest": "67518ad16ae341b64af3c3714c3210e7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 211356, "upload_time": "2018-08-29T06:59:11", "url": "https://files.pythonhosted.org/packages/08/15/14f368190f7ed31575e115aa16f4591ea62f4722b2bc1fd956aeef445749/neb-py-0.4.3.tar.gz" } ], "0.4.3.1": [ { "comment_text": "", "digests": { "md5": "fcfac637de3a5cc7f7eafd5e402078ec", "sha256": "ebc6e78c86ab3459f5eef5929e6a80b600841c3884913e107eb93fd0e9c0f66d" }, "downloads": -1, "filename": "neb_py-0.4.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "fcfac637de3a5cc7f7eafd5e402078ec", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 273067, "upload_time": "2019-05-16T06:48:23", "url": "https://files.pythonhosted.org/packages/f8/3c/6d4dd44855e78f84d10cd00e01cf8314aacb063ef4a689c3d6f9e36ec347/neb_py-0.4.3.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8252bf650f7ff92eea210779c6f6531d", "sha256": "9b9390dd7cef5cce776aceda6638ac68354943738748b3e3a72fd961e3b303b2" }, "downloads": -1, "filename": "neb-py-0.4.3.1.tar.gz", "has_sig": false, "md5_digest": "8252bf650f7ff92eea210779c6f6531d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 208923, "upload_time": "2019-05-16T06:48:25", "url": "https://files.pythonhosted.org/packages/b2/8c/c462492da59a17ad8a7dbf4089b13cee51c9187904a5806548880e0a4a6b/neb-py-0.4.3.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fcfac637de3a5cc7f7eafd5e402078ec", "sha256": "ebc6e78c86ab3459f5eef5929e6a80b600841c3884913e107eb93fd0e9c0f66d" }, "downloads": -1, "filename": "neb_py-0.4.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "fcfac637de3a5cc7f7eafd5e402078ec", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 273067, "upload_time": "2019-05-16T06:48:23", "url": "https://files.pythonhosted.org/packages/f8/3c/6d4dd44855e78f84d10cd00e01cf8314aacb063ef4a689c3d6f9e36ec347/neb_py-0.4.3.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8252bf650f7ff92eea210779c6f6531d", "sha256": "9b9390dd7cef5cce776aceda6638ac68354943738748b3e3a72fd961e3b303b2" }, "downloads": -1, "filename": "neb-py-0.4.3.1.tar.gz", "has_sig": false, "md5_digest": "8252bf650f7ff92eea210779c6f6531d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 208923, "upload_time": "2019-05-16T06:48:25", "url": "https://files.pythonhosted.org/packages/b2/8c/c462492da59a17ad8a7dbf4089b13cee51c9187904a5806548880e0a4a6b/neb-py-0.4.3.1.tar.gz" } ] }