Esempio n. 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!")
	}

}
Esempio n. 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)
}
Esempio n. 4
0
func (e *ECBlockBody) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 5
0
func (e *DirectoryBlock) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 6
0
func (e *EBlockHeader) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 7
0
func (e *ServerFault) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 8
0
func (e *MsgAck) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 9
0
func (e *DataResponse) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 10
0
func (e *AddServerMsg) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 11
0
func (e *RequestBlock) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 12
0
func (e *DBStateMissing) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 13
0
func (e *MsgGetEntryData) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 14
0
func (e ByteStore) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 15
0
func (s *FactoidSignature) JSONString() (string, error) {
	return primitives.EncodeJSONString(s)
}
Esempio n. 16
0
func (e *MsgFactoidTX) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 17
0
func (e *FactoidTransaction) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 18
0
func (e *FEREntry) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 19
0
func (e *AdminBlock) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 20
0
func (e *EndOfMinuteEntry) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 21
0
func (e *SignatureBlock) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 22
0
func (e *AddAuditServer) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 23
0
func (e *MsgRevealChain) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 24
0
func (e *Heartbeat) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 25
0
func (e *EntryBlockResponse) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 26
0
func (e *ServerIndexNumber) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 27
0
func (e *Bounce) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 28
0
func (e *IncreaseBalance) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
func (e *AddFederatedServer) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}
Esempio n. 30
0
func (e *CommitEntryMsg) JSONString() (string, error) {
	return primitives.EncodeJSONString(e)
}