secp256k1 public key from the MPC smart contract. This key belongs to a key pair that will be used later in the tutorial for signing transactions securely.
Before we proceed, let’s create an account on whose behalf we will be acting.
Creating an account
If you already have a NEAR account that you want to control via MPC, feel free to skip this step. Otherwise, use the following command:Deriving a Public Key from MPC
As you already know from the Chain Signatures documentation,derivation_path is the key component that allows generating multiple distinct key pairs. When combined with predecessor_id, it forms a unique and secure pair.
In our example, the smart contract acts as a proxy between a user and the MPC, User Account <-> Contract Proxy <-> Contract Requesting a Signature, which means the contract itself becomes the predecessor in the derivation process: predecessor: contract_proxy_address.
If the Contract Proxy were deployed directly onto the User Account, User Account <-> Contract Requesting a Signature, the User Account would become the predecessor in the derivation process: predecessor: user_account_address.
To understand how derivation_path is built, let’s examine the smart contract implementation:
args.signer_idis the account on whose behalf we’re actingenv::predecessor_account_id().to_string()refers to the account that is calling the contract, please do not confuse it with previously mentionedpredecessor_idas it refers to the smart contract address
- TypeScript
Adding key to the account
Once we have the public key, the final step is to add it to the NEAR account.- Near CLI
- TypeScript
controllable.testnet. Continue to the next chapter to learn how.