Skip to content

Commit

Permalink
test: working multisig join script
Browse files Browse the repository at this point in the history
  • Loading branch information
kentbull committed May 13, 2024
1 parent fa91970 commit 4f44b98
Show file tree
Hide file tree
Showing 11 changed files with 896 additions and 26 deletions.
104 changes: 83 additions & 21 deletions scripts/demo/basic/multisig-join.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,58 +4,120 @@
# To run the following scripts, open another console window and run:
# $ kli witness demo

kli init --name multisigj1 --salt 0ACDEyMzQ1Njc4OWxtbm9aBc --nopasscode --config-dir "${KERI_SCRIPT_DIR}" --config-file demo-witness-oobis
kli incept --name multisigj1 --alias multisigj1 --file ${KERI_DEMO_SCRIPT_DIR}/data/multisig-1-sample.json

kli init --name multisigj2 --salt 0ACDEyMzQ1Njc4OWdoaWpsaw --nopasscode --config-dir "${KERI_SCRIPT_DIR}" --config-file demo-witness-oobis
kli incept --name multisigj2 --alias multisigj2 --file ${KERI_DEMO_SCRIPT_DIR}/data/multisig-2-sample.json

kli oobi resolve --name multisigj1 --oobi-alias multisigj2 --oobi http://127.0.0.1:5642/oobi/EKJ6tNVUGbdaiwx2nWDCFXG-_PY_AzESOcoKlm0kRNP3/witness/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha
kli oobi resolve --name multisigj2 --oobi-alias multisigj1 --oobi http://127.0.0.1:5642/oobi/EFY7MixHb0so4WFFHw6btOPc5qeeWfPm7v5MJWcdcbyG/witness/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha
# EFY7MixHb0so4WFFHw6btOPc5qeeWfPm7v5MJWcdcbyG
MS1=EFY7MixHb0so4WFFHw6btOPc5qeeWfPm7v5MJWcdcbyG
kli init --name multisigj1 --salt 0ACDEyMzQ1Njc4OWxtbm9aBc \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--config-dir "${KERI_SCRIPT_DIR}" --config-file demo-witness-oobis
kli incept --name multisigj1 --alias multisigj1 \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--file ${KERI_DEMO_SCRIPT_DIR}/data/multisig-1-sample.json

# EKJ6tNVUGbdaiwx2nWDCFXG-_PY_AzESOcoKlm0kRNP3
MS2=EKJ6tNVUGbdaiwx2nWDCFXG-_PY_AzESOcoKlm0kRNP3
kli init --name multisigj2 --salt 0ACDEyMzQ1Njc4OWdoaWpsaw \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--config-dir "${KERI_SCRIPT_DIR}" --config-file demo-witness-oobis
kli incept --name multisigj2 --alias multisigj2 \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--file ${KERI_DEMO_SCRIPT_DIR}/data/multisig-2-sample.json

# EKxxKVNmC3M_u3eDF6Nw6MjRlRx1s_9Y-DV234UtkqAF
MS3=EKxxKVNmC3M_u3eDF6Nw6MjRlRx1s_9Y-DV234UtkqAF
kli init --name multisigj3 --salt 0ADR4R9kW_3ZvbwWGnA5YVah \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--config-dir "${KERI_SCRIPT_DIR}" --config-file demo-witness-oobis
kli incept --name multisigj3 --alias multisigj3\
--passcode "DoB26Fj4x9LboAFWJra17O" \
--file ${KERI_DEMO_SCRIPT_DIR}/data/multisig-3-sample.json

kli oobi resolve --name multisigj1 --oobi-alias multisigj2 \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--oobi http://127.0.0.1:5642/oobi/$MS2/witness/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha
kli oobi resolve --name multisigj1 --oobi-alias multisigj3 \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--oobi http://127.0.0.1:5642/oobi/$MS3/witness/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha
kli oobi resolve --name multisigj2 --oobi-alias multisigj1 \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--oobi http://127.0.0.1:5642/oobi/$MS1/witness/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha
kli oobi resolve --name multisigj2 --oobi-alias multisigj3 \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--oobi http://127.0.0.1:5642/oobi/$MS3/witness/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha
kli oobi resolve --name multisigj3 --oobi-alias multisigj2 \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--oobi http://127.0.0.1:5642/oobi/$MS2/witness/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha
kli oobi resolve --name multisigj3 --oobi-alias multisigj1 \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--oobi http://127.0.0.1:5642/oobi/$MS1/witness/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha

PID_LIST=""

kli multisig incept --name multisigj1 --alias multisigj1 --group multisig --file ${KERI_DEMO_SCRIPT_DIR}/data/multisig-join-sample.json &
kli multisig incept --name multisigj1 --alias multisigj1 --group multisig \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--file ${KERI_DEMO_SCRIPT_DIR}/data/multisig-join-sample.json &
pid=$!
PID_LIST+=" $pid"

kli multisig join --name multisigj2 --passcode "DoB26Fj4x9LboAFWJra17O" --auto &
pid=$!
PID_LIST+=" $pid"

kli multisig join --name multisigj2 --auto &
kli multisig join --name multisigj3 --passcode "DoB26Fj4x9LboAFWJra17O" --auto &
pid=$!
PID_LIST+=" $pid"

wait $PID_LIST

kli status --name multisigj1 --alias multisig
kli status --name multisigj1 --alias multisig --passcode "DoB26Fj4x9LboAFWJra17O"

kli rotate --name multisigj1 --alias multisigj1 --passcode "DoB26Fj4x9LboAFWJra17O"
kli rotate --name multisigj2 --alias multisigj2 --passcode "DoB26Fj4x9LboAFWJra17O"
kli rotate --name multisigj3 --alias multisigj3 --passcode "DoB26Fj4x9LboAFWJra17O"

kli rotate --name multisigj1 --alias multisigj1
kli query --name multisigj2 --alias multisigj2 --prefix EFY7MixHb0so4WFFHw6btOPc5qeeWfPm7v5MJWcdcbyG
kli rotate --name multisigj2 --alias multisigj2
kli query --name multisigj1 --alias multisigj1 --prefix EKJ6tNVUGbdaiwx2nWDCFXG-_PY_AzESOcoKlm0kRNP3
kli query --name multisigj1 --alias multisigj1 --prefix $MS2 --passcode "DoB26Fj4x9LboAFWJra17O"
kli query --name multisigj1 --alias multisigj1 --prefix $MS3 --passcode "DoB26Fj4x9LboAFWJra17O"
kli query --name multisigj2 --alias multisigj2 --prefix $MS1 --passcode "DoB26Fj4x9LboAFWJra17O"
kli query --name multisigj2 --alias multisigj2 --prefix $MS3 --passcode "DoB26Fj4x9LboAFWJra17O"
kli query --name multisigj3 --alias multisigj3 --prefix $MS1 --passcode "DoB26Fj4x9LboAFWJra17O"
kli query --name multisigj3 --alias multisigj3 --prefix $MS2 --passcode "DoB26Fj4x9LboAFWJra17O"

PID_LIST=""

kli multisig rotate --name multisigj1 --alias multisig --smids EKJ6tNVUGbdaiwx2nWDCFXG-_PY_AzESOcoKlm0kRNP3 --smids EFY7MixHb0so4WFFHw6btOPc5qeeWfPm7v5MJWcdcbyG --isith '["1/2", "1/2"]' --nsith '["1/2", "1/2"]' --rmids EKJ6tNVUGbdaiwx2nWDCFXG-_PY_AzESOcoKlm0kRNP3 --rmids EFY7MixHb0so4WFFHw6btOPc5qeeWfPm7v5MJWcdcbyG &
kli multisig rotate --name multisigj1 --alias multisig \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--smids $MS2 --smids $MS1 --smids $MS3 \
--isith '["1/2", "1/2", "1/2"]' \
--nsith '["1/2", "1/2", "1/2"]' \
--rmids $MS2 --rmids $MS1 --rmids $MS3 &
pid=$!
PID_LIST+=" $pid"

kli multisig join --name multisigj2 --auto &
kli multisig join --name multisigj2 --passcode "DoB26Fj4x9LboAFWJra17O" --auto &
pid=$!
PID_LIST+=" $pid"

kli multisig join --name multisigj3 --passcode "DoB26Fj4x9LboAFWJra17O" --auto &
pid=$!
PID_LIST+=" $pid"

wait $PID_LIST

kli status --name multisigj1 --alias multisig
kli status --name multisigj1 --alias multisig --passcode "DoB26Fj4x9LboAFWJra17O"

PID_LIST=""

kli multisig interact --name multisigj1 --alias multisig --data '{"d": "potato"}' &
kli multisig interact --name multisigj1 --alias multisig --passcode "DoB26Fj4x9LboAFWJra17O" --data '{"d": "potato"}' &
pid=$!
PID_LIST+=" $pid"

kli multisig join --name multisigj2 --passcode "DoB26Fj4x9LboAFWJra17O" --auto &
pid=$!
PID_LIST+=" $pid"

kli multisig join --name multisigj2 --auto &
kli multisig join --name multisigj3 --passcode "DoB26Fj4x9LboAFWJra17O" --auto &
pid=$!
PID_LIST+=" $pid"

wait $PID_LIST

kli status --name multisigj1 --alias multisig
kli status --name multisigj1 --alias multisig --passcode "DoB26Fj4x9LboAFWJra17O"
213 changes: 213 additions & 0 deletions scripts/demo/basic/multisig-rotate-three-stooges.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
#!/bin/bash
# three stooges

source ${KERI_SCRIPT_DIR}/demo/basic/script-utils.sh

# WITNESSES
# To run the following scripts, open another console window and run:
# $ kli witness demo

print_yellow "Multisig rotation with three AIDs"
echo

kli init --name larry \
--salt 0ACDEyMzQ1Njc4OWxtbm9aBc \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--config-dir "${KERI_SCRIPT_DIR}" \
--config-file demo-witness-oobis
# Prefix EA5g3RMwkjcr_M4fI3k2ShCYlQMpgk3HD9mHhx7ZJs4U
kli incept --name larry --alias larry \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--file ${KERI_DEMO_SCRIPT_DIR}/data/multisig-1-sample.json

kli init --name moe \
--salt 0ACDEyMzQ1Njc4OWdoaWpsaw \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--config-dir "${KERI_SCRIPT_DIR}" \
--config-file demo-witness-oobis
# Prefix ED7yk9oUIe5qRh8ILfTuT_sNHidrxwJ9Bl-tLPoAXbqW
kli incept --name moe --alias moe \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--file ${KERI_DEMO_SCRIPT_DIR}/data/multisig-2-sample.json

kli init --name curly \
--salt 0ACDEyMzQ1Njc4OWdoaWpsaw \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--config-dir "${KERI_SCRIPT_DIR}" \
--config-file demo-witness-oobis
# Prefix EEHyoLseuHa0nuhDj9tBv6N6nU1PILwv4jTt5x8A8uLu
kli incept --name curly --alias curly \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--file ${KERI_DEMO_SCRIPT_DIR}/data/multisig-3-sample.json

# OOBI resolution does the initial discovery of key state
echo
print_yellow "Resolve OOBIs"
kli oobi resolve --name larry --oobi-alias moe \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--oobi http://127.0.0.1:5642/oobi/ED7yk9oUIe5qRh8ILfTuT_sNHidrxwJ9Bl-tLPoAXbqW/witness/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha
kli oobi resolve --name larry --oobi-alias curly \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--oobi http://127.0.0.1:5642/oobi/EEHyoLseuHa0nuhDj9tBv6N6nU1PILwv4jTt5x8A8uLu/witness/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha

kli oobi resolve --name moe --oobi-alias larry \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--oobi http://127.0.0.1:5642/oobi/EA5g3RMwkjcr_M4fI3k2ShCYlQMpgk3HD9mHhx7ZJs4U/witness/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha
kli oobi resolve --name moe --oobi-alias curly \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--oobi http://127.0.0.1:5642/oobi/EEHyoLseuHa0nuhDj9tBv6N6nU1PILwv4jTt5x8A8uLu/witness/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha

kli oobi resolve --name curly --oobi-alias larry \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--oobi http://127.0.0.1:5642/oobi/EA5g3RMwkjcr_M4fI3k2ShCYlQMpgk3HD9mHhx7ZJs4U/witness/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha
kli oobi resolve --name curly --oobi-alias moe \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--oobi http://127.0.0.1:5642/oobi/ED7yk9oUIe5qRh8ILfTuT_sNHidrxwJ9Bl-tLPoAXbqW/witness/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha

# Multisig Inception
echo
print_yellow "Multisig Inception"
# Follow commands run in parallel
kli multisig incept --name larry --alias larry \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--group multisig \
--file ${KERI_DEMO_SCRIPT_DIR}/data/multisig-three-aids.json &
pid=$!
PID_LIST+=" $pid"
kli multisig incept --name moe --alias moe \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--group multisig \
--file ${KERI_DEMO_SCRIPT_DIR}/data/multisig-three-aids.json &
pid=$!
PID_LIST+=" $pid"
kli multisig incept --name curly --alias curly \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--group multisig \
--file ${KERI_DEMO_SCRIPT_DIR}/data/multisig-three-aids.json &
pid=$!
PID_LIST+=" $pid"

echo
print_yellow "Multisig Inception - wait"
wait $PID_LIST

echo
print_green "Multisig Inception - status"
kli status --name larry --alias multisig --passcode "DoB26Fj4x9LboAFWJra17O"

# Rotate keys for each multisig - required before rotating the multisig
echo
print_yellow "Rotate keys for each multisig"
kli rotate --name larry --alias larry --passcode "DoB26Fj4x9LboAFWJra17O"
kli rotate --name moe --alias moe --passcode "DoB26Fj4x9LboAFWJra17O"
kli rotate --name curly --alias curly --passcode "DoB26Fj4x9LboAFWJra17O"

# Pull key state in from other multisig group participant identifiers so they have the next digest
echo
print_yellow "Pull key state in from other multisig group participant identifiers"
# 2 about 1
kli query --name moe --alias moe \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--prefix EA5g3RMwkjcr_M4fI3k2ShCYlQMpgk3HD9mHhx7ZJs4U
# 2 about 3
kli query --name moe --alias moe \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--prefix EEHyoLseuHa0nuhDj9tBv6N6nU1PILwv4jTt5x8A8uLu
# 1 about 2
kli query --name larry --alias larry \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--prefix ED7yk9oUIe5qRh8ILfTuT_sNHidrxwJ9Bl-tLPoAXbqW
# 1 about 3
kli query --name larry --alias larry \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--prefix EEHyoLseuHa0nuhDj9tBv6N6nU1PILwv4jTt5x8A8uLu
# 3 about 1
kli query --name curly --alias curly \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--prefix EA5g3RMwkjcr_M4fI3k2ShCYlQMpgk3HD9mHhx7ZJs4U
# 3 about 2
kli query --name curly --alias curly \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--prefix ED7yk9oUIe5qRh8ILfTuT_sNHidrxwJ9Bl-tLPoAXbqW


echo
print_yellow "Multisig rotation"

PID_LIST=""

kli multisig rotate --name larry --alias multisig \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--isith '["1/3", "1/3", "1/3"]' \
--smids EA5g3RMwkjcr_M4fI3k2ShCYlQMpgk3HD9mHhx7ZJs4U \
--smids ED7yk9oUIe5qRh8ILfTuT_sNHidrxwJ9Bl-tLPoAXbqW \
--smids EEHyoLseuHa0nuhDj9tBv6N6nU1PILwv4jTt5x8A8uLu \
--nsith '["1/2", "1/2", "1/2"]' \
--rmids EA5g3RMwkjcr_M4fI3k2ShCYlQMpgk3HD9mHhx7ZJs4U \
--rmids ED7yk9oUIe5qRh8ILfTuT_sNHidrxwJ9Bl-tLPoAXbqW \
--rmids EEHyoLseuHa0nuhDj9tBv6N6nU1PILwv4jTt5x8A8uLu &
pid=$!
PID_LIST+=" $pid"
kli multisig rotate --name moe --alias multisig \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--isith '["1/3", "1/3", "1/3"]' \
--smids EA5g3RMwkjcr_M4fI3k2ShCYlQMpgk3HD9mHhx7ZJs4U \
--smids ED7yk9oUIe5qRh8ILfTuT_sNHidrxwJ9Bl-tLPoAXbqW \
--smids EEHyoLseuHa0nuhDj9tBv6N6nU1PILwv4jTt5x8A8uLu \
--nsith '["1/2", "1/2", "1/2"]' \
--rmids EA5g3RMwkjcr_M4fI3k2ShCYlQMpgk3HD9mHhx7ZJs4U \
--rmids ED7yk9oUIe5qRh8ILfTuT_sNHidrxwJ9Bl-tLPoAXbqW \
--rmids EEHyoLseuHa0nuhDj9tBv6N6nU1PILwv4jTt5x8A8uLu &
pid=$!
PID_LIST+=" $pid"
kli multisig rotate --name curly --alias multisig \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--isith '["1/3", "1/3", "1/3"]' \
--smids EA5g3RMwkjcr_M4fI3k2ShCYlQMpgk3HD9mHhx7ZJs4U \
--smids ED7yk9oUIe5qRh8ILfTuT_sNHidrxwJ9Bl-tLPoAXbqW \
--smids EEHyoLseuHa0nuhDj9tBv6N6nU1PILwv4jTt5x8A8uLu \
--nsith '["1/2", "1/2", "1/2"]' \
--rmids EA5g3RMwkjcr_M4fI3k2ShCYlQMpgk3HD9mHhx7ZJs4U \
--rmids ED7yk9oUIe5qRh8ILfTuT_sNHidrxwJ9Bl-tLPoAXbqW \
--rmids EEHyoLseuHa0nuhDj9tBv6N6nU1PILwv4jTt5x8A8uLu &
pid=$!
PID_LIST+=" $pid"

echo
print_yellow "Multisig rotation - wait"
wait $PID_LIST

echo
print_green "Multisig rotation - status"
kli status --name larry --alias multisig --passcode "DoB26Fj4x9LboAFWJra17O"

echo
print_yellow "Multisig interact"

PID_LIST=""

kli multisig interact --name larry --alias multisig \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--data "{\"tagline\":\"three lost souls\"}" &
pid=$!
PID_LIST+=" $pid"
kli multisig interact --name moe --alias multisig \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--data "{\"tagline\":\"three lost souls\"}" &
pid=$!
PID_LIST+=" $pid"
kli multisig interact --name curly --alias multisig \
--passcode "DoB26Fj4x9LboAFWJra17O" \
--data "{\"tagline\":\"three lost souls\"}" &
pid=$!
PID_LIST+=" $pid"

echo
print_yellow "Multisig interact - wait"
wait $PID_LIST

echo
print_green "Multisig interact - status"
kli status --name larry --alias multisig --passcode "DoB26Fj4x9LboAFWJra17O"
print_lcyan "Multisig rotate three stooges - done."

22 changes: 22 additions & 0 deletions scripts/demo/basic/script-utils.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Utility functions
print_green() {
text=$1
printf "\e[32m${text}\e[0m\n"
}

print_yellow(){
text=$1
printf "\e[33m${text}\e[0m\n"
}

print_red() {
text=$1
printf "\e[31m${text}\e[0m\n"
}

print_lcyan() {
text=$1
printf "\e[96m${text}\e[0m\n"
}
Loading

0 comments on commit 4f44b98

Please sign in to comment.