Skip to main content

Tools for working with the Neo N3 blockchain.

Project description

Neo Toolbox

Small toolkit for interacting with the Neo N3 blockchain.

Available tools

  1. Data Transformation
  2. Create Owner Bytes
  3. Create Update Invocation File

Data Transformation

Lets you convert between wallet hashes and addresses.

Example
from neo_toolbox.data_transformation import encode_hash, decode_address

# Encode a wallet hash
original_hash_hex = 'a7271ccc82bb311db369719d1868e6ac19ece31f'
address = encode_hash(original_hash_hex)
print(address)
# Outputs: 'NNpbB25aNMY2pD5JkWeAEbsNfp7C3GoZF1'

# Decode a wallet address
original_address = 'NNpbB25aNMY2pD5JkWeAEbsNfp7C3GoZF1'
hash_hex = decode_address(original_address)
print(hash_hex)
# Outputs: 'a7271ccc82bb311db369719d1868e6ac19ece31f'

Create Owner Bytes

This helper function lets you convert a N3 wallet address to an python variable that can be used in your smart contract to verify the owner of the contract. This is very useful to add admin functionality to your smart contract.

Example
from neo_toolbox.create_owner_bytes import create_owner_bytes

original_address = 'NNpbB25aNMY2pD5JkWeAEbsNfp7C3GoZF1'
code_snippet = create_owner_bytes(original_address)
print(code_snippet)
# Outputs: 'OWNER = UInt160(b"\x1f\xe3\xec\x19\xac\xe6h\x18\x9dqi\xb3\x1d1\xbb\x82\xcc\x1c'\xa7")'

Create Update Invocation File

This helper function lets you create a Neo Express invocation file that can be used to update a smart contract.

Example
from neo_toolbox.create_update_invocation_file import create_update_invocation_file

nef_file = 'path/to/sample_contract.nef'
manifest_file = 'path/to/sample_contract.manifest.json'
template = create_update_invocation_file('your_contract_name', nef_file, manifest_file, operation='my_custom_update')
print(template)
# Outputs a JSON string: '[{"contract": ...'

Created and maintained by Adapted Consulting AS (Norway).

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

neo-toolbox-0.1.6.tar.gz (3.6 kB view hashes)

Uploaded Source

Built Distribution

neo_toolbox-0.1.6-py3-none-any.whl (4.1 kB view hashes)

Uploaded Python 3

Supported by

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