-
Notifications
You must be signed in to change notification settings - Fork 20
reshare workflow
haijuncai edited this page Aug 28, 2022
·
6 revisions
- example: 9fffdd35e5570f1a14d9b091a4d81c8fe9750536f6b8e5b9ab9591d8d75f4248b14b49f4a2be2b285a7f5155085b92d5fbdedfcf877492d038039555d93bbd8f
./build/bin/gsmpc-client -cmd SetGroup -url http://127.0.0.1:5871 -ts 3/5 -node http://127.0.0.1:5871 -node http://127.0.0.1:5872 -node http://127.0.0.1:5873 -node http://127.0.0.1:5874 -node http://127.0.0.1:5875
./build/bin/gsmpc-client -cmd EnodeSig -url http://127.0.0.1:5871 --keystore
~/Downloads/UTC--2018-10-11T01-26-58.462416324Z--3a1b3b81ed061581558a81f11d63e03129347437 --passwdfile ~/Downloads/passwdfile1
./build/bin/gsmpc-client -cmd EnodeSig -url http://127.0.0.1:5872 --keystore
~/Downloads/UTC--2019-03-11T08-42-59.809814178Z--a0f15f85b7a24b66f1d682b7244242093ec4430d --passwdfile ~/Downloads/passwdfile2
./build/bin/gsmpc-client -cmd EnodeSig -url http://127.0.0.1:5873 --keystore
~/Downloads/UTC--2019-03-11T06-23-44.238608862Z--ecf880e334de65cd32a63b7b7567797ed707583b --passwdfile ~/Downloads/passwdfile3
./build/bin/gsmpc-client -cmd EnodeSig -url http://127.0.0.1:5874 --keystore
~/Downloads/UTC--2019-03-11T06-20-19.810771134Z--88525df23a7f1b3b549bcfd997ce8160ac7976a9 --passwdfile ~/Downloads/passwdfile4
./build/bin/gsmpc-client -cmd EnodeSig -url http://127.0.0.1:5875 --keystore
~/Downloads/UTC--2018-10-12T11-33-28.769681948Z--0963a18ea497b7724340fdfe4ff6e060d3f9e388 --passwdfile ~/Downloads/passwdfile5
- sig: the signature enode of 1, 2, 3, 4, 5,
- gid: the group id of 1, 2, 3, 4, 5
./build/bin/gsmpc-client -cmd REQSMPCADDR --keystore ~/Downloads/UTC--2018-10-11T01-26-58.462416324Z--3a1b3b81ed061581558a81f11d63e03129347437 --passwdfile ~/Downloads/passwdfile1 -ts 3/5 -gid 9fffdd35e5570f1a14d9b091a4d81c8fe9750536f6b8e5b9ab9591d8d75f4248b14b49f4a2be2b285a7f5155085b92d5fbdedfcf877492d038039555d93bbd8f -mode 0 -url http://127.0.0.1:5871 --keytype EC256K1 -sig enode://524da89d8bd8f051e9b24660941e772f60e2e7a4ab0c48d1671ecfb9844e9cf1f0a9ef697be8118fe7bc9f2782a5a2bad912856bcb3a4dfda0aafcbdc9c282af@127.0.0.1:485410xe959a7de8ad34d8662c993d850de8fc7fcf48a201f95c04861baac72f5e0d44c384f7bf58f011f9525c1ba216e28dac02f98c1c797a0b422a6eb33f54bd9e33001 -sig enode://8908863d56914eaa420afca83f43206f65ff56e42faeecb9e24f77740838819313f789bf7c4941b162e696147df409e47eb95ea351eac016ce8b7bf38fd269b2@127.0.0.1:485420xca2ffe89d3a143be76f86b22e255720c98f56ecf313eab6e9e26b12b9d3ca1b04131e21d3490dafcec6c3a0614173e161939bf0dd682e47201ceb103e3024d9000 -sig enode://ee10b450a564e9cda30b37b9497a11ede5583e8964ba01ae85bbba7b421e403b1ab710f87d5b93c700ca459661b889412b9d781fbef8094ee282b46f4a90508b@127.0.0.1:485430xbcef37a181ccde32172539d2cda69811dacb6929748a269b8116a01b865beb356ff49ca53c04897b88d4a42caa0d3dc0f2b5d07726ca7478478aaaeecac3d76a00 -sig enode://785708c037dcb3527075fe85797e5997c33202508daaa8ee45e99f73121047f3bb3dd2662ce5f0bb9b8e83cd2e56b3d99d2156433fef5185f66d2bb21d944e25@127.0.0.1:485440xaf7c6bbc6fe7b66bce2aeb436eef77f8c4d0ed882a3b3606abf960b9927955977564e71b04fd60828005c623173ec5b35855c48ebfd10f4b587dba7f3a1fd92f00 -sig enode://730c8fc7142d15669e8329138953d9484fd4cce0c690e35e105a9714deb741f10b52be1c5d49eeeb6f00aab8f3d2dec4e3352d0bf56bdbc2d86cb5f89c8e90d0@127.0.0.1:485450x74a089ea6ab94e978d87d4d791ff2b9cc3c370785124ac3548b8b5ad2a714f5308b6f7f35bf12021d1679911057e1f2ed39ff12653356af280e3cd1517b878ad00
- key is the unique ID of this request command and is obtained in step 3.
./build/bin/gsmpc-client -cmd ACCEPTREQADDR -url http://127.0.0.1:5871 --keystore ~/Downloads/UTC--2018-10-11T01-26-58.462416324Z--3a1b3b81ed061581558a81f11d63e03129347437 --passwdfile ~/Downloads/passwdfile1 -key 0x99eb5c871ce7dc1a2dfd22339c9266894b3fb7aebe2e7a97a6db16b7f2b0e095
./build/bin/gsmpc-client -cmd ACCEPTREQADDR -url http://127.0.0.1:5872 --keystore ~/Downloads/UTC--2019-03-11T08-42-59.809814178Z--a0f15f85b7a24b66f1d682b7244242093ec4430d --passwdfile ~/Downloads/passwdfile2 -key 0x99eb5c871ce7dc1a2dfd22339c9266894b3fb7aebe2e7a97a6db16b7f2b0e095
./build/bin/gsmpc-client -cmd ACCEPTREQADDR -url http://127.0.0.1:5873 --keystore ~/Downloads/UTC--2019-03-11T06-23-44.238608862Z--ecf880e334de65cd32a63b7b7567797ed707583b --passwdfile ~/Downloads/passwdfile3 -key 0x99eb5c871ce7dc1a2dfd22339c9266894b3fb7aebe2e7a97a6db16b7f2b0e095
./build/bin/gsmpc-client -cmd ACCEPTREQADDR -url http://127.0.0.1:5874 --keystore ~/Downloads/UTC--2019-03-11T06-20-19.810771134Z--88525df23a7f1b3b549bcfd997ce8160ac7976a9 --passwdfile ~/Downloads/passwdfile4 -key 0x99eb5c871ce7dc1a2dfd22339c9266894b3fb7aebe2e7a97a6db16b7f2b0e095
./build/bin/gsmpc-client -cmd ACCEPTREQADDR -url http://127.0.0.1:5875 --keystore ~/Downloads/UTC--2018-10-12T11-33-28.769681948Z--0963a18ea497b7724340fdfe4ff6e060d3f9e388 --passwdfile ~/Downloads/passwdfile5 -key 0x99eb5c871ce7dc1a2dfd22339c9266894b3fb7aebe2e7a97a6db16b7f2b0e095
curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"smpc_getReqAddrStatus","params":["0x99eb5c871ce7dc1a2dfd22339c9266894b3fb7aebe2e7a97a6db16b7f2b0e095"],"id":67}' http://127.0.0.1:5871
Let's say node 5 is deleted.(Suppose enodeId of node 5 is XXX, then find the dcrmdbXXX and skXXX folders in ~/.Anyswap-MPCNode/dcrmdata/ or the path specified by datadir parameter when gsmpc startup and delete them)
Now node 5 is to be replaced with node 6, and suppose node 1, 2, 3 (the threshold is 3/5) is involved to perform the reshare procedure.
- get group id of node 1,2,3,4,6 and get subgroup id of node 1,2,3.At the end of this step, it returns the group id of 1, 2, 3, 4, 6 and subgroup id of 1,2,3.
- the second parameter is an array of 1,2,3,4,6 node enodes.
- the 1,2,3 nodes participating in the reshare are the first three of the array in turn,... and so on.
curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"smpc_reshareGroup","params":["3/5", ["enode://b09164962e543bf450d14b7cd75be26c04b972be3a21efbfc1c755e7afba1b2f357e8564fc512ffe800fce3ac2bff7eff7e9641c40700f74fae12b4c35fb200f@127.0.0.1:5871","enode://851b80b7fab4dd829cc96a4cc3f48618e72ee0d7d241136b20853636a99fa17b708c8ef988ba9b2bc9d887b5ca30eb22589b5d76064eeeb459f0f2a17fcfdbcb@127.0.0.1:5872","enode://42dd79aa38dc7329af9c27578ce447496b844ceae0e95878b9577fc29b157ade4d0e7052071c9c25f70238bec091a1793d02e4b94bd2d9836c855fbb007d0712@127.0.0.1:5873","enode://8ec627b2369b828426b10decfe42d3b3f4158970aeb337fcd1e6347e0de45d11f8f0288fb32f01b45a6c3e95389639c5ed657e617b93e848b3a8533f7ff6c19b@127.0.0.1:5874","enode://dfc1a09104d63734ddbb8a7a5e2d7b73888767bb4f4b596b12e3f9603b32bc3b04afaaceb28b8fdb0fa126a5422b9fc4b1c6de69e331d6d3c882cab5465505b1@127.0.0.1:5876"]],"id":67}' http://127.0.0.1:5871
./build/bin/gsmpc-client -cmd EnodeSig -url http://127.0.0.1:5871 --keystore
~/Downloads/UTC--2018-10-11T01-26-58.462416324Z--3a1b3b81ed061581558a81f11d63e03129347437 --passwdfile ~/Downloads/passwdfile1
./build/bin/gsmpc-client -cmd EnodeSig -url http://127.0.0.1:5872 --keystore
~/Downloads/UTC--2019-03-11T08-42-59.809814178Z--a0f15f85b7a24b66f1d682b7244242093ec4430d --passwdfile ~/Downloads/passwdfile2
./build/bin/gsmpc-client -cmd EnodeSig -url http://127.0.0.1:5873 --keystore
~/Downloads/UTC--2019-03-11T06-23-44.238608862Z--ecf880e334de65cd32a63b7b7567797ed707583b --passwdfile ~/Downloads/passwdfile3
./build/bin/gsmpc-client -cmd EnodeSig -url http://127.0.0.1:5874 --keystore
~/Downloads/UTC--2019-03-11T06-20-19.810771134Z--88525df23a7f1b3b549bcfd997ce8160ac7976a9 --passwdfile ~/Downloads/passwdfile4
./build/bin/gsmpc-client -cmd EnodeSig -url http://127.0.0.1:5876 --keystore
~/Downloads/UTC--2018-10-12T11-33-28.357681948Z--1863a18ea497b7724ac7976a9ff6e060d3f9e3a1 --passwdfile ~/Downloads/passwdfile6
- keystore: must be specified, must be the same as the initiator keystore when applying for the shared management mode public key.
- sig: parameter must be added with the signature enode of 1, 2, 3, 4, 6
- mode: must be specified. Must be consistent with step 3.
- gid: the group id of 1, 2, 3, 4, 6
- tsgid: the subgroup id of 1, 2, 3
- pubkey: the public key to be reshared,obtained in step 5.
- pkey: the private key value in the node key file of the node that initiated the reshare. Obtained from the file specified by the nodekey parameter.
./build/bin/gsmpc-client -cmd RESHARE -url http://127.0.0.1:5871 --keystore ~/Downloads/UTC--2018-10-11T01-26-58.462416324Z--3a1b3b81ed061581558a81f11d63e03129347437 --passwdfile ~/Downloads/passwdfile1 -ts 3/5 -gid e38b3cf6b7304bb161b2631ed07b370b1c1783773f668b168703c17fe3846835341380706b31236e39eea2995f1a715fba4ab5cb89ec639a48031c6d8292381b -tsgid ff236d457ccc2a8c474871f7c4129a8d24b13160bc74d824b5027d762dd5c6f6218e53af8c47a82d4cd03f736f44b3a0153067ba2fa189225578aba80f052cdf -pkey f890dcb995db0c89e1d7c2c1f6506c9dbe7e61e1be0987838024f63c89e80676 -pubkey 04e7d9c1d7a2e1354d8f0f0b9dc99ecbf7a7a040067d93fe54455c793b1a9bf0c23e6802ef5f6c40afa675833eb25ea125603d0af58ca702145dbecdebcc263141 -mode 0 -keytype EC256K1 -sig enode://b09164962e543bf450d14b7cd75be26c04b972be3a21efbfc1c755e7afba1b2f357e8564fc512ffe800fce3ac2bff7eff7e9641c40700f74fae12b4c35fb200f@127.0.0.1:485410xe9530ac1685d98a36845b514255431f64264d4b68a4d4cca61f96e8a715dddae023c526affc3550b8b0c6a1988db43092abb3fc3e1fb42e2a78262c7edf215a600 -sig enode://851b80b7fab4dd829cc96a4cc3f48618e72ee0d7d241136b20853636a99fa17b708c8ef988ba9b2bc9d887b5ca30eb22589b5d76064eeeb459f0f2a17fcfdbcb@127.0.0.1:485420x946861da00e3f7f937de446577fca83c4d8b8a5a1f23ebc4f8dcd8a8724ebb62729eca4a3afe9c3a6a6e17bf3cfec4d06d9f329fa7542998637697e0717d807d00 -sig enode://42dd79aa38dc7329af9c27578ce447496b844ceae0e95878b9577fc29b157ade4d0e7052071c9c25f70238bec091a1793d02e4b94bd2d9836c855fbb007d0712@127.0.0.1:485430xc835187906f5a9ed4c3e65b6cf1597abe1b76e6494aacac33b658d648968056f470fe18071b69b8ca699b5bdfe462aeff1ffea1eac8379b904ba106f5b23a59601 -sig enode://8ec627b2369b828426b10decfe42d3b3f4158970aeb337fcd1e6347e0de45d11f8f0288fb32f01b45a6c3e95389639c5ed657e617b93e848b3a8533f7ff6c19b@127.0.0.1:485440xb5bb3fbc034ac29f8cd594322c82cb714b7c850adc808211bab5d23518e60b6a0fcda9e8f2a4d2685a11ce9af47841eef51efc07d845bdade7455d08403a317801 -sig enode://dfc1a09104d63734ddbb8a7a5e2d7b73888767bb4f4b596b12e3f9603b32bc3b04afaaceb28b8fdb0fa126a5422b9fc4b1c6de69e331d6d3c882cab5465505b1@127.0.0.1:485460x2f732f059e441afc73634a0274b42ed8d813c9faaddf6cc5933454b9cc9b083747486d22c8c14ac70b47271ef89371e8a0678a849aa5d8fa0457081f165eb85700
- pkey: the private key value in the node key file of the node that initiated the reshare. Obtained from the file specified by the nodekey parameter.
./build/bin/gsmpc-client -cmd ACCEPTRESHARE -url http://127.0.0.1:5871 -pkey f890dcb995db0c89e1d7c2c1f6506c9dbe7e61e1be0987838024f63c89e80676
./build/bin/gsmpc-client -cmd ACCEPTRESHARE -url http://127.0.0.1:5872 -pkey 136a5947d826620eab2ba834f555b1328f8c6c6c00a2287fa0661f9175c7ca0b
./build/bin/gsmpc-client -cmd ACCEPTRESHARE -url http://127.0.0.1:5873 -pkey a4b1cc38b7984a7ec9ec886ca8690f65c403c35974516c219820f7c93a08d4c0
./build/bin/gsmpc-client -cmd ACCEPTRESHARE -url http://127.0.0.1:5874 -pkey a6ee042f106cdde5c916095946d83abeb03b174b5e319ab83cfdea9ea22f58e8
./build/bin/gsmpc-client -cmd ACCEPTRESHARE -url http://127.0.0.1:5876 -pkey 2a60fd8358a69b92c2ca7e7edf37c6e34588e3d698867d57b0f0e1ac6740a9cc
11. Let node 6 participate in sign to see weather they can sign normally. If yes, it means that the reshare is successful.
- select node 1,2,6 as example.
- first, get the subgroup id of node 1,2,6. Example: aa8bc205d12725f1addef022a698b9bab0b99c9a471ec4a4ff3031ae075e4c33ea4f4021686b064bcf19868dd60079f8ec20b035701b57faa0ee299e6c02dbd2
./build/bin/gsmpc-client -cmd SetGroup -url http://127.0.0.1:5871 -ts 3/5 -node http://127.0.0.1:5871 -node http://127.0.0.1:5872 -node http://127.0.0.1:5876
./build/bin/gsmpc-client -cmd SIGN -ts 3/5 --keystore ~/Downloads/UTC--2018-10-11T01-26-58.462416324Z--3a1b3b81ed061581558a81f11d63e03129347437 --passwdfile ~/Downloads/passwdfile1 -gid aa8bc205d12725f1addef022a698b9bab0b99c9a471ec4a4ff3031ae075e4c33ea4f4021686b064bcf19868dd60079f8ec20b035701b57faa0ee299e6c02dbd2 -mode 0 -url http://127.0.0.1:5871 --keytype EC256K1 -pubkey 04e7d9c1d7a2e1354d8f0f0b9dc99ecbf7a7a040067d93fe54455c793b1a9bf0c23e6802ef5f6c40afa675833eb25ea125603d0af58ca702145dbecdebcc263141 -msghash 0x90e032be062dd0dc689fa23df8c044936a2478cb602b292c7397354238a67d88 -msgcontext '{"swapInfo":{"swapid":"0x4f62545cdd05cc346c75bb42f685a18a02621e91512e0806eac528d0b2f6aa5f","swaptype":1,"bind":"0x0520e8e5e08169c4dbc1580dc9bf56638532773a","identifier":"ssUSDT2FSN"},"extra":{"ethExtra":{"gas":90000,"gasPrice":1000000000,"nonce":1}}}'
- key is the unique ID of this sign request command and is obtained in step 11.
./build/bin/gsmpc-client -cmd ACCEPTSIGN -url http://127.0.0.1:5871 --keystore ~/Downloads/UTC--2018-10-11T01-26-58.462416324Z--3a1b3b81ed061581558a81f11d63e03129347437 --passwdfile ~/Downloads/passwdfile1 -key 0xa60365401eab5069154730cd80f00c568ab6295a0537ac1baf855c0291523c9a
./build/bin/gsmpc-client -cmd ACCEPTSIGN -url http://127.0.0.1:5872 --keystore
~/Downloads/UTC--2019-03-11T08-42-59.809814178Z--a0f15f85b7a24b66f1d682b7244242093ec4430d --passwdfile ~/Downloads/passwdfile2 -key 0xa60365401eab5069154730cd80f00c568ab6295a0537ac1baf855c0291523c9a
./build/bin/gsmpc-client -cmd ACCEPTSIGN -url http://127.0.0.1:5876 --keystore
~/Downloads/UTC--2018-10-12T11-33-28.357681948Z--1863a18ea497b7724ac7976a9ff6e060d3f9e3a1 --passwdfile ~/Downloads/passwdfile6 -key 0xa60365401eab5069154730cd80f00c568ab6295a0537ac1baf855c0291523c9a
curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"smpc_getSignStatus","params":["0xa60365401eab5069154730cd80f00c568ab6295a0537ac1baf855c0291523c9a"],"id":67}' http://127.0.0.1:5871