-
Notifications
You must be signed in to change notification settings - Fork 5
Trustchain Developer Notes
Sam Greenbury edited this page Jul 25, 2022
·
24 revisions
- Subscription:
MOSIP Development
- Subscription ID:
a8604fcd-7cc8-4801-a975-a4b777a179a4
- Resource group:
ION_group
- VM:
ION
TODO: note on how to start up VM on Azure portal. TODO: note that we remember to shut down VM in the evening. Recommended using tmux to get panes TODO: add image and
- Terminal/tmux
- VS code for editting documents
-
Login:
ssh ionuser@51.104.16.53
-
Start IPFS:
ipfs daemon
- Note: this hogs the shell
- Stop:
ipfs shutdown
-
Start Mongo DB:
sudo systemctl start mongod
- Check status:
sudo systemctl status mongod
- Stop:
sudo systemctl stop mongod
- Restart:
sudo systemctl restart mongod
- Check status:
-
Start Bitcoin core v0.20.1 (on testnet):
bitcoind -daemon
- Note:
bitcoind
is an alias for~/bitcoin/bitcoin-0.20.1/bin/bitcoind -conf=/data/bitcoin.conf -daemon
- Or to reindex (may take >1 hour):
bitcoind -conf=/data/bitcoin.conf -reindex-chainstate
- Check log:
tail -f /data/.bitcoin/testnet3/debug.log
- To check block height:
bitcoin-cli -getinfo
- NOTE: this also shows wallet balances
- Compare with the network: Testnet Explorer
- Stop:
bitcoin-cli stop
- Note:
bitcoin-cli
is an alias for~/bitcoin/bitcoin-0.20.1/bin/bitcoin-cli -conf=/data/bitcoin.conf
- Check which port bitcoind is listening on:
netstat -tulpn | grep 'bitcoind'
. Should be 18333 for testnet (8333 for mainnet).
- Note:
-
Temporary workaround for this upstream issue
- Nothing to do here (just a note). With a slightly modified
BitcoinClient.js
(see #379), and an updatedbitcoin.conf
to load thesidetreeDefaultWallet
wallet on startup to workaround theloadwallet
issue. - Can check with
bitcoin-cli listwallets
- Nothing to do here (just a note). With a slightly modified
-
Start the ION bitcoin service (hogs the shell)
cd ~/ion npm run bitcoin
- If you get an
ECONNREFUSED
error, make sure bitcoind has started and is listening on the expected port. - If the
loadwallet
jRPC call fails, see the comments in #379 (but the Temporary workaround above should avoid it). - Once this is successful, it is better to store on disk so you can retrieve the transaction hash for later check. E.g.:
npm run bitcoin >> .out_todays_date &
- If you get an
-
Start ION core service (hogs the shell)
cd ~/ion npm run core
The npm run core
and npm run bitcoin
must be started in this order.
-
Test by navigating here, or:
curl http://localhost:3000/identifiers/did:ion:test:EiClWZ1MnE8PHjH6y4e4nCKgtKnI1DK1foZiP61I86b6pw | json_pp
Note: This does not work from Turing wifi because the link is not https
Inside ~/ion
ion operation create
This yields something that looks like:
```text
DID: did:ion:EiDqmkY_CG6h9rudRXt94wuQJj8G69q32Kh1G9PbWJCnFw
Recovery private key saved as: EiDqmkY_CG6h9rudRXt94wuQJj8G69q32Kh1G9PbWJCnFw-RecoveryPrivateKey.json
Update private key saved as: EiDqmkY_CG6h9rudRXt94wuQJj8G69q32Kh1G9PbWJCnFw-UpdatePrivateKey.json
Signing private key saved as: EiDqmkY_CG6h9rudRXt94wuQJj8G69q32Kh1G9PbWJCnFw-SigningPrivateKey.json
Create request body:
{
"type": "create",
"suffixData": {
"deltaHash": "EiAABMUcyfJ7RszfEVS8h1BPnkBEL-4LsHTXr2-nmqf9Zg",
"recoveryCommitment": "EiCGw_hcyNgiInK8A6vnJYJizMDKTBUXqOUVHYXr1qO-FA"
},
"delta": {
"updateCommitment": "EiDi3RbRDGOvE0sqjc9vBVOEt2d9DNG-0dhbLfeilYm8Iw",
"patches": [
{
"action": "replace",
"document": {
"publicKeys": [
{
"id": "signing-key",
"type": "EcdsaSecp256k1VerificationKey2019",
"publicKeyJwk": {
"kty": "EC",
"crv": "secp256k1",
"x": "Fb0vramqPql8Rc3G2U0iVtOTwiD5NipNYxCIpWBfMDk",
"y": "M2krAHJnTdcXYQjBn9ydTM7YcMDJzv2NkAYt7ZCQito"
}
}
]
}
}
]
}
}
Long-form DID:
did:ion:EiDqmkY_CG6h9rudRXt94wuQJj8G69q32Kh1G9PbWJCnFw:eyJkZWx0YSI6eyJwYXRjaGVzIjpbeyJhY3Rpb24iOiJyZXBsYWNlIiwiZG9jdW1lbnQiOnsicHVibGljS2V5cyI6W3siaWQiOiJzaWduaW5nLWtleSIsInB1YmxpY0tleUp3ayI6eyJjcnYiOiJzZWNwMjU2azEiLCJrdHkiOiJFQyIsIngiOiJGYjB2cmFtcVBxbDhSYzNHMlUwaVZ0T1R3aUQ1TmlwTll4Q0lwV0JmTURrIiwieSI6Ik0ya3JBSEpuVGRjWFlRakJuOXlkVE03WWNNREp6djJOa0FZdDdaQ1FpdG8ifSwidHlwZSI6IkVjZHNhU2VjcDI1NmsxVmVyaWZpY2F0aW9uS2V5MjAxOSJ9XX19XSwidXBkYXRlQ29tbWl0bWVudCI6IkVpRGkzUmJSREdPdkUwc3FqYzl2QlZPRXQyZDlETkctMGRoYkxmZWlsWW04SXcifSwic3VmZml4RGF0YSI6eyJkZWx0YUhhc2giOiJFaUFBQk1VY3lmSjdSc3pmRVZTOGgxQlBua0JFTC00THNIVFhyMi1ubXFmOVpnIiwicmVjb3ZlcnlDb21taXRtZW50IjoiRWlDR3dfaGN5TmdpSW5LOEE2dm5KWUppek1ES1RCVVhxT1VWSFlYcjFxTy1GQSJ9fQ
DID suffix data:
{
"deltaHash": "EiAABMUcyfJ7RszfEVS8h1BPnkBEL-4LsHTXr2-nmqf9Zg",
"recoveryCommitment": "EiCGw_hcyNgiInK8A6vnJYJizMDKTBUXqOUVHYXr1qO-FA"
}
Document delta:
{
"updateCommitment": "EiDi3RbRDGOvE0sqjc9vBVOEt2d9DNG-0dhbLfeilYm8Iw",
"patches": [
{
"action": "replace",
"document": {
"publicKeys": [
{
"id": "signing-key",
"type": "EcdsaSecp256k1VerificationKey2019",
"publicKeyJwk": {
"kty": "EC",
"crv": "secp256k1",
"x": "Fb0vramqPql8Rc3G2U0iVtOTwiD5NipNYxCIpWBfMDk",
"y": "M2krAHJnTdcXYQjBn9ydTM7YcMDJzv2NkAYt7ZCQito"
}
}
]
}
}
]
}
This file can be redirected instead:
ion operation create > ~/ion/test_publish/create-request-body
- To publish the DID, you take the request body:
{
"type": "create",
"suffixData": {
"deltaHash": "EiAzt3kr6iE8iOSyrrnHEEvqTwA9L0G5TyHyKWXU_MY67w",
"recoveryCommitment": "EiDqu1V9O2cjj2ibwXtdHvQqztMOorLgLPL-3pPSIpuz-A"
},
"delta": {
"updateCommitment": "EiAswFCC0u_7dPm9vNPMtx-ASXFwbt6GK3lz5Y_zPKFt8g",
"patches": [
{
"action": "replace",
"document": {
"publicKeys": [
{
"id": "signing-key",
"type": "EcdsaSecp256k1VerificationKey2019",
"publicKeyJwk": {
"kty": "EC",
"crv": "secp256k1",
"x": "_NseShHvFIyA43uKX9F5_ybr5bDLo0bqZd-x1lhYk7g",
"y": "rvgBvMmzGh350_YTr5UxHpCaTskymdtLfXkb53EM3Dk"
}
}
]
}
}
]
}
}
and write it to a file:
~/ion/test_publish/request-body-EiAzt3kr6iE8iOSyrrnHEEvqTwA9L0G5TyHyKWXU_MY67w.json
- Now post the content of the new DID using curl:
curl --tr-encoding -X POST -v -# -o output -T ~/ion/test_publish/request-body-EiAzt3kr6iE8iOSyrrnHEEvqTwA9L0G5TyHyKWXU_MY67w.json -H "Content-Type: application/json; charset=utf-8" http://localhost:3000/operations
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 3000 (#0)
> POST /operations HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.58.0
> Accept: */*
> Connection: TE
> TE: gzip
> Content-Type: application/json; charset=utf-8
> Content-Length: 788
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
} [788 bytes data]
* We are completely uploaded and fine
########################################################################### 100.0%< HTTP/1.1 200 OK
< Content-Type: application/json; charset=utf-8
< Content-Length: 824
< Date: Mon, 18 Jul 2022 14:15:32 GMT
< Connection: keep-alive
< Keep-Alive: timeout=5
<
{ [824 bytes data]
########################################################################### 100.0%* Connection #0 to host localhost left intact