Generate DID in ION SIDETREE testnet

270 Views Asked by At

I have succeeded deploy the ION SIDETREE testnet.

I followed this install instruction. But when I created DID, it returned DID for mainnet.

I don't know where it's wrong.

Here is my configuration:

Step 1: I run bitcoin with this command:

root@ion:~/bitcoin-0.20.1# ./bin/bitcoind -testnet -rpcuser=admin -rpcpassword=admin -fallbackfee=0.0002 -txindex=1 -server

And here is the output log enter image description here Step 2: I config ION Sidetree

Here is my configuration:

root@ion:~/ion/json# cat testnet-bitcoin-config.json
{
   "bitcoinDataDirectory": "/root/.bitcoin/testnet3",
   "bitcoinFeeSpendingCutoffPeriodInBlocks": 1,
   "bitcoinFeeSpendingCutoff": 0.001,
   "bitcoinPeerUri": "http://localhost:18332",
   "bitcoinRpcUsername": "admin",
   "bitcoinRpcPassword": "admin",
   "bitcoinWalletOrImportString": "cMj4VE3WyJt6RAQVGboDATFQ6YAVKo6fCVXw7oKuSpaAfNJqCuV1",
   "databaseName": "ion-testnet-bitcoin",
   "genesisBlockNumber": 1900000,
   "logRequestError": true,
   "mongoDbConnectionString": "mongodb://127.0.0.1:27017/",
   "port": 3002,
   "sidetreeTransactionFeeMarkupPercentage": 1,
   "sidetreeTransactionPrefix": "ion:test",
   "transactionPollPeriodInSeconds": 60,
   "valueTimeLockUpdateEnabled": false,
   "valueTimeLockAmountInBitcoins": 0,
   "valueTimeLockPollPeriodInSeconds": 600,
   "valueTimeLockTransactionFeesAmountInBitcoins": 0.0001
}

And

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

Step 3: I run bitcoin

root@ion:~/ion# npm install
root@ion:~/ion/json# npm run build
root@ion:~/ion/json# npm run bitcoin

And here is the output log

enter image description here

Step 4: I run core

root@ion:~/ion# npm run core

And here is the output log

enter image description here

Step 5: I build ION

root@ion:~# cd ion/
root@ion:~/ion# npm install
root@ion:~/ion# npm run build
root@ion:~/ion# npm install -g .

Step 6: I generate DID

root@ion:~/ion# ion operation create

Here is the output log

enter image description here

Here is my problem, I don't know why I am running testnet but it created DID as mainnet. So, when I resolved DID, it proved this error enter image description here

Thank you.

1

There are 1 best solutions below

0
On BEST ANSWER

But when I use command "ion operation create"...

The CLI is completely experimental (as it is using a test library) and on development pause since last year, we did not anticipate anyone would know about it since we didn't advertise it on front page, but I have just opened a PR to make it use the ION SDK instead, it should be merged soon, I am not sure if it was working before my PR (probably was), but it should definitely work now.

That DID belongs to mainet.

The CLI was written with the assumption that it targets mainnet. But it is fine, the request will work perfectly fine against the testnet. The test: prefix in the DID string is purely cosmetic for the most part.

But with my DID (generate by myself), it shows this error

Since you are testing testnet DIDs and your node is setup as such ("didMethodName": "ion:test", seen in your config above), you must therefore prefix your unique DID suffix string with did:ion:test:<unique_suffix>, you didn't in your screenshot, hence the error. I hope this makes sense. The error message you are seeing in the screenshot also says exactly that.

Step 3: I resolve with DID "did:ion:test:EiC3YoSodQ20tJcgKjLXr65BHr2KwnQWsUnm3VOiYUFMeA", but It proved "not found"

ION DID tool should work. Sanity: assuming you've setup the node to be able to write, did you wait for that transaction to be confirmed? You can check by checking the transaction hash that is printed out when batch writer kicks in every 10 minutes (based on your conifg "batchingIntervalInSeconds": 600,). Even though the post request immediately returns a DID Document, that is just for your convenience to know that 1. the node accepted your request and queues it, and 2. shows what your DID Document will look like once it is confirmed, purely for your convenience. But we all know bitcoin transactions takes a while to confirm, especially on testnet, where the confirmation time is less predictable.