Skip to content

feat: NEAR Protocol native support (Ed25519, implicit account, blind-sign)#248

Open
BitHighlander wants to merge 1 commit into
alphafrom
feat/near-support
Open

feat: NEAR Protocol native support (Ed25519, implicit account, blind-sign)#248
BitHighlander wants to merge 1 commit into
alphafrom
feat/near-support

Conversation

@BitHighlander

Copy link
Copy Markdown
Owner

Summary

First-pass NEAR Protocol support on the device: derive a NEAR implicit account and sign NEAR transactions.

  • Crypto: Ed25519, SLIP-0010 hardened-only, coin type 397 (m/44'/397'/0'), decimals 24
  • Address: lowercase hex of the 32-byte Ed25519 pubkey (NEAR implicit account)
  • Signing (blind, first pass): host Borsh-serializes the full NearTransaction and ships raw_tx; firmware signs Ed25519(SHA256(raw_tx)) and returns the 64-byte signature. Device displays host-supplied receiver_id + action_display for confirmation.
  • New: near.c/.h, fsm_msg_near.h, messages-near.options; wired into fsm.c, fsm.h, messagemap.def, coins.def/coins.c (isNear() → account-based), CMakeLists.txt.

Dependency

Bumps deps/device-protocol to the NEAR-proto commit. Merge BitHighlander/device-protocol#32 first (or this submodule pin lands ahead of master).

Notes

  • NEAR message types are 1610-1613 (proto renumbered from the original 1600-1603 to avoid colliding with Hive). Firmware references enum symbols, so this is transparent in C.
  • Blind signing is an intentional first pass — the device cannot verify raw_tx matches the displayed action_display. Per-action parsing / clear-signing is a follow-up. This already supports any NEAR action (transfer, FunctionCall, CreateAccount/AddKey — i.e. name registration) since the host builds the payload.

Test plan

  • CI build (nanopb codegen for messages-near.proto)
  • Emulator: NearGetAddress returns hex implicit account for a known seed
  • Emulator: NearSignTx over a Borsh payload; verify signature against the returned pubkey
  • OLED screenshots of address + sign confirmation (release gate)

…+sign)

- messages-near.proto MessageTypes 1600-1603 (via device-protocol feature/near-proto)
- near.c: Ed25519 key derivation (SLIP-0010 coin type 397), hex implicit address, SHA256+Ed25519 signing
- fsm_msg_near.h: NearGetAddress + NearSignTx handlers wired into FSM
- messagemap.def, fsm.h, fsm.c: registration + forward decls
- lib/transport/CMakeLists.txt: nanopb compile step for messages-near.proto
- coins.def: NEAR entry (ed25519, decimals=24, BIP44 0x8000018D)
- coins.c: isNear() added to isAccountBased()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant