Beispiel #1
0
func TopupFAddress() {
	const fBalanceThreshold uint64 = 20000000 //0.2

	fBalance, err := factom.GetFactoidBalance(FaucetAddress)
	if err != nil {
		panic(err)
	}
	if fBalance < int64(fBalanceThreshold) {
		panic(fmt.Sprintf("Balance is too low - %v vs %v", fBalance/100000000.0, fBalanceThreshold/100000000.0))
	}

	tx, err := factom.SendFactoid(FaucetAddress, FAddressStr, fBalanceThreshold)
	if err != nil {
		panic(err)
	}

	fmt.Printf("F Topup tx - %v\n", tx)

	for i := 0; ; i++ {
		i = i % 3
		time.Sleep(5 * time.Second)
		ack, err := factom.FactoidACK(tx, "")
		if err != nil {
			panic(err)
		}

		str, err := primitives.EncodeJSONString(ack)
		if err != nil {
			panic(err)
		}
		fmt.Printf("Topup ack - %v", str)
		for j := 0; j < i+1; j++ {
			fmt.Printf(".")
		}
		fmt.Printf("  \r")

		if ack.Status != "DBlockConfirmed" {
			continue
		}

		fmt.Printf("Topup ack - %v\n", str)

		break
	}

	fBalance, _, err = CheckFactomBalance()
	if err != nil {
		panic(err)
	}
	if uint64(fBalance) < fBalanceThreshold {
		panic("Balance was not increased!")
	}

}
Beispiel #2
0
func TopupECAddress() {
	//fmt.Printf("TopupECAddress - %v, %v\n", FAddressStr, ECAddressStr)
	const ecBalanceThreshold uint64 = 10

	tx, err := factom.BuyExactEC(FAddressStr, ECAddressStr, uint64(ecBalanceThreshold))
	//tx, err := factom.BuyExactEC(FaucetAddress, ECAddressStr, uint64(ecBalanceThreshold))
	if err != nil {
		panic(err)
	}

	fmt.Printf("EC Topup tx - %v\n", tx)

	for i := 0; ; i++ {
		i = i % 3
		time.Sleep(5 * time.Second)
		ack, err := factom.FactoidACK(tx, "")
		if err != nil {
			panic(err)
		}

		str, err := primitives.EncodeJSONString(ack)
		if err != nil {
			panic(err)
		}
		fmt.Printf("Topup ack - %v", str)
		for j := 0; j < i+1; j++ {
			fmt.Printf(".")
		}
		fmt.Printf("  \r")

		if ack.Status != "DBlockConfirmed" {
			continue
		}

		fmt.Printf("Topup ack - %v\n", str)

		break
	}

	_, ecBalance, err := CheckFactomBalance()
	if err != nil {
		panic(err)
	}
	if uint64(ecBalance) < ecBalanceThreshold {
		panic("Balance was not increased!")
	}
}
func (e *IncreaseServerCount) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Beispiel #4
0
func (e *ECBlockBody) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
func (e *DirectoryBlock) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Beispiel #6
0
func (e *EBlockHeader) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
func (e *ServerFault) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Beispiel #8
0
func (e *MsgAck) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Beispiel #9
0
func (e *DataResponse) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Beispiel #10
0
func (e *AddServerMsg) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Beispiel #11
0
func (e *RequestBlock) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Beispiel #12
0
func (e *DBStateMissing) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Beispiel #13
0
func (e *MsgGetEntryData) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Beispiel #14
0
func (e ByteStore) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Beispiel #15
0
func (s *FactoidSignature) JSONString() (string, error) {
	return primitives.EncodeJSONString(s)
}
Beispiel #16
0
func (e *MsgFactoidTX) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Beispiel #17
0
func (e *FactoidTransaction) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Beispiel #18
0
func (e *FEREntry) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Beispiel #19
0
func (e *AdminBlock) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
func (e *EndOfMinuteEntry) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Beispiel #21
0
func (e *SignatureBlock) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
func (e *AddAuditServer) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Beispiel #23
0
func (e *MsgRevealChain) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Beispiel #24
0
func (e *Heartbeat) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
func (e *EntryBlockResponse) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Beispiel #26
0
func (e *ServerIndexNumber) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Beispiel #27
0
func (e *Bounce) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
func (e *IncreaseBalance) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
func (e *AddFederatedServer) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Beispiel #30
0
func (e *CommitEntryMsg) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}