flow icon indicating copy to clipboard operation
flow copied to clipboard

Migrate address prefix from 0x to Fx

Open psiemens opened this issue 3 years ago β€’ 8 comments

Issue To Be Solved

To make Flow account addresses easily distinguishable, we'd like to represent them as all-uppercase hexadecimal strings with an Fx prefix. For example:

Fx969D07CEDE37E32B

This requires a change from the current 0x format. We'd like to update all usages of addresses (across all tools and libraries) to be as follows:

1. When reading Flow addresses, the following formats are accepted:

  • No prefix (e.g. 969D07CEDE37E32B)
  • 0x prefix (e.g. 0x969D07CEDE37E32B)
  • Fx prefix (e.g. Fx969D07CEDE37E32B)
  • fx prefix (e.g. fx969D07CEDE37E32B)
  • All of the above in lowercase

The only exception to the above is Cadence, which should only accept 0x and Fx addresses.

2. When printing or displaying Flow addresses, the following format is always used:

  • Fx prefix (e.g. Fx969d07cede37e32b)

Yikes, this is a lot to change 😬

The migration from 0x to Fx does not need to happen immediately -- we can do this gradually across all of our tools. All updates should be done in a backwards compatible fashion (as described above) to avoid breaking changes when possible.

I'm proposing that we first update all tools to satisfy case 1 above (reading addresses). We should only start displaying the Fx prefix once all of our existing tools can understand both formats.

This change affects the following tools and projects:

  • Cadence
  • flow-go
  • FVM
  • Go SDK
  • JS SDK
  • FCL
  • FCL Ledger companion app
  • Port
  • Emulator
  • Playground
  • CLI
  • Documentation site
  • VS Code extension
  • Testnet faucet

psiemens avatar Jan 18 '21 21:01 psiemens

This would be a breaking change in Cadence: Fx... is currently parsed an identifier, and would be parsed as an address literal after the change. I doubt that any code is currently using Fx... as an identifier prefix, but I just wanted to mention it.

Also, the VS Code's syntax highlighting and Flow Playground FE's syntax highlighting needs to be changed.

turbolent avatar Jan 18 '21 22:01 turbolent

Also missing is the faucet

turbolent avatar Jan 18 '21 22:01 turbolent

Great points, thank you!

psiemens avatar Jan 18 '21 22:01 psiemens

I do think we should do this in two waves:

First, let's have a full-court-press to fix all of the places where end users might see or input their Flow addresses. Ideally, this is an "atomic" change that happens one day and we never look back. We should push to get this started and ended as quickly as is feasible. Note that this ALSO includes writing up a guide outlining the recommendations above, and sharing it with the dapp and wallet developers!

Second, we can update the developer tools piece-meal, as we go along. It kind of sucks for devs to live in a 0x/Fx limbo, so let's not leave it too long, but the reality is that devs can deal with a little bit of friction for the short term. I also assume that there are at least 10x as many updates that need to happen on the dev side of things, vs. the user side of things. πŸ˜…

dete avatar Jan 18 '21 23:01 dete

If it's not too late, and if no one has a serious objection, I would like to propose that the standard output format should be ALL UPPERCASE (other than the x in the Fx prefix). Input should always be case-insensitive, but I think that using full-height characters for everything except the x draws attention to the prefix and makes it more obvious that it’s a Flow address.

Fx969D07CEDE37E32B

Fx969D07CEDE37E32B

dete avatar Jan 20 '21 19:01 dete

I like that! Looks cleaner overall.

psiemens avatar Jan 20 '21 20:01 psiemens

I've thought about this a bit more and I think it might actually be more straightforward than I originally thought.

Places where end users see or input addresses:

  • Flow Port
  • Emulator
  • Cadence
  • CLI
  • VS Code
  • Documentation website
  • Playground FE
  • Playground API
  • Wallets
    • Blocto
    • Ledger
    • Kraken
    • Dapper
    • Finoa
  • Block Explorers
    • Big Dipper
    • Flowscan

This easiest way to way to make the emulator, CLI and playground display Fx addresses is to update the shared helper in the Go SDK. The same goes for the Port and wallets -- both depend on the JS SDK.

We can definitely prioritize the user-facing changes, but we might get most of the way there by just updating the SDKs.

psiemens avatar Jan 21 '21 03:01 psiemens

I don't consider users of the Emulator as "end users". End users are the people playing Top Shot, not the people writing Cadence!

My list:

  • Flow Port
  • ~Emulator~
  • ~Cadence~
  • ~CLI~
  • ~VS Code~
  • ~Documentation website~
  • ~Playground FE~
  • ~Playground API~
  • Wallets
    • Blocto
    • Ledger
    • Kraken
    • Dapper
    • Finoa
  • Block Explorers
    • Big Dipper
    • Flowscan

That's the list of places where I think we need to make "the big push". All of the other places need to change, but I think it's okay for them to change gradually over a couple of months.

dete avatar Jan 21 '21 17:01 dete