Closed filips123 closed 1 year ago
closed by #2700
Using the right libraries to generate a content hash, such as content-hash
mentioned here, a user can interact with an ENS resolver that supports setting and getting the contenthash since the ABI is updated to match the ENS Public Resolver 2.
What was wrong?
There is no way to get a content record of ENS domain.
Based on the source code, I should be able to get the content record with
ns.resolve('domain.eth', 'content')
. This is because there are two types of records. One isaddr
which is already aliased toaddress
methods and other iscontent
which currently doesn't have any alias. But even if it doesn't have alias, I should be able to get content record "the long way".However, when I do this, it throws exceptions:
I also tested this with other mainnet providers and other ENS domains.
Here is a list of some ENS domains that don't work (all of them have correct content record):
How can it be fixed?
First, you should somehow fix this bug. Additionally, you should also add
content
method as alias forcontent
record type.I investigated this a little bit and I found out that it only doesn't work for domains that use new resolver contract (
0xD3ddcCDD3b25A8a7423B5bEe360a42146eb4Baf3
) with a content record in formattype://address
(likeipfs://QmaA1TM7CnsGPLQvf27zB4DaGaDkncNDqh5vBzVymECkCk
).I investigated this a bit more and I found that new resolver now uses
contenthash
instead ofcontent
. However, Web3py still uses old resolver's ABI so it is not able to call it. Additionally, there are some differences between oldcontent
and newcontenthash
as it now uses EIP1577.Also, I'm currently making
content-hash
library for Python (inspired by pldespaigne/content-hash). You can use it to add support for content hash in Web3. Update: It is available here. Update 2: I'm currently also creating support for content hash.