-
Notifications
You must be signed in to change notification settings - Fork 3
603 multisig apply #623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
603 multisig apply #623
Changes from 36 commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
585f7bd
#603 initialize multisig service layer
andy-shi88 e3c3934
#603 implement apply confirmed
andy-shi88 c282bff
#603 add sender address in pending transaction
andy-shi88 2348f5f
#603 update multisignature.PendingTransaction schema
andy-shi88 8f2fb66
#603 delete multisig tx util
andy-shi88 604d3b6
#603 add sign command to support multisig development
andy-shi88 12b8e05
#603 add --sender-address flag for generating unsigned bytes
andy-shi88 37fc748
#604 add sender address to unsigned tx
andy-shi88 6de2040
#603 return raw error from execute transaction to enable sqlite error…
andy-shi88 3695419
#603 complete multisig implementation
andy-shi88 ae1e117
#603 fix tests
andy-shi88 739eb6e
#603 add latest flag to pending transaction
andy-shi88 51f8d2b
#603 update pending_transaction status on executed
andy-shi88 6ff37b7
#603 add latest flag to pending transaction
andy-shi88 67fe276
#603 add filter to pending transaction query
andy-shi88 f294095
#603 add latest flag to multisig-info and signatureInfo
andy-shi88 adb85ed
#603 add multisig-child flag to tx table
andy-shi88 ff5cbd6
#603 add multisig-child flag to tx table
andy-shi88 7bb1d03
#603 add multisig-child flag to tx model
andy-shi88 e024d59
#603 add latest field to all pending tables
andy-shi88 af50edb
#603 adjust query to handle latest flag
andy-shi88 0db4de7
#603 insert multisig-child transaction to transaction table
andy-shi88 e0320a4
#603 dfix test
andy-shi88 dae6919
#603 adjust cmd tools and crypto package to validate multisig signatu…
andy-shi88 eb90c5d
#603 fix example cmd
andy-shi88 3d72069
#603 fix conflicts
andy-shi88 7932bee
#603 update schema
andy-shi88 16781c0
#603 remove binary
andy-shi88 477762f
#603 convert address-Signature to format stringTostring
andy-shi88 8266de8
#603 fix query inconsistency
andy-shi88 b610272
#603 handle unsigned transaction execution status
andy-shi88 df61a13
#603 revert unnecessary change
andy-shi88 6100956
#603 handle submit multisig info execute multiple tx
andy-shi88 b3c5faa
#603 fix query inconsistency
andy-shi88 72d2945
#603 add multisig signature type
andy-shi88 0a35bf6
#603 add constant for multisig signature validation type;
andy-shi88 917022a
Merge branch 'develop' into 603-multisig-apply
andy-shi88 0351e68
#603 remove debug log
andy-shi88 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,71 @@ | ||
package signature | ||
|
||
import ( | ||
"encoding/hex" | ||
"fmt" | ||
"strconv" | ||
"strings" | ||
|
||
"github.com/zoobc/zoobc-core/common/model" | ||
|
||
"github.com/zoobc/zoobc-core/common/crypto" | ||
"golang.org/x/crypto/sha3" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
var ( | ||
/* | ||
Signer command line tools | ||
*/ | ||
signerCmd = &cobra.Command{ | ||
Use: "sign", | ||
Short: "sign provided data", | ||
Long: "sign any provided data by using the --seed parameter", | ||
} | ||
) | ||
|
||
func init() { | ||
signerCmd.Flags().StringVar(&dataHex, "data-hex", "", "hex string of the data to sign") | ||
signerCmd.Flags().StringVar(&dataBytes, "data-bytes", "", "data bytes separated by `, `. eg:"+ | ||
"--data-bytes='1, 222, 54, 12, 32'") | ||
signerCmd.Flags().StringVar(&seed, "seed", "", "your secret phrase") | ||
signerCmd.Flags().BoolVar(&hash, "hash", false, "turn this flag on to hash the data before signing") | ||
} | ||
|
||
func Commands() *cobra.Command { | ||
signerCmd.Run = SignData | ||
return signerCmd | ||
} | ||
|
||
func SignData(*cobra.Command, []string) { | ||
var ( | ||
unsignedBytes []byte | ||
hashedUnsignedBytes [32]byte | ||
signature []byte | ||
) | ||
if dataHex != "" { | ||
unsignedBytes, _ = hex.DecodeString(dataHex) | ||
} else { | ||
txByteCharSlice := strings.Split(dataBytes, ", ") | ||
for _, v := range txByteCharSlice { | ||
byteValue, err := strconv.Atoi(v) | ||
if err != nil { | ||
panic("failed to parse transaction bytes") | ||
} | ||
unsignedBytes = append(unsignedBytes, byte(byteValue)) | ||
} | ||
} | ||
if hash { | ||
hashedUnsignedBytes = sha3.Sum256(unsignedBytes) | ||
signature, _ = (&crypto.Signature{}).Sign(hashedUnsignedBytes[:], model.SignatureType_DefaultSignature, seed) | ||
} else { | ||
signature, _ = (&crypto.Signature{}).Sign(unsignedBytes, model.SignatureType_DefaultSignature, seed) | ||
} | ||
edUtil := crypto.NewEd25519Signature() | ||
fmt.Printf("account-address:\t%v\n", edUtil.GetAddressFromSeed(seed)) | ||
fmt.Printf("transaction-bytes:\t%v\n", unsignedBytes) | ||
fmt.Printf("transaction-hash:\t%v\n", hex.EncodeToString(hashedUnsignedBytes[:])) | ||
fmt.Printf("signature-bytes:\t%v\n", signature) | ||
fmt.Printf("signature-hex:\t%v\n", hex.EncodeToString(signature)) | ||
} |
This file contains hidden or 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,8 @@ | ||
package signature | ||
|
||
var ( | ||
seed string | ||
astaphobia marked this conversation as resolved.
Show resolved
Hide resolved
|
||
dataHex string | ||
dataBytes string | ||
hash bool | ||
) |
This file contains hidden or 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 hidden or 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 hidden or 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
Binary file not shown.
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.