Skip to content

Commit

Permalink
[Cashtab] [Alias] pt 15 - Reserved Aliases
Browse files Browse the repository at this point in the history
Summary:
T2551

This is a standalone diff that adds a single source for a list of reserved aliases based on team trademarks and scam wallet mitigations.

[Cashtab] [Alias] pt 1 - Create scaffold for new Alias component
[Cashtab] [Alias] pt 2 - Upgrade sendXec() to handle alias registration
[Cashtab] [Alias] pt 3 - Implement isAliasAvailable function
[Cashtab] [Alias] pt 4 - Implement isAddressRegistered function
[Cashtab] [Alias] pt 5 - Implement getAddressFromAlias function
[Cashtab] [Alias] pt 6.1 - Get latest alias tx count from payment address
[Cashtab] [Alias] pt 6.1.1 - Apply Promise.All approach for alias history retrieval
[Cashtab] [Alias] pt 6.2 - Implement getAliasesFromLocalForage
[Cashtab] [Alias] pt 6.3 - Implement updateAliases
[Cashtab] [Alias] pt 6.4 - Update getAliases() to extract both alias and address
[Cashtab] [Alias] pt 6.5 - Optimize getAllTxHistory to only make API calls for uncached tx history pages
[Cashtab] [Alias] pt 6.6 - Render list of Aliases owned by active wallet in Alias.js
[Cashtab] [Alias] pt 7 - Mitigate edge cases for registration records
[Cashtab] [Alias] pt 8 - Activation flag in prod
[Cashtab] [Alias] pt 9 - Retain tokenInfoById upon alias validation
--stacked diff cutoff--
[Cashtab] [Alias] pt 10 - Enable alias inputs for one to one Send XEC txs
[Cashtab] [Alias] pt 11 - Enable alias inputs for Send Token txs
[Cashtab] [Alias] pt 12 - Upgrade tx history to recognize alias registration txs
[Cashtab] [Alias] pt 13 -real time alias char length and registration fee display
[Cashtab] [Alias] pt 14 - Frontend bytesize validation
**[Cashtab] [Alias] pt 15 - Reserved aliases**
--closed beta--
[Cashtab] [Alias] pt 16 - Pre-prod update (add p2sh parsing, set final registration fees, remove residual dev logs, test in extension mode and enable prod flag)
[Cashtab] [Alias] pt 17 - Port Alias feature to Cashtab extension
--post mvp---
[Cashtab] [Alias] - Enable alias parsing without the .xec extension
[Cashtab] [Alias] - Optimize isAliasAvailable to take cached tx history as input
[Cashtab] [Alias] - Add active wallet's aliases to caching mechanism
[Cashtab] [Alias] - Resolve special characters processing in node app

Test Plan:
- enable Aliases in Ticker.js
- npm start
- attempt to register an alias from the reserved list and observe the alias taken error
- attempt to register an alias from the reserved list with capitalized variances and observe the alias taken error
- attempt to register an alias not on the reserved list and ensure successful registration

Reviewers: bytesofman, #bitcoin_abc

Reviewed By: bytesofman, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D13236
  • Loading branch information
ethanmackie committed Mar 5, 2023
1 parent b4495bd commit 854e677
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
26 changes: 26 additions & 0 deletions web/cashtab/src/components/Common/Ticker.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,32 @@ export const currency = {
minFee: 550, // dust
},
aliasMaxLength: 21, // max byte length, refer to the Alias spec at https://reviews.bitcoinabc.org/D12972
reservedAliases: [
'avalanche',
'electrum',
'electrumabc',
'bitcoin',
'bitcoinabc',
'ecash',
'ecashofficial',
'xec',
'abc',
'cashtab',
'ecashtab',
'cashtabwallet',
'xecwallet',
'gnc',
'etoken',
'token',
'cashfusion',
'coinbase',
'binance',
'ethereum',
'helpdesk',
'admin',
'support',
'official',
],
},
chronikTxsPerPage: 25, // number of txs per page retrieved via chronik.script.history()
coingeckoId: 'ecash',
Expand Down
15 changes: 15 additions & 0 deletions web/cashtab/src/utils/chronik.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,14 @@ export const getAddressFromAlias = (alias, cachedAliases) => {
};

export const isAliasAvailable = async (chronik, alias) => {
// check whether alias is reserved
const isReservedAlias = currency.aliasSettings.reservedAliases.includes(
alias.toLowerCase(),
);
if (isReservedAlias) {
return false;
}

// retrieve alias payment address tx history
let aliasPaymentTxs = await getAllTxHistory(
chronik,
Expand Down Expand Up @@ -313,6 +321,13 @@ export const getAliasAndAddresses = unfilteredAliasPaymentTxs => {
.toString()
.toLowerCase();

// if this alias is reserved, skip it
const isReservedAlias =
currency.aliasSettings.reservedAliases.includes(parsedAliasNameStr);
if (isReservedAlias) {
continue;
}

/*
Assume the first input is the address registering the alias
Expand Down
6 changes: 6 additions & 0 deletions web/standards/xec-alias.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ Registration fees are paid to a single address. This address will be polled via

The designated registration address will either be the IFP address or an address that periodically sends funds from valid registrations to the IFP address. Automatically processing hot wallet refunds for invalid transactions would not be feasible from the IFP address.

### Reserved Aliases

A list of reserved Aliases should be defined which are not available for registration. These include trademarks as well as mitigation for common phishing websites and scammer usernames. For reference, Cashtab maintains such a reserved list via the `reservedAliases` array in `/Common/Ticker.js`.

As a matter of efficiency, the logic to check whether an alias is reserved should occur before checking local cache or onchain data to see whether the alias has been registered or not.

### Known risks

Resolving conflicting alias registrations at the same blockheight by choosing the alphabetically first txid is arbitrary. It would be possible for someone to watch for broadcast registration transactions, send multiple transactions registering the same alias, and have a good chance of securing the alias before the original registrant.
Expand Down

0 comments on commit 854e677

Please sign in to comment.