# Symbol-SDK
[![lint][sdk-python-lint]][sdk-python-job] [![test][sdk-python-test]][sdk-python-job] [![vectors][sdk-python-vectors]][sdk-python-job] [![][sdk-python-cov]][sdk-python-cov-link] [![][sdk-python-package]][sdk-python-package-link]
[sdk-python-job]: https://jenkins.symboldev.com/blue/organizations/jenkins/Symbol%2Fgenerated%2Fsymbol%2Fpython/activity?branch=dev
[sdk-python-lint]: https://jenkins.symboldev.com/buildStatus/icon?job=Symbol%2Fgenerated%2Fsymbol%2Fpython%2Fdev%2F&config=sdk-python-lint
[sdk-python-build]: https://jenkins.symboldev.com/buildStatus/icon?job=Symbol%2Fgenerated%2Fsymbol%2Fpython%2Fdev%2F&config=sdk-python-build
[sdk-python-test]: https://jenkins.symboldev.com/buildStatus/icon?job=Symbol%2Fgenerated%2Fsymbol%2Fpython%2Fdev%2F&config=sdk-python-test
[sdk-python-examples]: https://jenkins.symboldev.com/buildStatus/icon?job=Symbol%2Fgenerated%2Fsymbol%2Fpython%2Fdev%2F&config=sdk-python-examples
[sdk-python-vectors]: https://jenkins.symboldev.com/buildStatus/icon?job=Symbol%2Fgenerated%2Fsymbol%2Fpython%2Fdev%2F&config=sdk-python-vectors
[sdk-python-cov]: https://codecov.io/gh/symbol/symbol/branch/dev/graph/badge.svg?token=SSYYBMK0M7&flag=sdk-python
[sdk-python-cov-link]: https://codecov.io/gh/symbol/symbol/tree/dev/sdk/python
[sdk-python-package]: https://img.shields.io/pypi/v/symbol-sdk-python
[sdk-python-package-link]: https://pypi.org/project/symbol-sdk-python
Python SDK for interacting with the Symbol and NEM blockchains.
Most common functionality is grouped under facades so that the same programming paradigm can be used for interacting with both Symbol and NEM.
## Sending a Transaction
To send a transaction, first create a facade for the desired network:
_Symbol_
```python
from symbolchain.CryptoTypes import PrivateKey
from symbolchain.facade.SymbolFacade import SymbolFacade
facade = SymbolFacade('testnet')
```
_NEM_
```python
from symbolchain.CryptoTypes import PrivateKey
from symbolchain.facade.SymbolFacade import SymbolFacade
facade = SymbolFacade('testnet')
````
Second, describe the transaction using a Python dictionary. For example, a transfer transaction can be described as follows:
_Symbol_
```python
transaction = facade.transaction_factory.create({
'type': 'transfer_transaction_v1',
'signer_public_key': '87DA603E7BE5656C45692D5FC7F6D0EF8F24BB7A5C10ED5FDA8C5CFBC49FCBC8',
'fee': 1000000,
'deadline': 41998024783,
'recipient_address': 'TCHBDENCLKEBILBPWP3JPB2XNY64OE7PYHHE32I',
'mosaics': [
{'mosaic_id': 0x7CDF3B117A3C40CC, 'amount': 1000000}
]
})
```
_NEM_
```python
transaction = facade.transaction_factory.create({
'type': 'transfer_transaction_v1',
'signer_public_key': 'A59277D56E9F4FA46854F5EFAAA253B09F8AE69A473565E01FD9E6A738E4AB74',
'fee': 0x186A0,
'timestamp': 191205516,
'deadline': 191291916,
'recipient_address': 'TALICE5VF6J5FYMTCB7A3QG6OIRDRUXDWJGFVXNW',
'amount': 5100000
})
````
Third, sign the transaction and attach the signature:
```python
private_key = PrivateKey('EDB671EB741BD676969D8A035271D1EE5E75DF33278083D877F23615EB839FEC')
signature = facade.sign_transaction(facade.KeyPair(private_key), transaction)
json_payload = facade.transactionFactory.attachSignature(transaction, signature)
```
Finally, send the payload to the desired network using the specified node endpoint:
_Symbol_: PUT `/transactions`
<br>
_NEM_: POST `/transaction/announce`
## NEM Cheat Sheet
In order to simplify the learning curve for NEM and Symbol usage, the SDK uses Symbol terminology for shared Symbol and NEM concepts.
Where appropriate, NEM terminology is replaced with Symbol terminology, including the names of many of the NEM transactions.
The mapping of NEM transactions to SDK descriptors can be found in the following table:
| NEM name (used in docs) | SDK descriptor name|
|--- |--- |
| ImportanceTransfer transaction | `account_key_link_transaction_v1` |
| MosaicDefinitionCreation transaction | `mosaic_definition_transaction_v1` |
| MosaicSupplyChange transaction | `mosaic_supply_change_transaction_v1` |
| MultisigAggregateModification transaction | `multisig_account_modification_transaction_v1`<br>`multisig_account_modification_transaction_v2` |
| MultisigSignature transaction or Cosignature transaction | `cosignature_v1` |
| Multisig transaction | `multisig_transaction_v1` |
| ProvisionNamespace transaction | `namespace_registration_transaction_v1` |
| Transfer transaction | `transfer_transaction_v1`<br>`transfer_transaction_v2` |
Raw data
{
"_id": null,
"home_page": "https://github.com/symbol/symbol/tree/main/sdk/python",
"name": "symbol-sdk-python",
"maintainer": "Symbol Contributors",
"docs_url": null,
"requires_python": "<4.0.0,>=3.9.2",
"maintainer_email": "contributors@symbol.dev",
"keywords": "symbol, sdk, Symbol SDK",
"author": "Symbol Contributors",
"author_email": "contributors@symbol.dev",
"download_url": "https://files.pythonhosted.org/packages/a8/4e/e3f7c3891d56e91f4504f751fac63850ec817f3e2d797327f99c5825bcc0/symbol_sdk_python-3.2.3.tar.gz",
"platform": null,
"description": "# Symbol-SDK\n\n[![lint][sdk-python-lint]][sdk-python-job] [![test][sdk-python-test]][sdk-python-job] [![vectors][sdk-python-vectors]][sdk-python-job] [![][sdk-python-cov]][sdk-python-cov-link] [![][sdk-python-package]][sdk-python-package-link]\n\n[sdk-python-job]: https://jenkins.symboldev.com/blue/organizations/jenkins/Symbol%2Fgenerated%2Fsymbol%2Fpython/activity?branch=dev\n[sdk-python-lint]: https://jenkins.symboldev.com/buildStatus/icon?job=Symbol%2Fgenerated%2Fsymbol%2Fpython%2Fdev%2F&config=sdk-python-lint\n[sdk-python-build]: https://jenkins.symboldev.com/buildStatus/icon?job=Symbol%2Fgenerated%2Fsymbol%2Fpython%2Fdev%2F&config=sdk-python-build\n[sdk-python-test]: https://jenkins.symboldev.com/buildStatus/icon?job=Symbol%2Fgenerated%2Fsymbol%2Fpython%2Fdev%2F&config=sdk-python-test\n[sdk-python-examples]: https://jenkins.symboldev.com/buildStatus/icon?job=Symbol%2Fgenerated%2Fsymbol%2Fpython%2Fdev%2F&config=sdk-python-examples\n[sdk-python-vectors]: https://jenkins.symboldev.com/buildStatus/icon?job=Symbol%2Fgenerated%2Fsymbol%2Fpython%2Fdev%2F&config=sdk-python-vectors\n[sdk-python-cov]: https://codecov.io/gh/symbol/symbol/branch/dev/graph/badge.svg?token=SSYYBMK0M7&flag=sdk-python\n[sdk-python-cov-link]: https://codecov.io/gh/symbol/symbol/tree/dev/sdk/python\n[sdk-python-package]: https://img.shields.io/pypi/v/symbol-sdk-python\n[sdk-python-package-link]: https://pypi.org/project/symbol-sdk-python\n\nPython SDK for interacting with the Symbol and NEM blockchains.\n\nMost common functionality is grouped under facades so that the same programming paradigm can be used for interacting with both Symbol and NEM.\n\n## Sending a Transaction\n\nTo send a transaction, first create a facade for the desired network:\n\n_Symbol_\n```python\nfrom symbolchain.CryptoTypes import PrivateKey\nfrom symbolchain.facade.SymbolFacade import SymbolFacade\n\n\nfacade = SymbolFacade('testnet')\n```\n\n_NEM_\n```python\nfrom symbolchain.CryptoTypes import PrivateKey\nfrom symbolchain.facade.SymbolFacade import SymbolFacade\n\nfacade = SymbolFacade('testnet')\n````\n\nSecond, describe the transaction using a Python dictionary. For example, a transfer transaction can be described as follows:\n\n_Symbol_\n```python\ntransaction = facade.transaction_factory.create({\n\t'type': 'transfer_transaction_v1',\n\t'signer_public_key': '87DA603E7BE5656C45692D5FC7F6D0EF8F24BB7A5C10ED5FDA8C5CFBC49FCBC8',\n\t'fee': 1000000,\n\t'deadline': 41998024783,\n\t'recipient_address': 'TCHBDENCLKEBILBPWP3JPB2XNY64OE7PYHHE32I',\n\t'mosaics': [\n\t\t{'mosaic_id': 0x7CDF3B117A3C40CC, 'amount': 1000000}\n\t]\n})\n```\n\n_NEM_\n```python\ntransaction = facade.transaction_factory.create({\n\t'type': 'transfer_transaction_v1',\n\t'signer_public_key': 'A59277D56E9F4FA46854F5EFAAA253B09F8AE69A473565E01FD9E6A738E4AB74',\n\t'fee': 0x186A0,\n\t'timestamp': 191205516,\n\t'deadline': 191291916,\n\t'recipient_address': 'TALICE5VF6J5FYMTCB7A3QG6OIRDRUXDWJGFVXNW',\n\t'amount': 5100000\n})\n````\n\nThird, sign the transaction and attach the signature:\n\n\n```python\nprivate_key = PrivateKey('EDB671EB741BD676969D8A035271D1EE5E75DF33278083D877F23615EB839FEC')\nsignature = facade.sign_transaction(facade.KeyPair(private_key), transaction)\n\njson_payload = facade.transactionFactory.attachSignature(transaction, signature)\n```\n\nFinally, send the payload to the desired network using the specified node endpoint:\n\n_Symbol_: PUT `/transactions`\n<br>\n_NEM_: POST `/transaction/announce`\n\n\n## NEM Cheat Sheet\n\nIn order to simplify the learning curve for NEM and Symbol usage, the SDK uses Symbol terminology for shared Symbol and NEM concepts.\nWhere appropriate, NEM terminology is replaced with Symbol terminology, including the names of many of the NEM transactions.\nThe mapping of NEM transactions to SDK descriptors can be found in the following table:\n\n| NEM name (used in docs) | SDK descriptor name|\n|--- |--- |\n| ImportanceTransfer transaction | `account_key_link_transaction_v1` |\n| MosaicDefinitionCreation transaction | `mosaic_definition_transaction_v1` |\n| MosaicSupplyChange transaction | `mosaic_supply_change_transaction_v1` |\n| MultisigAggregateModification transaction | `multisig_account_modification_transaction_v1`<br>`multisig_account_modification_transaction_v2` |\n| MultisigSignature transaction or Cosignature transaction | `cosignature_v1` |\n| Multisig transaction | `multisig_transaction_v1` |\n| ProvisionNamespace transaction | `namespace_registration_transaction_v1` |\n| Transfer transaction | `transfer_transaction_v1`<br>`transfer_transaction_v2` |\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Symbol SDK",
"version": "3.2.3",
"project_urls": {
"Homepage": "https://github.com/symbol/symbol/tree/main/sdk/python",
"Repository": "https://github.com/symbol/symbol/tree/main/sdk/python"
},
"split_keywords": [
"symbol",
" sdk",
" symbol sdk"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c8e2626d6f0ba39f8adf3d2a67566605f14c3e987459e45b023d87a4f80d7bbc",
"md5": "a37e4f0e30b122995c91308e67945066",
"sha256": "df4d40a0b8491ad88b36444ea69889f281f8d84cbf90f3d8b0b05cfaee046c34"
},
"downloads": -1,
"filename": "symbol_sdk_python-3.2.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a37e4f0e30b122995c91308e67945066",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0.0,>=3.9.2",
"size": 76840,
"upload_time": "2024-12-05T03:38:16",
"upload_time_iso_8601": "2024-12-05T03:38:16.388382Z",
"url": "https://files.pythonhosted.org/packages/c8/e2/626d6f0ba39f8adf3d2a67566605f14c3e987459e45b023d87a4f80d7bbc/symbol_sdk_python-3.2.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a84ee3f7c3891d56e91f4504f751fac63850ec817f3e2d797327f99c5825bcc0",
"md5": "4fba8ab6b6fd307cfee2f169272e5449",
"sha256": "87c69491ea600e0c2a0f77b6caf38adde50751a3770bcfe8854da705120051bd"
},
"downloads": -1,
"filename": "symbol_sdk_python-3.2.3.tar.gz",
"has_sig": false,
"md5_digest": "4fba8ab6b6fd307cfee2f169272e5449",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0.0,>=3.9.2",
"size": 63937,
"upload_time": "2024-12-05T03:38:17",
"upload_time_iso_8601": "2024-12-05T03:38:17.897940Z",
"url": "https://files.pythonhosted.org/packages/a8/4e/e3f7c3891d56e91f4504f751fac63850ec817f3e2d797327f99c5825bcc0/symbol_sdk_python-3.2.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-05 03:38:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "symbol",
"github_project": "symbol",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "symbol-sdk-python"
}