<pre>
  PIP: 4
  Title: Account Names and Types
  Type: Protocol, Front-End 
  Impact: Hard-Fork
  Author: Herman Schoenfeld <i>&lt;herman@sphere10.com&gt;</i>
  Comments-URI: N/A
  Status: Active
  Created: 2013-04-01
</pre>

## Summary

Allow accounts to have names similar to the Domain Name System, and to contain a type field.

## Motivation

PascalCoin accounts are currently easy to remember numbers similar to bank accounts. Named accounts allow users to additionally associate their email, chat nickname, domain name, company name, brand name, etc to their account to make it even more convenient to remit funds. Account names are also useful for Layer-2 protocols such as chat protocol (chat room names, user names, etc)

Account types allow an account to be distinguished for Layer-2 use cases. For example, an account of type 55 could be interpreted by clients as a "Chat Room" which accepts specially formatted Layer-2 messages. Also, future protocol upgrades may assign special consensus rules for accounts with different types. The possible values for account types range from 0..65535. Type 0 is reserved as the default use case of "User Account". 

## Specification

### Data Object Changes

Account structure inside Account Segments will be expanded to include:

1. Name field
  - Encoded in [PascalCoin64](#pascalcoin64) character-set
  - Must be between 3..x characters long
  - First letter encoded in [PascalCoin64-Restricted](#pascalcoin64-restricted) character-set
2. Type field
  - A WORD value

### Consensus Rule Changes

1. When generating accounts default name is empty string (null)
2. When generating accounts default type is 0
3. When hashing Account Segments, name and type are included in the digest

### New Operation: Change Account Info 

This new operation allows a user to change an account name and type. The account name is encoded in PascalCoin64 and must be unique or empty. If a Change Account Info operation registers a name that’s already registered, the operation is invalid. If there is another pending operation for the same name, the operation is discarded and not propagated by nodes. If a block contains two valid operations registering the same name, the block is invalid. Empty account names are exempt and any account is permitted to be nameless. This operation contains the following properties:

- Account number - the account who’s name will be changed
- Account Name - the PascalCoin64 encoded name for the the account. 
- Account Type - an WORD value depicting the type of account
- Network Fee - the fee paid for this operation
- Fee Paying Account - the account which will be paying the fee, this account must have the same public key as the account being changed
- Signature

### PascalCoin64 Encoding

Available characters include:
```
abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-+{}[]_:`|<>,.?/~
```

### PascalCoin64-Restricted Encoding
Available characters include:
```
abcdefghijklmnopqrstuvwxyz!@#$%^&*()-+{}[]_:`|<>,.?/~
```

### GUI Updates

The PascalCoin GUI must be adequately updated to support the following:
- Searching accounts by name
- Authoring a Change Account Info operation
- Browsing accounts by name

## Rationale

In addition to account names, account data field would be desirable but it has been determined such a field would be too wasteful.

## Backwards Compatibility

Proposed changes are not backwards compatible and will require a hard-fork. 