Skip to content

Instantly share code, notes, and snippets.

@Schwartz10
Last active December 17, 2019 15:30
Show Gist options
  • Save Schwartz10/1cc53aec896c653dd111384b6647c003 to your computer and use it in GitHub Desktop.
Save Schwartz10/1cc53aec896c653dd111384b6647c003 to your computer and use it in GitHub Desktop.
A description and relevant links of lotus filecoin WalletSignMessage process

WalletSignMessage gets called.

Here's an example Message type in json:

{
  "To": "t1hvuzpfdycc6z6mjgbiyaiojikd6wk2vwy7muuei",
  "From": "t1jdlfl73voaiblrvn2yfivvn5ifucwwv5f26nfza",
  "Nonce": 0,
  "Value": "1000",
  "Method": 0,
  "GasPrice": "1000",
  "GasLimit": "0",
  "Params": []
}
  1. The message cid is calculated (steps below):
  1. Cid is converted into bytes.

  2. WalletSign is invoked with an address and message cid bytes, which invokes the Wallet.Sign method.

  3. Message is signed

  • key type is evaluated (as BLS or secp256k1). (if key type is secp256k1):
  • message cid bytes are hashed with blake2b.Sum256. (Could use blake2b on npm).
  • return secp256k1 signature of blake2b hash with private key. (Could use elliptic on npm).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment