Skip to main content

Symbol SDK

Project description

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

symbol_sdk_python-3.3.0.tar.gz (64.2 kB view details)

Uploaded Source

Built Distribution

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

symbol_sdk_python-3.3.0-py3-none-any.whl (77.1 kB view details)

Uploaded Python 3

File details

Details for the file symbol_sdk_python-3.3.0.tar.gz.

File metadata

  • Download URL: symbol_sdk_python-3.3.0.tar.gz
  • Upload date:
  • Size: 64.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.10.12 Linux/6.5.0-1017-aws

File hashes

Hashes for symbol_sdk_python-3.3.0.tar.gz
Algorithm Hash digest
SHA256 222e6d9e3f682ecae3d1113e3a3f67ce2c1ca1971c1f93bcd067deb9551ba3d2
MD5 c878127343dd2c76ef742d149d240815
BLAKE2b-256 2fe386005389654c4d1d9f1b96fdc3819e0a9422a21a2a719f6e83b2ddd14de6

See more details on using hashes here.

File details

Details for the file symbol_sdk_python-3.3.0-py3-none-any.whl.

File metadata

  • Download URL: symbol_sdk_python-3.3.0-py3-none-any.whl
  • Upload date:
  • Size: 77.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.10.12 Linux/6.5.0-1017-aws

File hashes

Hashes for symbol_sdk_python-3.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2042284a730afe0d79498035c46a17aaf6b282d2e4291b3d11444f9aac1ded60
MD5 39f670665f071e6e38e11ce1becc7b8a
BLAKE2b-256 da6e4aafadc57a650b67b23ecd50e19ae50681694bcbbce2ccfc2e2e936e8792

See more details on using hashes here.

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