Skip to main content

Symbol Python SDK (nemtus mirror of upstream symbol-sdk-python; import module: symbolchain)

Project description

Note (nemtus mirror): This package is a content mirror of the Python SDK from symbol/symbol (sdk/python, upstream PyPI name symbol-sdk-python). nemtus republishes it on PyPI as nemtus-symbol-sdk; the only change from upstream is the published distribution name. The import module name is unchanged — you still import symbolchain. This is distinct from @nemtus/symbol-sdk on npm, which mirrors the JavaScript SDK. For the canonical project, see symbol/symbol.

Symbol-SDK

lint test vectors

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_v1
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
transfer_transaction_v2

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nemtus_symbol_sdk-3.3.2.post1.tar.gz (65.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nemtus_symbol_sdk-3.3.2.post1-py3-none-any.whl (80.9 kB view details)

Uploaded Python 3

File details

Details for the file nemtus_symbol_sdk-3.3.2.post1.tar.gz.

File metadata

  • Download URL: nemtus_symbol_sdk-3.3.2.post1.tar.gz
  • Upload date:
  • Size: 65.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for nemtus_symbol_sdk-3.3.2.post1.tar.gz
Algorithm Hash digest
SHA256 9ed48e36136421f000bf6608fee4676d84e3d2ada5ab5137a7dee632eccdd16c
MD5 065cac36da65353404be85e673022277
BLAKE2b-256 bb957e918d565ed146a312dbc2a71973c80d96c7973e2e66b234fa6e9c75530a

See more details on using hashes here.

Provenance

The following attestation bundles were made for nemtus_symbol_sdk-3.3.2.post1.tar.gz:

Publisher: pypi-sdk-publish.yml on nemtus/symbol

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nemtus_symbol_sdk-3.3.2.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for nemtus_symbol_sdk-3.3.2.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 1a83388dafe9c8e735c586d251402c3710926111a9001a34faf5fc28b890ca88
MD5 7e721499df88a2f7b96950fe72d22010
BLAKE2b-256 c2aa74c7f3aab294213628e49ab4c4469383e056470f28a1f260223676adf508

See more details on using hashes here.

Provenance

The following attestation bundles were made for nemtus_symbol_sdk-3.3.2.post1-py3-none-any.whl:

Publisher: pypi-sdk-publish.yml on nemtus/symbol

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page