> For the complete documentation index, see [llms.txt](https://tutorial.neoline.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tutorial.neoline.io/reference/neo3-provider-api-legacy/common-methods/getpublickey.md).

# getPublicKey

Return the public key of the Account that is currently connected to the dApp.

## **Input Arguments**

None

## **Success Response**

<table><thead><tr><th width="323">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>address: string</code></td><td>Address of the connected account</td></tr><tr><td><code>publicKey: string</code></td><td>Public key of the connected account</td></tr></tbody></table>

## **Error Response**

<table><thead><tr><th width="328">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>type: string</code></td><td>The type of error which has occured</td></tr><tr><td><code>description: string</code></td><td>A description of the error which has occured</td></tr><tr><td><code>data: string</code></td><td>Any raw data associated with the error</td></tr></tbody></table>

## Example

### Request

```js
neolineN3.getPublicKey()
.then(publicKeyData => {
    const {
        address,
        publicKey
    } = publicKeyData;

    console.log('Account address: ' + address);
    console.log('Account public key: ' + publicKey);
})
.catch((error) => {
    const {type, description, data} = error;
    switch(type) {
        case 'NO_PROVIDER':
            console.log('No provider available.');
            break;
        case 'CONNECTION_DENIED':
            console.log('The user rejected the request to connect with your dApp');
            break;
        default:
            // Not an expected error object.  Just write the error to the console.
            console.error(error);
            break;
    }
});
```

### Response

```js
{
    address: 'NaUjKgf5vMuFt7Ffgfffcpc41uH3adx1jq',
    publicKey: '6PYKGV4numxfoswwCedXzhb1oNCC8W4tEdfFPdtWtFa8WidpzYfeJkd2To'
}
```
