-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
193 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"github.com/line/ostracon/abci/example/kvstore" | ||
"github.com/line/ostracon/config" | ||
"github.com/line/ostracon/crypto/encoding" | ||
"net/url" | ||
"os" | ||
) | ||
|
||
func main() { | ||
c := config.DefaultConfig() | ||
c.SetRoot(os.Getenv("HOME") + "/" + config.DefaultOstraconDir) | ||
keyFilePath := c.PrivValidatorKeyFile() | ||
var flagKeyFilePath = flag.String("priv-key", keyFilePath, "priv val key file path") | ||
var flagStakingPower = flag.Int64("staking", 10, "staking power for priv valedator") | ||
flag.Parse() | ||
keyFile, err := kvstore.LoadPrivValidatorKeyFile(*flagKeyFilePath) | ||
if err != nil { | ||
panic(err) | ||
} | ||
publicKey, err := encoding.PubKeyToProto(keyFile.PubKey) | ||
if err != nil { | ||
panic(err) | ||
} | ||
pubStr, tx := kvstore.MakeValSetChangeTxAndMore(publicKey, *flagStakingPower) | ||
{ | ||
fmt.Println("\n# Send tx of ValSetChangeTx for persist_kvstore") | ||
fmt.Println("# See: persist_kvstore.go#DeliveredTx") | ||
broadcastTxCommit := fmt.Sprintf("curl -s 'localhost:26657/broadcast_tx_commit?tx=\"%s\"'", | ||
url.QueryEscape(tx)) | ||
fmt.Println(broadcastTxCommit) | ||
} | ||
{ | ||
fmt.Println("\n# Query tx of ValSetChangeTx for persist_kvstore") | ||
fmt.Println("# See: persist_kvstore.go#Query") | ||
query := fmt.Sprintf("curl -s 'localhost:26657/abci_query?path=\"%s\"&data=\"%s\"'", | ||
url.QueryEscape("/val"), | ||
url.QueryEscape(pubStr)) | ||
fmt.Println(query) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
IFS_BACK=$IFS | ||
IFS=$'\r\n' | ||
|
||
# updator validator with default parameter | ||
commands=`go run make_val_set_change_tx.go --staking=10 --priv-key=${HOME}/.ostracon/config/priv_validator_key.json` | ||
# remove validator tx | ||
commands=`go run make_val_set_change_tx.go --staking=0` | ||
# update validator tx | ||
commands=`go run make_val_set_change_tx.go` | ||
for command in ${commands[@]}; do | ||
if [[ "$command" =~ \# ]]; then | ||
echo $command | ||
else | ||
echo $command | ||
eval $command | ||
RET=$? | ||
echo "" | ||
if [ ${RET} -ne 0 ]; then | ||
echo "ERROR: Result Code of calling RPC: ${RET}" | ||
exit ${RET} | ||
fi | ||
fi | ||
done | ||
|
||
IFS=$IFS_BACK |