Beispiel #1
0
//main net config
func init() {
	MainNet.PubKey = coin.MustPubKeyFromHex("02bb0be2976457d2e30a9aea9b0057b0eb9d1ad6509ef743c25c737f24d6241a99")
	//TestNet.GenesisSignature = coin.MustSigFromHex()
	MainNet.GenesisAddress = coin.MustDecodeBase58Address("26HbgWGwrToLZ6aX8VHtQmH4SPj4baQ5S3p")
	MainNet.GenesisTime = 1392584987 //set time
	MainNet.Coins = 100e6            //100 million
}
//testnet config
func init() {
	TestNet.PubKey = coin.MustPubKeyFromHex("025a3b22eb1e132a01f485119ae343342d92ab8599d9ad613a76e3b27f878bca8b")
	//TestNet.GenesisSignature = coin.MustSigFromHex()
	TestNet.GenesisAddress = coin.MustDecodeBase58Address("26HbgWGwrToLZ6aX8VHtQmH4SPj4baQ5S3p")
	TestNet.GenesisTime = 1392584986 //set time
	TestNet.GenesisCoins = 1e12      //almost as many as Ripple
	//TestNet.GenesisSignature = coin.MustSigFromHex()
}
func assertReadableTransactionOutput(t *testing.T,
	rto ReadableTransactionOutput, to coin.TransactionOutput) {
	assert.NotPanics(t, func() {
		assert.Equal(t, coin.MustDecodeBase58Address(rto.Address),
			to.Address)
	})
	assert.Equal(t, rto.Coins, to.Coins)
	assert.Equal(t, rto.Hours, to.Hours)
	assertJSONSerializability(t, &rto)
}
Beispiel #4
0
func WalletEntryFromReadable(w *ReadableWalletEntry) WalletEntry {
	// SimpleWallet entries are shared as a form of identification, the secret key
	// is not required
	// TODO -- fix lib/base58 to not panic on invalid input -- should
	// return error, so we can detect a broken wallet.
	if w.Address == "" {
		log.Panic("ReadableWalletEntry has no Address")
	}
	var s coin.SecKey
	if w.Secret != "" {
		s = coin.MustSecKeyFromHex(w.Secret)
	}
	return WalletEntry{
		Address: coin.MustDecodeBase58Address(w.Address),
		Public:  coin.MustPubKeyFromHex(w.Public),
		Secret:  s,
	}
}