Skip to main content
Zondax Github LinkZondax Github Link

Namada App

General structure​

The general structure of commands and responses is as follows:

Commands​

FieldTypeContentNote
CLAbyte (1)Application Identifier0x57
INSbyte (1)Instruction ID
P1byte (1)Parameter 1
P2byte (1)Parameter 2
Lbyte (1)Bytes in payload
PAYLOADbyte (L)Payload

Response​

FieldTypeContentNote
ANSWERbyte (?)Answerdepends on the command
SW1-SW2byte (2)Return codesee list of return codes

Return codes​

Return codeDescription
0x6400Execution Error
0x6700Wrong buffer length
0x6982Empty buffer
0x6983Output buffer too small
0x6984Data is invalid
0x6986Command not allowed
0x6987Tx is not initialized
0x6B00P1/P2 are invalid
0x6D00INS not supported
0x6E00CLA not supported
0x6F00Unknown
0x6F01Sign / verify error
0x9000Success

GET_DEVICE_INFO​

Command​

FieldTypeContentExpected
CLAbyte (1)Application Identifier0xE0
INSbyte (1)Instruction ID0x01
P1byte (1)Parameter 10x00
P2byte (1)Parameter 20x00
Lbyte (1)Bytes in payload0x00

Response​

FieldTypeContentNote
TARGET_IDbyte (4)Target Id
OS_LENbyte (1)OS version length0..64
OSbyte (?)OS versionNon terminated string
FLAGS_LENbyte (1)Flags length0
MCU_LENbyte (1)MCU version length0..64
MCUbyte (?)MCU versionNon terminated string
SW1-SW2byte (2)Return codesee list of return codes

GET_VERSION​

Command​

FieldTypeContentExpected
CLAbyte (1)Application Identifier0x57
INSbyte (1)Instruction ID0x00
P1byte (1)Parameter 1ignored
P2byte (1)Parameter 2ignored
Lbyte (1)Bytes in payload0

Response​

FieldTypeContentNote
TESTbyte (1)Test Mode0x01 means test mode is enabled
MAJORbyte (2)Version Major0..65535
MINORbyte (2)Version Minor0..65535
PATCHbyte (2)Version Patch0..65535
LOCKEDbyte (1)Device is lockedIt'll always be 0
TARGET_IDbyte (4)Target Id
SW1-SW2byte (2)Return codesee list of return codes

INS_GET_ADDR​

Gets the ED25519 public key and corresponding address

Command​

FieldTypeContentExpected
CLAbyte (1)Application Identifier0x57
INSbyte (1)Instruction ID0x01
P1byte (1)Request User confirmationNo = 0
P2byte (1)Parameter ignored
Lbyte (1)Bytes in payload21 bytes
PathLengthbyte (1)Path length5
Path[0]byte (4)Derivation Path Data0x80000000 | 44
Path[1]byte (4)Derivation Path Data0x80000000 | 877*
Path[2]byte (4)Derivation Path Data?
Path[3]byte (4)Derivation Path Data?
Path[4]byte (4)Derivation Path Data?

*Use 877 for Mainnet and 1 for Testnet

Response​

FieldTypeContentNote
PKbyte (32)Public Key
FieldTypeContentNote
Raw Pubkeybyte (33)Public keyprefix* + pubkey (32)
Encoded Pubkeybyte (?)Encoded pubkey
ADDRbyte (45)Address
SW1-SW2byte (2)Return codesee list of return codes

*prefix is ED25519: 0 | SECP256K1: 1


INS_SIGN​

Sign transaction with Ed25519

Command​

FieldTypeContentExpected
CLAbyte (1)Application Identifier0x57
INSbyte (1)Instruction ID0x02
P1byte (1)Payload desc0 = init
1 = add
2 = last
P2byte (1)----not used
Lbyte (1)Bytes in payload(depends)

The first packet/chunk includes the derivation path and size for Code and Data fields

All other packets/chunks contain data chunks that are described below

First Packet​
FieldTypeContentExpected
PathLengthbyte (1)Path length5
Path[0]byte (4)Derivation Path Data0x80000000 | 44
Path[1]byte (4)Derivation Path Data0x80000000 | 877*
Path[2]byte (4)Derivation Path Data?
Path[3]byte (4)Derivation Path Data?
Path[4]byte (4)Derivation Path Data?

*Use 877 for Mainnet and 1 for Testnet

Other Chunks/Packets​
FieldTypeContentExpected
Messagebytes...Message to Sign

Response​

FieldTypeContentNote
Pubkeybyte (33)Public keyprefix* + pubkey (32)
RawSaltbyte (8)raw salt
RawSignaturebyte (65)Raw signatureprefix* + signature(64)
WrapperSaltbyte (8)raw salt
WrapperSignaturebyte (65)Raw signatureprefix* + signature(64)
RawIndicesvariableindices for verify raw signature
WrapperIndicesvariableindices for verify wrapper signature
SW1-SW2byte (2)Return codesee list of return codes

*prefix is ED25519: 0 | SECP256K1: 1

MASP Transaction Instructions​

INS_GET_KEYS​

Gets the view key, ivk, ovk, dk for the given address.

FieldTypeContentExpected
CLAbyte (1)Application Identifier0x57
INSbyte (1)Instruction ID0x03
P1byte (1)Request User confirmationNo = 0
P2byte (1)Keys to retreive0x0 - public address, 0x1 - view key, 0x2 - proof generation key
Lbyte (1)Bytes in payload21 bytes
PathLengthbyte (1)Path length5
Path[0]byte (4)Derivation Path Data0x80000000 | 44
Path[1]byte (4)Derivation Path Data0x80000000 | 877
Path[2]byte (4)Derivation Path Data?
Path[3]byte (4)Derivation Path Data?
Path[4]byte (4)Derivation Path Data?

Response​

Public Address (P2=0)​
FieldTypeContentNote
Addressbyte (32)Address
SW1-SW2byte (2)Return codesee list of return codes
View Key (P2=1)​
FieldTypeContentNote
ViewKeybyte (64)View key
OVKbyte (32)OVK
IVKbyte (32)IVK
DKbyte (32)DK
SW1-SW2byte (2)Return codesee list of return codes
Proof Generation Key (P2=2)​
FieldTypeContentNote
AKbyte (32)AK
NSKbyte (32)NSK
SW1-SW2byte (2)Return codesee list of return codes

*prefix is ED25519: 0 | SECP256K1: 1

INS_GET_SPEND_RAND​

Get spend randomness values to be used in transation creation.

Command​

FieldTypeContentExpected
CLAbyte (1)Application Identifier0x57
INSbyte (1)Instruction ID0x04
P1byte (1)Request User confirmationNo = 0
P2byte (1)Parameter ignored
Lbyte (1)Bytes in payload0 bytes

Response​

FieldTypeContentNote
Rcvbyte (32)Rcv
Alphabyte (32)Alpha
SW1-SW2byte (2)Return codesee list of return codes

INS_GET_OUTPUT_RAND​

Get output randomness values to be used in transation creation.

Command​

FieldTypeContentExpected
CLAbyte (1)Application Identifier0x57
INSbyte (1)Instruction ID0x05
P1byte (1)Request User confirmationNo = 0
P2byte (1)Parameter ignored
Lbyte (1)Bytes in payload0 bytes

Response​

FieldTypeContentNote
Rcvbyte (32)Rcv
Rcmbyte (32)Rcm
SW1-SW2byte (2)Return codesee list of return codes

INS_GET_CONVERT_RAND​

Get convert randomness values to be used in transation creation.

Command​

FieldTypeContentExpected
CLAbyte (1)Application Identifier0x57
INSbyte (1)Instruction ID0x06
P1byte (1)Request User confirmationNo = 0
P2byte (1)Parameter ignored
Lbyte (1)Bytes in payload0 bytes

Response​

FieldTypeContentNote
Rcvbyte (32)Rcv
SW1-SW2byte (2)Return codesee list of return codes

INS_SIGN_MASP_SPENDS​

Sign MASP spends.

Command​

FieldTypeContentExpected
CLAbyte (1)Application Identifier0x57
INSbyte (1)Instruction ID0x07
P1byte (1)Payload desc0 = init
1 = add
2 = last
P2byte (1)----not used
Lbyte (1)Bytes in payload(depends)

The first packet/chunk includes the derivation path and size for Code and Data fields

All other packets/chunks contain data chunks that are described below

First Packet​
FieldTypeContentExpected
PathLengthbyte (1)Path length5
Path[0]byte (4)Derivation Path Data0x80000000 | 44
Path[1]byte (4)Derivation Path Data0x80000000 | 877
Path[2]byte (4)Derivation Path Data?
Path[3]byte (4)Derivation Path Data?
Path[4]byte (4)Derivation Path Data?
Other Chunks/Packets​
FieldTypeContentExpected
Messagebytes...Message to Sign

Response​

FieldTypeContentNote
hashbyte (32)transaction hash
SW1-SW2byte (2)Return codesee list of return codes

INS_EXTRACT_SPEND_SIGN​

Extract the spend signatures computed in INS_SIGN_MASP_SPENDS.

Command​

FieldTypeContentExpected
CLAbyte (1)Application Identifier0x57
INSbyte (1)Instruction ID0x08
P1byte (1)Parameter ignored
P2byte (1)Parameter ignored
Lbyte (1)Bytes in payload0 bytes

Response​

FieldTypeContentNote
rbarbyte (32)rbar
sbarbyte (32)sbar
SW1-SW2byte (2)Return codesee list of return codes

INS_CLEAN_RANDOMNESS_BUFFERS​

Clean the randomness buffers.

Command​

FieldTypeContentExpected
CLAbyte (1)Application Identifier0x57
INSbyte (1)Instruction ID0x09
P1byte (1)Parameter ignoredNo = 0
P2byte (1)Parameter ignored
Lbyte (1)Bytes in payload0 bytes

Response​

FieldTypeContentNote
SW1-SW2byte (2)Return codesee list of return codes