model

package
v0.0.0-...-6653c62 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2018 License: MIT Imports: 16 Imported by: 4

Documentation

Overview

Copyright 2014 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Index

Constants

View Source
const (
	// PrivateBytes stores the private key length in bytes.
	PrivateBytes = 32
	// PublicBytes stores the public key length in bytes.
	PublicBytes = 32
)
View Source
const ApostilleAuditServer = `http://185.117.22.58:4567/verify`

The server verifying signed apostilles

View Source
const BtcPrice = `https://blockchain.info/ticker`

The API to get BTC/USD market data

View Source
const CurrentFeeFactor = 0.05

The Fee structure's Fee factor type float64

View Source
const DefaultMainnet = `http://alice6.nem.ninja`

The default mainnet node

View Source
const DefaultMijin = ``

The default mijin node

View Source
const DefaultPort = 7890

The default endpoint port

View Source
const DefaultTestnet = `http://192.3.61.243`

The default testnet node const DefaultTestnet = `http://bigalice2.nem.ninja`

View Source
const ImportanceTransfer = 0x801 // 2049

The importance transfer type

View Source
const MainnetExplorer = `http://chain.nem.ninja/#/transfer/`

The default mainnet block explorer

View Source
const MarketInfo = `https://poloniex.com/public`

The API to get XEM/BTC market data

View Source
const MijinExplorer = ``

The default mijin block explorer

View Source
const MosaicDefinitionTransaction = 10 * 1000000

The mosaic definition transaction fee type float64

View Source
const MosaicSupply = 0x4002 // 16386
View Source
const Mosaicdefinition = 0x4001 // 16385

The mosaic definition transaction type

View Source
const MultisigModification = 0x1001 // 4097

The aggregate modification transaction type

View Source
const MultisigSignature = 0x1002 // 4098

The multisignature signature transaction type

View Source
const MultisigTransaction = 0x1004 // 4100

The multisignature transaction type

View Source
const ProvisionNamespace = 0x2001 // 8193

The provision namespace transaction type

View Source
const RootProvisionNamespaceTransaction = 100 * 1000000

The provision namespace transaction rental fee for root namespace type float64

View Source
const SubProvisionNamespaceTransaction = 10 * 1000000

The provision namespace transaction rental fee for sub-namespace type float64

View Source
const Supernodes = `https://supernodes.nem.io/nodes`

The API to get all supernodes

View Source
const TestnetExplorer = `http://bob.nem.ninja:8765/#/transfer/`

The default testnet block explorer

View Source
const Transfer = 0x101 // 257

The transfer transaction type

View Source
const WebsocketPort = 7778

The websocket port

Variables

View Source
var Apostille = map[int]string{
	-104: "TC7MCY-5AGJQX-ZQ4BN3-BOPNXU-VIGDJC-OHBPGU-M2GE",
	104:  "NCZSJH-LTIMES-ERVBVK-OW6US6-4YDZG2-PFGQCS-V23J",
	96:   "MCGDK2-J46BOD-GGKMPI-KCBGTB-BIWL6A-L5ZKLK-Q56A",
}
View Source
var Data = base.Data{
	Testnet: base.Chain{-104, 98, "T"},
	Mainnet: base.Chain{104, 68, "N"},
	Mijin:   base.Chain{96, 60, "M"},
}

Supported predefined chains.

View Source
var ImportanceTransferTransaction = math.Floor((baseTransactionFee * CurrentFeeFactor) * 1000000)

The importance transfer transaction fee type float64

View Source
var MainnetNode = []NetNode{
	{Uri: `http: //62.75.171.41`},
	{Uri: `ttp: //san.nem.ninja`},
	{Uri: `http: //go.nem.ninja`},
	{Uri: `http: //hachi.nem.ninja`},
	{Uri: `http: //jusan.nem.ninja`},
	{Uri: `http: //nijuichi.nem.ninja`},
	{Uri: `http: //alice2.nem.ninja`},
	{Uri: `http: //alice3.nem.ninja`},
	{Uri: `http: //alice4.nem.ninja`},
	{Uri: `http: //alice5.nem.ninja`},
	{Uri: `http: //alice6.nem.ninja`},
	{Uri: `http: //alice7.nem.ninja`},
	{Uri: `http: //localhost`},
}

The mainnet nodes type slice

View Source
var MijinNode = []NetNode{
	{
		Uri: ``,
	},
}

The mijin nodes type slice

View Source
var Mosaic = map[int]string{
	-104: "TBMOSA-ICOD4F-54EE5C-DMR23C-CBGOAM-2XSJBR-5OLC",
	104:  "NBMOSA-ICOD4F-54EE5C-DMR23C-CBGOAM-2XSIUX-6TRS",
	96:   "MBMOSA-ICOD4F-54EE5C-DMR23C-CBGOAM-2XSKYH-TOJD",
}
View Source
var MultisigAggregateModificationTransaction = math.Floor((10 * CurrentFeeFactor) * 1000000)

The multisignature aggregate modification transaction fee type float64

View Source
var Multisigtransaction = math.Floor((baseTransactionFee * CurrentFeeFactor) * 1000000)

The multisignature transaction fee type float64

View Source
var Namespace = map[int]string{
	-104: "TAMESP-ACEWH4-MKFMBC-VFERDP-OOP4FK-7MTDJE-YP35",
	104:  "NAMESP-ACEWH4-MKFMBC-VFERDP-OOP4FK-7MTBXD-PZZA",
	96:   "MAMESP-ACEWH4-MKFMBC-VFERDP-OOP4FK-7MTCZT-G5E7",
}
View Source
var NamespaceAndMosaicCommon = math.Floor((baseTransactionFee * CurrentFeeFactor) * 1000000)

The common transaction fee for namespaces and mosaics type float64

View Source
var SearchOnMainnet = []SearchTestnet{
	{
		Url:      `http: //62.75.171.41`,
		Location: `Germany`,
	}, {
		Url:      `http: //104.251.212.131`,
		Location: `USA`,
	}, {
		Url:      `http: //45.124.65.125`,
		Location: `Hong Kong`,
	}, {
		Url:      `http: //185.53.131.101`,
		Location: `Netherlands`,
	}, {
		Url:      `http: //sz.nemchina.com`,
		Location: `China`,
	},
}

The nodes allowing search by transaction hash on mainnet type slice

View Source
var SearchOnMijin = []SearchTestnet{
	{
		Url:      ``,
		Location: ``,
	},
}

The nodes allowing search by transaction hash on mijin type slice

View Source
var SearchOnTestnet = []SearchTestnet{
	{
		Url:      `http://bigalice2.nem.ninja`,
		Location: `America / New_York`,
	}, {
		Url:      `http://192.3.61.243`,
		Location: `America / Los_Angeles`,
	}, {
		Url:      `http://23.228.67.85`,
		Location: `America / Los_Angeles`,
	},
}

The nodes allowing search by transaction hash on testnet type slice Location

View Source
var SignatureTransaction = math.Floor((baseTransactionFee * CurrentFeeFactor) * 1000000)

The cosignature transaction fee type float64

View Source
var TestnetNode = []NetNode{
	{Uri: `http://104.128.226.60`},
	{Uri: `http: //23.228.67.85`},
	{Uri: `http: //192.3.61.243`},
	{Uri: `http: //50.3.87.123`},
	{Uri: `http: //localhost`},
}

The testnet nodes type slice

Functions

func CalculateMessage

func CalculateMessage(message base.Message, isHW bool) float64

Calculate message fee. 0.05 XEM per commenced 32 bytes If the message is empty, the fee will be 0 param message - An message struct param isHW - True if hardware wallet, false otherwise return - The message fee

func CalculateMinimum

func CalculateMinimum(numNem float64) float64

Calculate fees from an amount of XEM param numNem - An amount of XEM return - The minimum fee

func CalculateMosaics

func CalculateMosaics(multiplier float64, mosaics map[string]base.MosaicDefinition,
	attachedMosaics []base.Mosaic, supplys map[string]float64) float64

Calculate fees for mosaics included in a transfer transaction param multiplier - A quantity multiplier param mosaics - A mosaicDefinitionMetaDataPair struct param attachedMosaics - An array of mosaics to send return - The fee amount for the mosaics in the transaction

func CalculateXemEquivalent

func CalculateXemEquivalent(multiplier, q, sup, divisibility float64) float64

Calculate mosaic quantity equivalent in XEM param multiplier - A mosaic multiplier param q - A mosaic quantity param sup - A mosaic supply param divisibility - A mosaic divisibility return - The XEM equivalent of a mosaic quantity

func Char2Id

func Char2Id(startChar string) int

Gets the network id from the starting char of an address param startChar - A starting char from an address return - The network id

func GetVersion

func GetVersion(val, network int) int

Gets the network version param val - A version number (1 or 2) param network - A network id return A network version

func Id2Char

func Id2Char(id int) string

Gets the starting char of the addresses of a network id param id - A network id return - The starting char of addresses

func Id2Prefix

func Id2Prefix(id int) byte

Gets a network prefix from network id param id - A network id return - The network prefix

func NewChain

func NewChain(v int) (ch base.Chain, err error)

NewChain parses byte value into a chain.

func ToAddress

func ToAddress(publicKey string, networkId int) (string, error)

ToAddress convert a public key to a NEM address param publicKey - A public key param networkId - A network id return - The NEM address

func Verify

func Verify(publicKey, message, sig []byte) bool

Verify reports whether sig is a valid signature of message by publicKey. It will panic if len(publicKey) is not PublicKeySize.

Types

type KeyPair

type KeyPair struct {
	Private []byte
	Public  []byte
}

KeyPair is a private/public crypto key pair.

func FromSeed

func FromSeed(seed []byte) (KeyPair, error)

FromSeed generates a new private/public key pair using specified private key. param pk - A PrivateBytes return - The NEM KeyPair

func KeyPairCreate

func KeyPairCreate(pk string) (*KeyPair, error)

KeyPairCreate generates a KeyPair using specified string 32 length or empty param pk - A string 32 length or nil return - The NEM KeyPair

func (*KeyPair) PrivateString

func (k *KeyPair) PrivateString() string

func (*KeyPair) PublicString

func (k *KeyPair) PublicString() string

func (*KeyPair) Sign

func (k *KeyPair) Sign(msg []byte) ([]byte, error)

Sign signs the message with privateKey and returns a signature. It will panic if len(privateKey) is not PrivateKeySize.

type NetNode

type NetNode struct {
	Uri string
}

type SearchTestnet

type SearchTestnet struct {
	Url, Location string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL