Ejemplo n.º 1
0
// Initialize the level db and share it with other components
func initDB() {

	//init factoid_bolt db
	fmt.Println("boltDBpath:", boltDBpath)
	common.FactoidState = stateinit.NewFactoidState(boltDBpath + "factoid_bolt.db")

	//init db
	var err error
	db, err = ldb.OpenLevelDB(ldbpath, false)

	if err != nil {
		ftmdLog.Errorf("err opening db: %v\n", err)

	}

	if db == nil {
		ftmdLog.Info("Creating new db ...")
		db, err = ldb.OpenLevelDB(ldbpath, true)

		if err != nil {
			panic(err)
		}
	}
	ftmdLog.Info("Database started from: " + ldbpath)

}
Ejemplo n.º 2
0
func NewState(filename string) IState {
	s := new(State)

	s.dbfile = filename
	s.fs = stateinit.NewFactoidState(s.dbfile)
	s.commands = make(map[string]ICommand, 10)
	s.ipaddressFD = "localhost:"
	s.portNumberFD = "8088"

	s.AddCommand(new(AddFee))
	s.AddCommand(new(AddECOutput))
	s.AddCommand(new(AddressFromWords))
	s.AddCommand(new(AddInput))
	s.AddCommand(new(AddOutput))
	s.AddCommand(new(Balance))
	s.AddCommand(new(Balances))
	s.AddCommand(new(Export))
	s.AddCommand(new(ExportKey))
	s.AddCommand(new(Exit))
	s.AddCommand(new(Height))
	s.AddCommand(new(Help))
	s.AddCommand(new(Import))
	s.AddCommand(new(ImportKey))
	s.AddCommand(new(List))
	s.AddCommand(new(Listj))
	s.AddCommand(new(NewAddress))
	s.AddCommand(new(NewTransaction))
	s.AddCommand(new(Print))
	s.AddCommand(new(Run))
	s.AddCommand(new(Setup))
	s.AddCommand(new(Sign))
	s.AddCommand(new(Submit))

	return s
}
Ejemplo n.º 3
0
// Copyright 2015 Factom Foundation
// Use of this source code is governed by the MIT
// license that can be found in the LICENSE file.

package Wallet

import (
	"github.com/FactomProject/FactomCode/util"
	"github.com/FactomProject/factoid/state/stateinit"
)

var (
	cfg             = util.ReadConfig().Wallet
	applicationName = "Factom/fctwallet"

	ipaddressFD  = cfg.FactomdAddress
	portNumberFD = cfg.FactomdPort

	databasefile = "factoid_wallet_bolt.db"
)

var factoidState = stateinit.NewFactoidState(cfg.BoltDBPath + databasefile)

const Version = "0.1.8.0"