Skip to main content
Zondax Github LinkZondax Github Link
Theme SwitchTheme Switch

Statemint App

General structure

The general structure of commands and responses is as follows:

Commands

FieldTypeContentNote
CLAbyte (1)Application Identifier0x96
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

Command definition

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 Identifier0x96
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

Command

FieldTypeContentExpected
CLAbyte (1)Application Identifier0x96
INSbyte (1)Instruction ID0x01
P1byte (1)Request User confirmationNo = 0
P2byte (1)Signature schemeEd25519 = 0
Sr25519 = 1
Lbyte (1)Bytes in payload(depends)
Path[0]byte (4)Derivation Path Data0x80000000 | 44
Path[1]byte (4)Derivation Path Data0x80000000 | 354
Path[2]byte (4)Derivation Path Data?
Path[3]byte (4)Derivation Path Data?
Path[4]byte (4)Derivation Path Data?

Response

FieldTypeContentNote
PKbyte (32)Public Key
ADDRbyte (??)address
SW1-SW2byte (2)Return codesee list of return codes

INS_SIGN

Command

FieldTypeContentExpected
CLAbyte (1)Application Identifier0x96
INSbyte (1)Instruction ID0x02
P1byte (1)Payload desc0 = init
1 = add
2 = last
P2byte (1)Signature schemeEd25519 = 0
Sr25519 = 1
Lbyte (1)Bytes in payload(depends)

The first packet/chunk includes only the derivation path

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

First Packet
FieldTypeContentExpected
Path[0]byte (4)Derivation Path Data0x80000000 | 44
Path[1]byte (4)Derivation Path Data0x80000000 | 354
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
SIGbyte (65)Signature
SW1-SW2byte (2)Return codesee list of return codes

INS_SIGN_RAW

Command

FieldTypeContentExpected
CLAbyte (1)Application Identifier0x96
INSbyte (1)Instruction ID0x03
P1byte (1)Payload desc0 = init
1 = add
2 = last
P2byte (1)Signature schemeEd25519 = 0
Sr25519 = 1
Lbyte (1)Bytes in payload(depends)

The first packet/chunk includes only the derivation path

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

First Packet
FieldTypeContentExpected
Path[0]byte (4)Derivation Path Data0x80000000 | 44
Path[1]byte (4)Derivation Path Data0x80000000 | 354
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
SIGbyte (65)Signature
SW1-SW2byte (2)Return codesee list of return codes