protocolMagic - requiredInteger 764824073 for Mainnet, 1 for Preprod Testnet, 2 for Preview Testnet
networkId - requiredInteger 1 for Mainnet, 0 for Testnet
ttl - optionalString
validityIntervalStart - optionalString
certificates - optionalArray of CardanoCertificate
withdrawals - optionalArray of CardanoWithdrawal
auxiliaryData - optional CardanoAuxiliaryData
mint - optional CardanoMint
scriptDataHash - optionalString
collateralInputs - optionalArray of CardanoCollateralInput
requiredSigners - optionalArray of CardanoRequiredSigner
collateralReturn - optional CardanoOutput
totalCollateral - optionalString
referenceInputs - optionalArray of CardanoReferenceInput
additionalWitnessRequests - optionalArray of string | Array<number> (paths). Used for multi-sig and token minting witness requests as those can not be determined from the transaction parameters.
metadata - removed - use auxiliaryData instead
derivationType — optionalCardanoDerivationType enum. Determines used derivation type. Default is set to ICARUS=1.
includeNetworkId — optionalBoolean. Determines whether networkId should be explicitly serialized into the transaction body. Default is false.
CardanoTxSigningMode
ORDINARY_TRANSACTION
Represents an ordinary user transaction transferring funds, delegating stake or withdrawing rewards. The transaction will be witnessed by keys derived from paths included in the inputs, certificates and withdrawals. Additionaly, if token minting is present, transaction will also be witnessed by keys derived from paths included in additionalWitnessRequests.
The transaction
should have valid path property on all inputs
must not contain a pool registration certificate
must not contain collateralInputs, collateralReturn, totalCollateral and referenceInputs
must contain paths as stake credentials in certificates and withdrawals (no key hashes or script hashes)
may contain only 1852 and 1855 paths
must not contain 1855 witness requests when transaction is not minting/burning tokens
Stake pool registration certificate specifics
OneKey supports signing of stake pool registration certificates as a pool owner. The transaction may contain external inputs (e.g. belonging to the pool operator) and OneKey is not able to verify whether they are actually external or not, so if we allowed signing the transaction with a spending key, there is the risk of losing funds from an input that the user did not intend to spend from. Moreover there is the risk of inadvertedly signing a withdrawal in the transaction if there's any. To mitigate those risks, we introduced special validation rules for stake pool registration transactions which are validated on OneKey as well. The validation rules are the following:
The transaction must not contain any other certificates, not even another stake pool registration
The transaction must not contain any withdrawals
The transaction inputs must all be external, i.e. path must be either undefined or null
Exactly one owner should be passed as a staking path and the rest of owners should be passed as bech32-encoded reward addresses
Governance registration (Catalyst and other)
OneKey supports signing transactions with auxiliary data containing a governance registration. Governance registrations used to follow CIP-15, which has been superseded by CIP-36. Currently, OneKey supports both CIP-15 and CIP-36 formats, the intended standard can be specified in the format field (with CIP-15 being the default). They differ in the following:
CIP-36 allows delegating the voting power to several voting public keys with different voting power (CardanoGovernanceRegistrationDelegation) as an alternative to providing only a single voting public key. Note that OneKey Firmware supports at most 32 delegations in a single governance registration.
CIP-36 registrations contain the votingPurpose field. The value 0 is intended for Catalyst voting and the value 1 is intended for other purposes. If no value is provided, OneKey serializes 0 by default (if the CIP-36 format is used).
OneKey does not support the 1694 derivation paths at the moment.
HardwareSDK.cardanoSignTransaction(connectId, deviceId, { signingMode:CardanoTxSigningMode.POOL_REGISTRATION_AS_OWNER, inputs: [ {// notice no path is provided here prev_hash:'3b40265111d8bb3c3c608d95b3a0bf83461ace32d79336579a1939b3aad1c0b7', prev_index:0, }, ], outputs: { address:'addr1q84sh2j72ux0l03fxndjnhctdg7hcppsaejafsa84vh7lwgmcs5wgus8qt4atk45lvt4xfxpjtwfhdmvchdf2m3u3hlsd5tq5r', amount:'1000000', }, fee:'300000', ttl:'500000000', protocolMagic:764824073, networkId:1, includeNetworkId:false, certificates: [ { type:CardanoCertificateType.STAKE_POOL_REGISTRATION, poolParameters: { poolId:'f61c42cbf7c8c53af3f520508212ad3e72f674f957fe23ff0acb4973', vrfKeyHash:'198890ad6c92e80fbdab554dda02da9fb49d001bbd96181f3e07f7a6ab0d0640', pledge:'500000000',// amount in lovelace cost:'340000000',// amount in lovelace margin: {// numerator/denominator should be <= 1 which is translated then to a percentage numerator:'1', denominator:'2', }, rewardAccount: 'stake1uya87zwnmax0v6nnn8ptqkl6ydx4522kpsc3l3wmf3yswygwx45el', // bech32-encoded stake pool reward account
owners: [ { stakingKeyPath: "m/1852'/1815'/0'/2/0", // this is the path to the owner's key that will be signing the tx on OneKey
}, { stakingKeyHash:'3a7f09d3df4cf66a7399c2b05bfa234d5a29560c311fc5db4c490711',// other owner }, ], relays: [ { type:CardanoPoolRelayType.SINGLE_HOST_IP, ipv4Address:'192.168.0.1', ipv6Address:'2001:0db8:85a3:0000:0000:8a2e:0370:7334',// ipv6 address in full form port:1234, }, { type:CardanoPoolRelayType.SINGLE_HOST_IP, ipv6Address:'2001:0db8:85a3:0000:0000:8a2e:0370:7334', port:1234, }, { type:CardanoPoolRelayType.SINGLE_HOST_IP, ipv4Address:'192.168.0.1', port:1234, }, { type:CardanoPoolRelayType.SINGLE_HOST_NAME, hostName:'www.test.test', port:1234, }, { type:CardanoPoolRelayType.MULTIPLE_HOST_NAME, hostName:'www.test2.test',// max 64 characters long }, ], metadata: { url:'https://www.test.test',// max 64 characters long hash:'914c57c1f12bbf4a82b12d977d4f274674856a11ed4b9b95bd70f5d41c5064a6', }, }, }, ],});
Since transaction streaming has been introduced to the Cardano implementation on OneKey because of memory constraints, OneKey no longer returns the whole serialized transaction as a result of the CardanoSignTransaction call. Instead the transaction hash, transaction witnesses and auxiliary data supplement are returned and the serialized transaction needs to be assembled by the client.