Open fasmat opened 1 year ago
@fasmat hello,now can i use this code to sign my transaction on spacemesh? when i signing , the source code need the message header ,but the spacemesh example code not contains that.
the source code path: app-spacemesh->src->signMessage.c
if (parse_message_header(&parser, header) != 0) {
// This is not a valid Solana message
THROW(ApduReplySolanaInvalidMessage);
}
int parse_message_header(Parser* parser, MessageHeader* header) {
BAIL_IF(parse_version(parser, header));
BAIL_IF(parse_pubkeys(parser, &header->pubkeys_header, &header->pubkeys));
BAIL_IF(parse_blockhash(parser, &header->blockhash));
BAIL_IF(parse_length(parser, &header->instructions_length));
return 0;
}
the spacemesh code path: go-spacemesh->genvm->sdk->wallet->tx.go
// Spend creates spend transaction.
func Spend(pk signing.PrivateKey, to types.Address, amount uint64, nonce types.Nonce, opts ...sdk.Opt) []byte {
options := sdk.Defaults()
for _, opt := range opts {
opt(options)
}
spawnargs := wallet.SpawnArguments{}
copy(spawnargs.PublicKey[:], signing.Public(pk))
principal := core.ComputePrincipal(wallet.TemplateAddress, &spawnargs)
payload := core.Payload{}
payload.GasPrice = options.GasPrice
payload.Nonce = nonce
args := wallet.SpendArguments{}
args.Destination = to
args.Amount = amount
tx := encode(&sdk.TxVersion, &principal, &sdk.MethodSpend, &payload, &args)
sig := ed25519.Sign(ed25519.PrivateKey(pk), core.SigningBody(options.GenesisID[:], tx))
return append(tx, sig...)
}
@yantao1995 your comment seems unrelated to this issue, could you please open a new one?
cc @lrettig
ok.thanks.
On macOS to install the app on Nano S with Firmware 2.1.0 the command in the README.md needs to be changed to:
The
--targetId
needs to be0x31100004
(according to official documentation for Firmware 1.5.x of Nano S), the--appFlags
are0x800
instead of0xa00
,--apiLevel
isn't needed and the path to the.gif
needs to benanos_*
instead ofnanox_*
.