Ref - https://github.com/ZenGo-X/solana-tss
cargo install --git <https://github.com/ZenGo-X/solana-tss.git>
<aside> 💡
Make sure the aggregated key has atleast 1+ SOL that it can send to the new address. Default the code to use devnet.
cargo run aggregate-keys DLQegXe3gWzrzL4pLrPXG8ia2r2c8kDvhGtauwQgrjhx 7weVNHN5NMNd4TUcPSyqUou5ibWnh2p47Bh9xMxHNWet
cargo run airdrop --to EnVGAa6uoxGheCAv6JjM357bwQnsU3xiexGvzMhXeQzP --amount 1
</aside>
#!/bin/bash
set -e
# Generate fresh messages for both keys
cargo run agg-send-step-one 3cHsZDVSpdm8oKiawZRqvWsRExz9zRVwGYcAH8UUDa2sibyVJWt1RGBDpaXak5Gw9QeVoxPmm4EmdvqBb1PrGcyE > /tmp/step1_1.txt
cargo run agg-send-step-one NkELRYi2XLNH5645PgX4HDDH2vJi4Yy9GGekZEUDutxZwZuovnyiZ9ZVRJmNKecL82cWQRaMYx8Up6S14RxspGe > /tmp/step1_2.txt
MESSAGE_1=$(grep "Message 1:" /tmp/step1_1.txt | awk '{print $3}')
SECRET_1=$(grep "Secret state:" /tmp/step1_1.txt | awk '{print $3}')
MESSAGE_2=$(grep "Message 1:" /tmp/step1_2.txt | awk '{print $3}')
SECRET_2=$(grep "Secret state:" /tmp/step1_2.txt | awk '{print $3}')
BLOCKHASH=$(cargo run recent-block-hash | grep "recent block hash:" | awk '{print $4}')
# Generate signatures ensuring same message order for both
cargo run agg-send-step-two --keypair 3cHsZDVSpdm8oKiawZRqvWsRExz9zRVwGYcAH8UUDa2sibyVJWt1RGBDpaXak5Gw9QeVoxPmm4EmdvqBb1PrGcyE --amount 1 --to 8XPovF32Ya1aJcoxbJLNrNGToRwvAQMzkTuQY81pk857 --recent-block-hash $BLOCKHASH --keys 7weVNHN5NMNd4TUcPSyqUou5ibWnh2p47Bh9xMxHNWet DLQegXe3gWzrzL4pLrPXG8ia2r2c8kDvhGtauwQgrjhx --first-messages $MESSAGE_2 --secret-state $SECRET_1 > /tmp/sig1.txt
cargo run agg-send-step-two --keypair NkELRYi2XLNH5645PgX4HDDH2vJi4Yy9GGekZEUDutxZwZuovnyiZ9ZVRJmNKecL82cWQRaMYx8Up6S14RxspGe --amount 1 --to 8XPovF32Ya1aJcoxbJLNrNGToRwvAQMzkTuQY81pk857 --recent-block-hash $BLOCKHASH --keys 7weVNHN5NMNd4TUcPSyqUou5ibWnh2p47Bh9xMxHNWet DLQegXe3gWzrzL4pLrPXG8ia2r2c8kDvhGtauwQgrjhx --first-messages $MESSAGE_1 --secret-state $SECRET_2 > /tmp/sig2.txt
SIG_1=$(grep "Partial signature:" /tmp/sig1.txt | awk '{print $3}')
SIG_2=$(grep "Partial signature:" /tmp/sig2.txt | awk '{print $3}')
# Try aggregating with signatures in the same order as keys
cargo run aggregate-signatures-and-broadcast --signatures $SIG_1 $SIG_2 --amount 1 --to 8XPovF32Ya1aJcoxbJLNrNGToRwvAQMzkTuQY81pk857 --recent-block-hash $BLOCKHASH --net devnet --keys 7weVNHN5NMNd4TUcPSyqUou5ibWnh2p47Bh9xMxHNWet DLQegXe3gWzrzL4pLrPXG8ia2r2c8kDvhGtauwQgrjhx
rm /tmp/step1_1.txt /tmp/step1_2.txt /tmp/sig1.txt /tmp/sig2.txt