Esempio n. 1
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "NewPct"
	txTime := "1599278817"
	userId := []byte("2")
	var blockId int64 = 140015
	//data:=`{"currency":{"1":{"miner_pct":"0.0000000617044","user_pct":"0.0000000439591"},"72":{"miner_pct":"0.0000000617044","user_pct":"0.0000000439591"}},"referral":{"first":10,"second":0,"third":0}}`
	data := `{"currency":{"1":{"miner_pct":"0.0000000617044","user_pct":"0.0000000435602"},"72":{"miner_pct":"0.0000000760368","user_pct":"0.0000000562834"}},"referral":{"first":30,"second":20,"third":5}}`

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("22cb812e53e22ee539af4a1d39b4596d"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, userId)
	// promised_amount_id
	txSlice = append(txSlice, []byte(data))

	dataForSign := fmt.Sprintf("%v,%v,%s,%s", utils.TypeInt(txType), txTime, userId, data)

	err := tests_utils.MakeFrontTest(txSlice, utils.StrToInt64(txTime), dataForSign, txType, utils.BytesToInt64(userId), "", blockId)
	if err != nil {
		fmt.Println(err)
	}

}
Esempio n. 2
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "ChangeHost"
	txTime := "1399278817"
	userId := []byte("2")
	var blockId int64 = 1415
	host := "http://fdfdfd.ru/"

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("22cb812e53e22ee539af4a1d39b4596d"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, userId)
	// promised_amount_id
	txSlice = append(txSlice, []byte(host))

	dataForSign := fmt.Sprintf("%v,%v,%s,%s", utils.TypeInt(txType), txTime, userId, host)

	err := tests_utils.MakeFrontTest(txSlice, utils.StrToInt64(txTime), dataForSign, txType, utils.BytesToInt64(userId), "", blockId)
	if err != nil {
		fmt.Println(err)
	}
}
Esempio n. 3
0
func main() {

	f, err := os.OpenFile("dclog.txt", os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0777)
	defer f.Close()
	//log.SetOutput(f)
	log.SetOutput(io.MultiWriter(f, os.Stdout))
	log.SetFlags(log.LstdFlags | log.Lshortfile)

	txType := "Mining"
	txTime := "1406545938"
	userId := []byte("105")
	var blockId int64 = 123925
	promised_amount_id := "24"
	amount := "5.69"

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("22cb812e53e22ee539af4a1d39b4596d"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, userId)
	// promised_amount_id
	txSlice = append(txSlice, []byte(promised_amount_id))
	// amount
	txSlice = append(txSlice, []byte(amount))

	dataForSign := fmt.Sprintf("%v,%v,%s,%s,%s", utils.TypeInt(txType), txTime, userId, promised_amount_id, amount)

	blockData := new(utils.BlockData)
	blockData.BlockId = blockId
	blockData.Time = utils.StrToInt64(txTime)
	blockData.UserId = utils.BytesToInt64(userId)

	err = tests_utils.MakeFrontTest(txSlice, utils.StrToInt64(txTime), dataForSign, txType, utils.BytesToInt64(userId), "", blockId)
	if err != nil {
		fmt.Println(err)
	}

}
Esempio n. 4
0
func main() {

	f := tests_utils.InitLog()
	defer f.Close()

	txType := "VotesComplex"
	txTime := "1499278817"
	userId := []byte("2")
	var blockId int64 = 128008
	newPct := new(vComplex)
	newPct.Currency = make(map[string][]float64)
	newPct.Referral = make(map[string]string)
	newPct.Currency["1"] = []float64{0.0000000760368, 0.0000000497405, 1000, 55, 10}
	newPct.Currency["72"] = []float64{0.0000000760368, 0.0000000497405, 1000, 55, 10}
	newPct.Referral["first"] = "30"
	newPct.Referral["second"] = "0"
	newPct.Referral["third"] = "30"
	newPct.Admin = 100
	newPctJson, _ := json.Marshal(newPct)

	var txSlice [][]byte
	// hash
	txSlice = append(txSlice, []byte("22cb812e53e22ee539af4a1d39b4596d"))
	// type
	txSlice = append(txSlice, utils.Int64ToByte(utils.TypeInt(txType)))
	// time
	txSlice = append(txSlice, []byte(txTime))
	// user_id
	txSlice = append(txSlice, userId)
	// newPctJson
	txSlice = append(txSlice, []byte(newPctJson))

	dataForSign := fmt.Sprintf("%v,%v,%s,%s", utils.TypeInt(txType), txTime, userId, newPctJson)

	err := tests_utils.MakeFrontTest(txSlice, utils.StrToInt64(txTime), dataForSign, txType, utils.BytesToInt64(userId), "", blockId)
	if err != nil {
		fmt.Println(err)
	}
}