diff --git a/CHANGELOG.md b/CHANGELOG.md index f00ca73a7f1..01c2bafe267 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - chore(deps): update of quic-go to v0.54.1 and go-libp2p to v0.43.0 ([filecoin-project/lotus#13361](https://github.com/filecoin-project/lotus/pull/13361)) - feat(spcli): add a `deposit-margin-factor` option to `lotus-miner actor new` and `lotus-shed miner create` so the sent deposit still covers the on-chain requirement if it rises between lookup and execution - feat(cli): lotus evm deploy prints message CID ([filecoin-project/lotus#13378](https://github.com/filecoin-project/lotus/pull/13378)) +- feat(cli): add FRC-102 compatible EIP-191 signing via --fevm flag ([filecoin-project/lotus#13388](https://github.com/filecoin-project/lotus/pull/13388)) # Node and Miner v1.34.1 / 2025-09-15 diff --git a/cli/wallet.go b/cli/wallet.go index db7bfac9c9a..1a0f2db9a9f 100644 --- a/cli/wallet.go +++ b/cli/wallet.go @@ -433,6 +433,12 @@ var walletSign = &cli.Command{ Name: "sign", Usage: "sign a message", ArgsUsage: " ", + Flags: []cli.Flag{ + &cli.BoolFlag{ + Name: "fevm", + Usage: "Use EIP-191 (Ethereum-style) prefix for signing FEVM messages per FRC-102", + }, + }, Action: func(cctx *cli.Context) error { api, closer, err := GetFullNodeAPI(cctx) if err != nil { @@ -459,7 +465,18 @@ var walletSign = &cli.Command{ return err } - sig, err := api.WalletSign(ctx, addr, msg) + var prefix []byte + if cctx.Bool("fevm") { + //EVM-Compatible + prefix = []byte(fmt.Sprintf("\x19Ethereum Signed Message:\n%d", len(msg))) + } else { + //Filecoin + prefix = []byte(fmt.Sprintf("\x19Filecoin Signed Message:\n%d", len(msg))) + } + + toSign := append(prefix, msg...) + + sig, err := api.WalletSign(ctx, addr, toSign) if err != nil { // Check if the address is a multisig address diff --git a/documentation/en/cli-lotus.md b/documentation/en/cli-lotus.md index 005addc02b9..98173756ad4 100644 --- a/documentation/en/cli-lotus.md +++ b/documentation/en/cli-lotus.md @@ -338,6 +338,7 @@ USAGE: lotus wallet sign [command options] OPTIONS: + --fevm Use EIP-191 (Ethereum-style) prefix for signing FEVM messages per FRC-102 (default: false) --help, -h show help ```