Initial commit
This commit is contained in:
40
main.go
Normal file
40
main.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"monoblock/chain"
|
||||
"monoblock/keymgmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
const AMOUNT int = 100
|
||||
|
||||
func main() {
|
||||
by1, _ := hex.DecodeString("0001020304")
|
||||
by2, _ := hex.DecodeString("0001020304")
|
||||
|
||||
fmt.Printf("%x", chain.XorSlice(by1, by2))
|
||||
|
||||
addr1 := keymgmt.GenerateAddress()
|
||||
addr2 := keymgmt.GenerateAddress()
|
||||
addr3 := keymgmt.GenerateAddress()
|
||||
addr4 := keymgmt.GenerateAddress()
|
||||
ta1 := chain.NewTransaction(addr3.GetAddress(), addr1.GetAddress(), 100)
|
||||
ta2 := chain.NewTransaction(addr2.GetAddress(), addr4.GetAddress(), 100)
|
||||
b1 := chain.NewBlock(nil)
|
||||
b1.AddTransaction(ta1)
|
||||
b1.AddTransaction(ta2)
|
||||
hash := b1.GenerateHash(4)
|
||||
fmt.Printf("Hash found:\n\n%x\n\n", hash)
|
||||
bufio.NewReader(os.Stdin).ReadBytes('\n')
|
||||
}
|
||||
|
||||
func generateKey(ch chan *keymgmt.Address, amount int) {
|
||||
for i := 0; i < amount; i++ {
|
||||
addr := keymgmt.GenerateAddress()
|
||||
ch <- addr
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user