neo3.contracts.utils
Contract utilities for determing the contract hash, contract types, extracting public keys and signing treshold and more.
create_multisig_redeemscript
(
m
,public_keys
)
(bytes) — Create a multi-signature redeem script requiringm
signatures from the listpublic_keys
.create_signature_redeemscript
(
public_key
)
(bytes) — Create a single signature redeem script.get_contract_hash
(
sender
,nef_checksum
,contract_name
)
(UInt160) — Return the calculated contract hash.is_multisig_contract
(
script
)
(bool) — Test if the provided script is a multi-signature contract.is_signature_contract
(
script
)
(bool) — Test if the provided script is a (single) signature contract.parse_as_multisig_contract
(
script
)
(bool) — Try to parse script as multisig contract and extract related data.validate_type
(
obj
,type_
)
— Helper function to validate ABI type information.
neo3.contracts.utils.
create_multisig_redeemscript
(
m
, public_keys
)
→ bytes
Create a multi-signature redeem script requiring m
signatures from the list public_keys
.
This generated script is intended to be executed by the VM to indicate that the requested action is allowed.
m
() — minimum number of signature required for signing. Can't be lower than 2.public_keys
(sequence of ECPoint) — public keys to use during verification.
ValueError
— if the minimum required signatures is not met.ValueError
— if the maximum allowed signatures is exceeded.ValueError
— if the maximum allowed public keys is exceeded.
neo3.contracts.utils.
create_signature_redeemscript
(
public_key
)
→ bytes
Create a single signature redeem script.
This generated script is intended to be executed by the VM to indicate that the requested action is allowed.
public_key
() — the public key to use during verification.
neo3.contracts.utils.
get_contract_hash
(
sender
, nef_checksum
, contract_name
)
Return the calculated contract hash.
sender
() — script hash of account that deployed the contract.nef_checksum
() — checksum of the contract's NEF file.contract_name
() — the name from the contract's manifest.
a unique contract identifier.
neo3.contracts.utils.
is_multisig_contract
(
script
)
→ bool
Test if the provided script is a multi-signature contract.
script
() — contract script.
neo3.contracts.utils.
is_signature_contract
(
script
)
→ bool
Test if the provided script is a (single) signature contract.
script
() — contract script.
neo3.contracts.utils.
parse_as_multisig_contract
(
script
)
Try to parse script as multisig contract and extract related data.
script
() — array of vm byte code.
True
if the script passes as a valid multisignature contract script. False
otherwise.int: the signing threshold if validation passed. 0 otherwise.
list[ECPoint]: the public keys in the script if valiation passed. An empty array otherwise.
neo3.contracts.utils.
validate_type
(
obj
, type_
)
Helper function to validate ABI type information.
obj
() — target object.type_
— expected type
ValueError
— if types do not match.