symbol-sdk-python


Namesymbol-sdk-python JSON
Version 3.2.0 PyPI version JSON
download
home_pagehttps://github.com/symbol/symbol/tree/main/sdk/python
SummarySymbol SDK
upload_time2024-04-10 01:44:59
maintainerSymbol Contributors
docs_urlNone
authorSymbol Contributors
requires_python<4.0,>=3.9
licenseMIT
keywords symbol sdk symbol sdk
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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,>=3.9",
    "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/c2/27/13bd47573eef377b9b3466e5b0fb94380b73360780e2be160b97dd69cd53/symbol_sdk_python-3.2.0.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.0",
    "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": "35cb868aca52ca9b90e03dcb0e7d516d1b4efa6cba0b44c9d75b4fac2edf7743",
                "md5": "45cccfbf3e920d9760685573a9edc91a",
                "sha256": "b48b49ea32acead59d017ced376974a18c19d9ad4f129195ace316b03504a5a5"
            },
            "downloads": -1,
            "filename": "symbol_sdk_python-3.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "45cccfbf3e920d9760685573a9edc91a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 73262,
            "upload_time": "2024-04-10T01:44:57",
            "upload_time_iso_8601": "2024-04-10T01:44:57.964037Z",
            "url": "https://files.pythonhosted.org/packages/35/cb/868aca52ca9b90e03dcb0e7d516d1b4efa6cba0b44c9d75b4fac2edf7743/symbol_sdk_python-3.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c22713bd47573eef377b9b3466e5b0fb94380b73360780e2be160b97dd69cd53",
                "md5": "2b939e131cb8636bd134de42b97a5868",
                "sha256": "5e4e43fef94501daeed3a9e893a8e6ebc311a25b58310476a82678815e965c08"
            },
            "downloads": -1,
            "filename": "symbol_sdk_python-3.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2b939e131cb8636bd134de42b97a5868",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 60878,
            "upload_time": "2024-04-10T01:44:59",
            "upload_time_iso_8601": "2024-04-10T01:44:59.696078Z",
            "url": "https://files.pythonhosted.org/packages/c2/27/13bd47573eef377b9b3466e5b0fb94380b73360780e2be160b97dd69cd53/symbol_sdk_python-3.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-10 01:44:59",
    "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"
}
        
Elapsed time: 0.26223s