Client: Support Zcash Sapling addresses in profile

Created on 23 Oct 2018  路  16Comments  路  Source: keybase/client

On October 28th Zcash will upgrade to Sapling. In doing so it will enable the more efficient Sapling transactions. These Sapling addresses have a different format and it isn't possible to add these new addresses to the Keybase profile.

Old style: zcA6qngiR3U7HxYopyTWkaDLwYBd83D5MT7Jb9gpgTzPLMZytzRbtdPP1Syv4RvRgHeoZrJWSask3DyfwXG9DGPMWMvX7aC

New style:
zs1z7rejlpsa98s2rrrfkwmaxu53e4ue0ulcrw0h4x5g8jl04tak0d3mm47vdtahatqrlkngh9sly

While the legacy Sprout z-addresses will continue to function after Sapling activates given the benefits of Sapling it's likely they see far greater adoption so support for them would be most welcome!

Most helpful comment

Thank you for the update, we will try to make this change as soon as we can.

All 16 comments

Thank you for the update, we will try to make this change as soon as we can.

@garethtdavies do you have a reference for how to consume and error-check these addresses? Details are scarce as far as I can tell, the Bitcoin Bech32 scheme doesn't seem to work out of the box.

In node, I tried this:

$ npm i bech32
bech32 = require 'bech32'
bech32.decode('zs1z7rejlpsa98s2rrrfkwmaxu53e4ue0ulcrw0h4x5g8jl04tak0d3mm47vdtahatqrlkngh9sly')

That yields an invalid checksum. This works though:

bech32.decode('zs1z7rejlpsa98s2rrrfkwmaxu53e4ue0ulcrw0h4x5g8jl04tak0d3mm47vdtahatqrlkn3pxg7n')

Similar results with Golang library I found (see this branch)

I think @garethtdavies gave you an invalid Sapling address by mistake, that's why it doesn't validate. You can validate a z-addr using zcashd, using the z_validateaddress RPC call.

Regarding validation itself: that's slightly more complicated to fully reflect what zcashd does but I will post further details here when I get a chance. You will need to check the following:

  • Prefix is "zs".
  • Number of words is 69.
  • Check total number of bits is within the expected range when converting from base 32 to base 256.

Do you typically use Node.js within keybase for this kind of check?

That would explain it! I think this address shows up in the official Zcash docs too, see this screenshot from this URL. Also, it shows up in the official blog post. I saw the details about what's inside in the spec, but the spec was mute on what happens one layer up, aside from saying Bech32. We do some server-side node, but we're using Go on the client side. That branch above shows that I was trying this library for decoding.

screen shot 2018-10-29 at 1 39 46 pm

Great catch @jasondavies. Sorry for the confusion, I didn鈥檛 even think to check this and just copied from the official blog post as referenced above.

@jasondavies Are there valid sample sapling addresses published that I can test against?

I generated a few for you:

zs1x2q4pej08shm9pd5fx8jvl97f8f7t8sej8lsgp08jsczxsucr5gkff0yasc0gc43dtv3wczerv5
zs1fw4tgx9gccv2f8af6ugu727slx7pq0nc46yflcuqyluruxtcmg20hxh3r4d9ec9yejj6gfrf2hc

cheers

Thanks @jasondavies, those all worked.

Reader support is in master now. We're going to wait a release cycle before we enable posting of Sapling addresses. Thank you.

What counts as a "release cycle"? I just installed the 3.0.0 RPM and I still can't add an address.

Forgot to enable it serverside. Try it now?

Still the "waiting one release cycle" message.

Sorry about that, we forgot to enable on the client side: https://github.com/keybase/client/pull/15912

Next release cycle, I apologize.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kurianjacob picture kurianjacob  路  4Comments

dwhagar picture dwhagar  路  3Comments

Magi1053 picture Magi1053  路  3Comments

shadowfacts picture shadowfacts  路  4Comments

heartwithyou picture heartwithyou  路  3Comments