Documentation ¶
Index ¶
- Constants
- func Abs(x int64) int64
- func BytesToFloat64(bytes []byte) float64
- func BytesToUInt64(bytes []byte) uint64
- func CheckEndian()
- func CheckIfFileExists(path string) bool
- func Float64ToByte(f float64) ([]byte, error)
- func GetChainDir(createIfNotExists bool) (string, error)
- func GetCurrentHash() ([]byte, error)
- func GetGenesisHash() ([]byte, error)
- func IsIPAddressValid(ip string) bool
- func ReadFile(path string) ([]byte, error)
- func ReadFileInChainDir(fileName string) ([]byte, error)
- func UInt32ToBytes(num uint32) []byte
- func UInt32ToBytesCustomSize(num uint32, size int) []byte
- func UInt64ToBytes(num uint64) []byte
- func WriteCurrentHash(hash []byte) error
- func WriteGenesisHash(hash []byte) error
- func WriteReadOnlyFile(path string, contents []byte) error
- func WriteToFile(path string, contents []byte) error
Constants ¶
const ( Name = "Dimosthenes" // Version is the current version of the blockchain. Version = "0.1.1" // DimosDir is the directory that the blockchain will live in. DimosDir = ".dimos" // ChainDir is the directory where the blockchain database will live in. ChainDir = "chain" // Genesis is the name of the file that will contain the genesis hash. Genesis = "genesis" // CurrentHash is the file that contains the current hash. CurrentHash = "current_hash" // MaxUnitSupply defines the maximum unit supply, which is 1 qadrillion. MaxUnitSupply = 1e15 // UnitsInCoin The amount of units in a coin are 100 million. As a result, we can have 10 million coins. UnitsInCoin = 1e8 )
Name is the name of the blockchain.
Variables ¶
This section is empty.
Functions ¶
func BytesToFloat64 ¶
BytesToFloat64 converts bytes to a float64.
func BytesToUInt64 ¶
BytesToUInt64 converts a byte array to an int64.
func CheckEndian ¶
func CheckEndian()
CheckEndian checks the byte order and determines the endiannes.
func CheckIfFileExists ¶
CheckIfFileExists checks if the given path exists.
func Float64ToByte ¶
Float64ToByte converts a float64 type number to a byte array.
func GetChainDir ¶
GetChainDir returns the directory the blockchain should live in.
func GetCurrentHash ¶
GetCurrentHash gets the current block's hash in the blockchain.
func GetGenesisHash ¶
GetGenesisHash gets the genesis block hash from inside
func IsIPAddressValid ¶
IsIPAddressValid checks whether a provided IP address is valid.
func ReadFileInChainDir ¶
ReadFileInChainDir Read a file in the blockchain directory.
func UInt32ToBytes ¶
UInt32ToBytes converts an uint32 to []bytes.
func UInt32ToBytesCustomSize ¶
UInt32ToBytesCustomSize converts an uint32 to []bytes with a custom output size.
func UInt64ToBytes ¶
UInt64ToBytes converts an uint64 to []bytes.
func WriteCurrentHash ¶
WriteCurrentHash writes the current hash to the disk.
func WriteGenesisHash ¶
WriteGenesisHash writes the genesis hash to the disk.
func WriteReadOnlyFile ¶
WriteReadOnlyFile writes the contents to the read only file at the given path.
func WriteToFile ¶
WriteToFile writes the contents to the file at the given path.
Types ¶
This section is empty.