decentralized-identity / ion

The Identity Overlay Network (ION) is a DID Method implementation using the Sidetree protocol atop Bitcoin
https://identity.foundation/ion
Apache License 2.0
1.23k stars 170 forks source link

"did_not_found", the sequel #153

Closed ossobucco closed 3 years ago

ossobucco commented 3 years ago

Hi,

(sorry I made a mistake in the first version of this issue I opened; I get did_not_found when using the mainnet DID resolution link in the current install doc.)

I completed the install-guide.md for ION v1.0.1 (using the binary) on Ubuntu 20.02.4 LTS. The ION Bitcoin microservice and ION core service are plugging away smartly in each of their terminal windows. However, when I try the current mainnet test link


http://localhost:3000/identifiers/did:ion:EiClkZMDxPKqC9c-umQfTkR8vvZ9JPhl_xLDI9Nfk38w5w


in Firefox , I get:

{"code":"did_not_found","message":"DID Not Found"}

How could this be? Thanks.

nayuta-ueno commented 3 years ago

The install doc procedure is set up for testnet. Can you get it if testnet DID?

ossobucco commented 3 years ago

No, the testnet link does the same thing: did_not_found [edit: see next reply]. I set it up for mainnet, though.

I had previously had ION 1.0.0 running on mainnet on Win dows 10 about a week ago and it was correctly resolving the DID link then.

ossobucco commented 3 years ago

ok correction, the testnet DID link: http://localhost:3000/identifiers/did:ion:test:EiClWZ1MnE8PHjH6y4e4nCKgtKnI1DK1foZiP61I86b6pw

results in: {"code":"did_initial_state_jcs_is_not_json","message":"Long form initial state should be encoded jcs."}

nayuta-ueno commented 3 years ago

hmm....

"Long form initial state should be encoded jcs."

I found this message around here(sidetree).

Are the configuration JSON files OK?

ossobucco commented 3 years ago

Here they are. I modified the testnet config files, as I had previously on the successful Win10 install, because it was not immediately apparent how to reference the mainnet config files.

testnet-bitcoin-config-json { "bitcoinDataDirectory": "/hdd/Bitcoin", "bitcoinFeeSpendingCutoffPeriodInBlocks": 1, "bitcoinFeeSpendingCutoff": 0.001, "bitcoinPeerUri": "http://localhost:8332", "bitcoinRpcUsername": "bitcoinrpc", "bitcoinRpcPassword": "something", "bitcoinWalletOrImportString": "KyVH3HoBatQWbEvgWaJhL8G9KquPYtRCK7uc1eDeP8V5UhsAZiTV", "databaseName": "ion-mainnet-bitcoin", "genesisBlockNumber": 667000, "logRequestError": true, "mongoDbConnectionString": "mongodb://localhost:27017/", "port": 3002, "sidetreeTransactionFeeMarkupPercentage": 1, "sidetreeTransactionPrefix": "ion:", "transactionPollPeriodInSeconds": 60, "valueTimeLockUpdateEnabled": false, "valueTimeLockAmountInBitcoins": 0, "valueTimeLockPollPeriodInSeconds": 600, "valueTimeLockTransactionFeesAmountInBitcoins": 0.0001 }

testnet-bitcoin-versioning.json [ { "startingBlockchainTime": 667000, "version": "1.0", "protocolParameters": { "feeLookBackWindowInBlocks": 100, "feeMaxFluctuationMultiplierPerBlock": 0.00001, "initialNormalizedFeeInSatoshis": 1000, "valueTimeLockDurationInBlocks": 4500 } } ]

testnet-core-config.json { "batchingIntervalInSeconds": 600, "blockchainServiceUri": "http://127.0.0.1:3002", "databaseName": "ion-mainnet-core", "didMethodName": "ion", "ipfsHttpApiEndpointUri": "http://127.0.0.1:5001", "maxConcurrentDownloads": 20, "mongoDbConnectionString": "mongodb://localhost:27017/", "observingIntervalInSeconds": 60, "port": 3000 }

testnet-core-versioning.json [ { "startingBlockchainTime": 667000, "version": "1.0" } ]

Edit: One difference that comes to mind between the previous Win10 ION install and this Ubuntu one is that, on Ubuntu, I'm using rpcauth on the Bitcoin node.

nayuta-ueno commented 3 years ago

Thank you. Your configuration file is set up for mainnet.

I'm only running ION on Ubuntu 18.04 with testnet, so I don't know how it works with mainnet. Is there anyone else who can help?

thehenrytsai commented 3 years ago

The ION node by default points to testnet, to point to mainnet, you must modify configuration for both bitcoin and core service, naming the 4 environment varialbes below:

ION_BITCOIN_CONFIG_FILE_PATH
ION_BITCOIN_VERSIONING_CONFIG_FILE_PATH
ION_CORE_CONFIG_FILE_PATH
ION_CORE_VERSIONING_CONFIG_FILE_PATH

Let us know if you are still having trouble.

ossobucco commented 3 years ago

Ok. I modified the mainnet config files to be as I posted above and then I ran:

sudo -H gedit /etc/environment

and added these lines:

ION_BITCOIN_CONFIG_FILE_PATH=/home/second/ion/json/mainnet-bitcoin-config.json ION_BITCOIN_VERSIONING_CONFIG_FILE_PATH=/home/second/ion/json/mainnet-bitcoin-versioning.json ION_CORE_CONFIG_FILE_PATH=/home/second/ion/json/mainnet-core-config.json ION_CORE_VERSIONING_CONFIG_FILE_PATH=/home/second/ion/json/mainnet-core-versioning.json

Now when I run npm run bitcoin & npm run core, the yellow 'environment variable undefined notices' don't come up.

However, when I have bitcoin qt, mongodb, the ion bitcoin microservice and the ion core microservice all running at concurrently, I still get the following results with the DID resolution test links:

testnet: http://localhost:3000/identifiers/did:ion:test:EiClWZ1MnE8PHjH6y4e4nCKgtKnI1DK1foZiP61I86b6pw result: {"code":"did_initial_state_jcs_is_not_json","message":"Long form initial state should be encoded jcs."}

mainnet: http://localhost:3000/identifiers/did:ion:EiClkZMDxPKqC9c-umQfTkR8vvZ9JPhl_xLDI9Nfk38w5w result: {"code":"did_not_found","message":"DID Not Found"}

thehenrytsai commented 3 years ago

Hi @ossobucco,

If you've setup your ION node to run against mainnet as you have shown, then the testnet DID as you have pasted will not resolve, (in fact the 4th segment delimited by : will be treated as the initial-state data of a 'long-form' DID but that's a separate dicussion:

http://localhost:3000/identifiers/did:ion:test:EiClWZ1MnE8PHjH6y4e4nCKgtKnI1DK1foZiP61I86b6pw

Now as to the mainnet ID did:ion:EiClkZMDxPKqC9c-umQfTkR8vvZ9JPhl_xLDI9Nfk38w5w, I am not sure, let's diagnose further: if you are able to look into the unresolvable-transactions collection of the ion-mainnet-core MongoDB, do you see any entries in there? You should not be seeing any there.

ossobucco commented 3 years ago

Hi thehenrytsai, This is the output from the ion-mainnet-core db:

db.getCollectionInfos({ name: "unresolvable-transactions" }); [ { "name" : "unresolvable-transactions", "type" : "collection", "options" : {

    },
    "info" : {
        "readOnly" : false,
        "uuid" : UUID("896b0c68-db31-4034-a82b-b2bf7b051e16")
    },
    "idIndex" : {
        "v" : 2,
        "key" : {
            "_id" : 1
        },
        "name" : "_id_"
    }
}

]

thehenrytsai commented 3 years ago

Hi @ossobucco, the command output you have isn't helpful as it doesn't say the count of unresolvable transactions. Would like to know the count of unresolvable transactions (unresolvable-transactions collection) vs resolvable transactions (transactions collection).

ossobucco commented 3 years ago

Hi @thehenrytsai , here are the counts for each (and how I got them): `> show dbs admin 0.000GB config 0.000GB ion-mainnet-bitcoin 0.001GB ion-mainnet-core 0.000GB ion-testnet-bitcoin 0.001GB ion-testnet-core 0.000GB local 0.000GB

> use ion-mainnet-core switched to db ion-mainnet-core

> show collections operations queued-operations service transactions unresolvable-transactions

> db['unresolvable-transactions'].count() 17

> db.transactions.count() 17

`

thehenrytsai commented 3 years ago

@ossobucco,

This looks like the node you are running cannot resolve any ION transactions, which suggests that your IPFS node is unable to download any ION data.

I'd suggest to make sure your IPFS node is able to fetch any ION data. A good test is to make sure the IPFS fetch call below is is able to download an ION file:

http://127.0.0.1:5001/api/v0/get?arg=QmWjEyevTYUaKhySNerasdzfDBe7x27dUWcuTJ4roUvf5H

This would prove that your IPFS node is setup correctly.

ossobucco commented 3 years ago

Thanks thehenrytsai. It looks like I had not installed IPFS Desktop (!). [Correction: I had installed it, but hadn't manually restarted it since rebooting.] I stopped the two ION services, installed [restarted] IPFS Desktop and restarted the two ION services. Then I let things run for 5 minutes.

Now, http://127.0.0.1:5001/api/v0/get?arg=QmWjEyevTYUaKhySNerasdzfDBe7x27dUWcuTJ4roUvf5H results in: 405 - Method Not Allowed

And http://localhost:3000/identifiers/did:ion:EiClkZMDxPKqC9c-umQfTkR8vvZ9JPhl_xLDI9Nfk38w5w results in: {"code":"did_not_found","message":"DID Not Found"}

thehenrytsai commented 3 years ago

Now, http://127.0.0.1:5001/api/v0/get?arg=QmWjEyevTYUaKhySNerasdzfDBe7x27dUWcuTJ4roUvf5H results in: 405 - Method Not Allowed

I am pretty sure you did not use POST, all IPFS calls needs to be POST. Make sure it returns the file you asks for, if not ION node won't work.

And http://localhost:3000/identifiers/did:ion:EiClkZMDxPKqC9c-umQfTkR8vvZ9JPhl_xLDI9Nfk38w5w results in: {"code":"did_not_found","message":"DID Not Found"}

Once you've confirmed IPFS is working correctly, I'd suggest that you wipe the MongoDB and start fresh, reason being that the ION node has exponential back off for retries for files that it cannot fetch, and since it's been a long time since you first started your ION node, it will take days maybe weeks for it to retry again.

ossobucco commented 3 years ago

Ok, using POST via 'Edit and Resend' in Firefox results in a 2.42KB transfer and these response headers:

HTTP/1.1 200 OK Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length Access-Control-Allow-Origin: http://127.0.0.1:5001 Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length Content-Type: text/plain Server: go-ipfs/0.8.0 Trailer: X-Stream-Error Vary: Origin X-Content-Length: 240 X-Stream-Output: 1 Date: Sat, 20 Mar 2021 18:12:41 GMT Transfer-Encoding: chunked

Since it says "Server: go-ipfs/0.8.0", I assume IPFS is working correctly.

Next I shut down the ION services, entered mongo shell and used db.dropDatabase();on the ion-mainnet-core database. Then I restarted the ION services and the ION core service became very busy.

Now when I try the test link: http://localhost:3000/identifiers/did:ion:EiClkZMDxPKqC9c-umQfTkR8vvZ9JPhl_xLDI9Nfk38w5w I get: {"@context":"https://w3id.org/did-resolution/v1","didDocument":{"id":"did:ion:EiClkZMDxPKqC9c-umQfTkR8vvZ9JPhl_xLDI9Nfk38w5w","@context":["https://www.w3.org/ns/did/v1",{"@base":"did:ion:EiClkZMDxPKqC9c-umQfTkR8vvZ9JPhl_xLDI9Nfk38w5w"}],"service":[{"id":"#someId","type":"website","serviceEndpoint":"https://www.ionIsCool.com"}],"verificationMethod":[{"id":"#someKeyId","controller":"","type":"EcdsaSecp256k1VerificationKey2019","publicKeyJwk":{"kty":"EC","crv":"secp256k1","x":"WfY7Px6AgH6x-_dgAoRbg8weYRJA36ON-gQiFnETrqw","y":"IzFx3BUGztK0cyDStiunXbrZYYTtKbOUzx16SUK0sAY"}}],"authentication":["#someKeyId"]},"didDocumentMetadata":{"method":{"published":true,"recoveryCommitment":"EiDKYXZ2MkHRCYDVtXI7ONiTkTdVfs9Tnb-tDDHGXLzmOw","updateCommitment":"EiD0iz_RGtxHy2fxUuXot-fpJ7d0QSKUllwyqbwZB46RrQ"},"canonicalId":"did:ion:EiClkZMDxPKqC9c-umQfTkR8vvZ9JPhl_xLDI9Nfk38w5w"}}

Looks good!

So essentially I think I neglected to start IPFS after installing it via a package manager.

Thanks for your help thehenrytsai and nayuta-ueno!

thehenrytsai commented 3 years ago

Glad things are working for you now! I'm therefore closing this issue. Feel free to open new ones if you encounter any.