Symbol-SDK
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
from symbolchain.CryptoTypes import PrivateKey
from symbolchain.facade.SymbolFacade import SymbolFacade
facade = SymbolFacade('testnet')
NEM
from symbolchain.CryptoTypes import PrivateKey
from symbolchain.facade.NemFacade import NemFacade
facade = NemFacade('testnet')
Second, describe the transaction using a Python dictionary. For example, a transfer transaction can be described as follows:
Symbol
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
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:
private_key = PrivateKey('EDB671EB741BD676969D8A035271D1EE5E75DF33278083D877F23615EB839FEC')
signature = facade.sign_transaction(facade.KeyPair(private_key), transaction)
json_payload = facade.transaction_factory.attach_signature(transaction, signature)
Finally, send the payload to the desired network using the specified node endpoint:
Symbol: PUT /transactions
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_v1multisig_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_v1transfer_transaction_v2 |
Release files for symbol-sdk-python 3.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| symbol_sdk_python-3.3.3.tar.gz | 66.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| symbol_sdk_python-3.3.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 146.1 kB
Release files / symbol_sdk_python-3.3.3.tar.gz
| Download URL | symbol_sdk_python-3.3.3.tar.gz |
|---|---|
| Size | 66.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
662df4bbbc450dd646fe3c0328add88f47992610a04f39779277a2cddb2614c0
|
|
BLAKE2b-256 checksum How to use checksums |
8b72929d7c7d09f94fd9b32a4303dc92af793137a325ccf09f277e8933941b0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.5 CPython/3.10.12 Linux/6.5.0-1016-aws
|
Release files / symbol_sdk_python-3.3.3-py3-none-any.whl
| Download URL | symbol_sdk_python-3.3.3-py3-none-any.whl |
|---|---|
| Size | 80.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5223f482707a3010b207809409d18b0550561d39e183245a0118fae109c7474c
|
|
BLAKE2b-256 checksum How to use checksums |
e6796b278ec41596f0528c3115bcf7f6c6690b48b1e8ce72c35a14df31beea2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.5 CPython/3.10.12 Linux/6.5.0-1016-aws
|