본문 바로가기
열정/연구 일지

ION DID operation 및 resolution

by lime9 2024. 3. 15.

이전 포스팅에서는 ION 환경을 구축하였다. 이번에는 이를 사용하여 DID를 만들어 볼 예정이다.

 

 


 

 

1. DID Operation

ION의 CLI를 사용하여 DID를 만들 것이다. 이전에 먼저 Testnet Bitcoin을 얻어야 한다. Bitcoin의 blockchain으로 앵커링을 하는데 수수료가 필요하여 faucet으로 testnet bitcoin을 송금 받는다. sidetreeDefaultWallet의 주소로 송금하면 된다.

 

주소를 모르겠으면 다음의 명령어를 통해 받아올 수 있다.

./bin/bitcoin-cli getaddressesbylabel "sidetreeDefaultWallet"

 

만약 주소가 없다는 에러가 뜬다면 다음 명령어를 통해 새로 생성하자.

./bin/bitcoin-cli getnewaddress "sidetreeDefaultWallet"

sidetreeDefaultWallet의 주소 받기

 

Bitcoin을 받아오는 사이트는 아래에 있다. 이 중 하나를 선택하여 내 주소로 bitcoin을 송금하자.

https://bitcoinfaucet.uo1.net/

 

Bitcoin Testnet Faucet

Send coins --> Send testnet bitcoins

bitcoinfaucet.uo1.net

 

 

https://cryptopump.info/

 

Get Testnet Bitcoins | Cryptopump Bitcoin Testnet Faucet

If you find our service useful, consider sending bitcoins back to our donation address when You're done with them. Privacy notice: We store your IP address to prevent abuse of our service. Your IP address is: 27.0.238.114

cryptopump.info

 

https://kuttler.eu/en/bitcoin/btc/faucet/

 

Bitcoin Testnet Faucet – Nicolas Kuttler

Bitcoin Testnet Faucet Using the Faucet Please submit only one request! Coins are usually sent out daily, but there can be delays. If you are a developer you might also be interested in the -regtest option or in running a private bitcoin testnet that's eas

kuttler.eu

 

https://testnet.help/ru/btcfaucet/testnet

 

Bitcoin Testnet Faucet

Bitcoin Testnet Faucet

testnet.help

 

https://coinfaucet.eu/en/btc-testnet/

 

 

Send testnet bitcoins를 눌러주면...

 

Transaction이 완료되었다는 안내가 뜬다! 그러면 성공적으로 bitcoin이 sidetreeDefaultWallet으로 들어갔을 것이다. 자, 이제 송금을 완료했으니 ION CLI를 깔아준다.

cd ion
sudo npm isntall -g .

 

성공적으로 설치하면 다음의 명령을 통해 DID 작성을 위한 payload를 작성한다. 그러면 JSON 파일이 생성된다.

ion operation create

payload 작성

 

맨 위에는 ION 방식으로 제작된 DID가 있고, 중간에 Long-form DID가 출력되어 있다. 몇 번 헤맸는데, 이 Long-form DID를 사용해야 제대로 DID 문서를 resolve할 수 있다. Long-form DID를 copy하자.

 

 

2. DID Resolution

Long-form DID를 copy한 다음 HTTP 형식으로 만들어줘야 한다. testnet이므로 다음의 형식을 따라 작성해주면 된다.

http://localhost:3000/identifiers/did:ion:test:[copy한 DID에서 앞의 prefix인 did:ion:은 제거한 부분을 입력]

 

해당 HTTP URL을 GET을 통해 확인해보자.

GET [방금 만든 HTTP URL]

분리되는 부분이 없어 잘 안 보이는데, JSON 파일이 출력되었다. 직접 브라우저를 통해 들어가보자!

똑같은 링크를 브라우저에 복사하여 열어보자.

JSON 형식
Headers

좀 더 보기 좋게 DID 문서를 확인할 수 있다.

 

또한, ION 사이트의 Network explorer에서도 확인할 수 있다. 이때에는 HTTP URL형식이 아닌 Long-form DID를 그대로 복사하여 붙여주면 된다.

[ION Network Explorer] https://identity.foundation/ion/explorer/

 

ION - an open, public, permissionless decentralized identifier network

Search the ION network for DIDs to discover their keys and endpoints This DID couldn't be resolved, search for another DID or try again later. DID Document Linked Domains Copy to Clipboard

identity.foundation

 

좀 더 깔끔하고 보기 좋게 출력된다.

ION Network Explorer 버전

 

어렵긴 했지만 그래도 이렇게 DID를 직접 생성하고, resolve도 해볼 수 있게 되어 다행이다...!

 

 


 

 

참고 문헌

https://tsmatz.wordpress.com/2020/09/01/did-sidetree-ion/

 

Run ION (Sidetree), Decentralized Identifier (DID) Network

In this post, I show you how Sidetree DID network runs on decentralized technology stacks through ION implementation.

tsmatz.wordpress.com

 

https://chike0905.hatenablog.com/entry/2022/01/11/134205

 

IONをBitcoin Testnet上で動かす - chike0905の日記

本稿はDIDの一実装であるIONをBitcoin Testnet上で動かしたメモである。 ION/Sidetree/IPFS共に実装がそれぞれまだ変更が激しく、本稿の記述は2022.01.11時点の内容である。 構築環境 Debian 10 Bitcoin Core v2

chike0905.hatenablog.com