CIP
Implementation of Cardano Improvement Proposals (CIPs)
- pycardano.cip.cip8.sign(message: str, signing_key: Union[ExtendedSigningKey, SigningKey], attach_cose_key: bool = False, network: Network = Network.MAINNET) Union[str, dict]
Sign an arbitrary message with a payment or stake key following CIP-0008. Note that a stake key passed in must be of type StakeSigningKey or StakeExtendedSigningKey to be detected.
- Parameters:
message (str) – Message to be signed
signing_key (SigningKey) – Key which is used to sign the message
attach_cose_key (bool) – Whether or not to attach the Cose key to the output
network (Network) – Network to use for the address generation
- Returns:
A hex-encoded string containing the signed message and verification key. In the case of attach_cose_key=True, a dict containing the signed message and Cose key.
- Return type:
Union[str, dict]
- pycardano.cip.cip8.verify(signed_message: Union[str, dict], attach_cose_key: Optional[bool] = None) dict
Verify the signature of a COSESign1 message and decode its contents following CIP-0008. Supports messages signed by browser wallets or Message.sign().
- Parameters:
signed_message (Union[str, dict]) – Message to be verified
attach_cose_key (Optional[bool]) – Whether or not the Cose key is included with the signed_message. This method will try to determine this automatically if not specified. Usually if signed_message is a dict, this should be true.
- Returns:
A dict containing whether or not the message is verified, the message contents, and an Address which was used to sign the message.
- Return type:
dict
- pycardano.cip.cip14.encode_asset(policy_id: Union[ScriptHash, bytes, str], asset_name: Union[AssetName, bytes, str]) str
Implementation of CIP14 asset fingerprinting
This function encodes the asset policy and name into an asset fingerprint, which is bech32 compliant.
For more information: https://developers.cardano.org/docs/governance/cardano-improvement-proposals/cip-0014/
- Parameters:
policy_id – The asset policy as ScriptHash, bytes, or a hex str
asset_name – The asset name as AssetName, bytes, or a hex str