Skip to main content
Glama

account_create_implicit_account

Create an implicit account on the NEAR blockchain using a random keypair, where the account ID is derived from the public key. Ideal for adding new access keys to existing accounts.

Instructions

Create an implicit account on the NEAR blockchain. An implicit account is a new random keypair that is not associated with an account ID. Instead the account ID is derived from the public key of the keypair (a 64-character lowercase hexadecimal representation of the public key). This implicit account id can be used just as a regular account id, but remember it is not an official account id with a .near or .testnet suffix. Creating implicit accounts is useful for adding new access keys to an existing account.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkIdNomainnet

Implementation Reference

  • Executes the tool logic: generates a random ed25519 keypair, derives the implicit account ID from the base58-decoded public key data converted to lowercase hex, stores the keypair in the local keystore for the specified network, and returns the network ID, implicit account ID, and public key.
    async (args, _) => { const keyPair = KeyPair.fromRandom('ed25519'); const publicKey = keyPair.getPublicKey().toString(); const implicitAccountIdResult: Result<string, Error> = (() => { try { return { ok: true, value: Buffer.from( base58.decode(publicKey.split(':')[1]!), ).toString('hex'), }; } catch (e) { return { ok: false, error: new Error(e as string) }; } })(); if (!implicitAccountIdResult.ok) { return { content: [ { type: 'text', text: `Error: ${implicitAccountIdResult.error}` }, ], }; } const implicitAccountId = implicitAccountIdResult.value; await keystore.setKey(args.networkId, implicitAccountId, keyPair); return { content: [ { type: 'text', text: stringify_bigint({ networkId: args.networkId, implicitAccountId, publicKey, }), }, ], }; }, );
  • Input schema for the tool: requires networkId (testnet or mainnet, defaults to mainnet).
    networkId: z.enum(['testnet', 'mainnet']).default('mainnet'), },
  • Registers the MCP tool 'account_create_implicit_account' with description, input schema using Zod, and the handler function.
    'account_create_implicit_account', noLeadingWhitespace` Create an implicit account on the NEAR blockchain. An implicit account is a new random keypair that is not associated with an account ID. Instead the account ID is derived from the public key of the keypair (a 64-character lowercase hexadecimal representation of the public key). This implicit account id can be used just as a regular account id, but remember *it is not* an official account id with a .near or .testnet suffix. Creating implicit accounts is useful for adding new access keys to an existing account. `, { networkId: z.enum(['testnet', 'mainnet']).default('mainnet'), }, async (args, _) => { const keyPair = KeyPair.fromRandom('ed25519'); const publicKey = keyPair.getPublicKey().toString(); const implicitAccountIdResult: Result<string, Error> = (() => { try { return { ok: true, value: Buffer.from( base58.decode(publicKey.split(':')[1]!), ).toString('hex'), }; } catch (e) { return { ok: false, error: new Error(e as string) }; } })(); if (!implicitAccountIdResult.ok) { return { content: [ { type: 'text', text: `Error: ${implicitAccountIdResult.error}` }, ], }; } const implicitAccountId = implicitAccountIdResult.value; await keystore.setKey(args.networkId, implicitAccountId, keyPair); return { content: [ { type: 'text', text: stringify_bigint({ networkId: args.networkId, implicitAccountId, publicKey, }), }, ], }; }, );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nearai/near-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server