Documentation ¶
Overview ¶
Package consts contains constants used throughout the entire library and errors.
Index ¶
Constants ¶
View Source
const ( // TrinaryRadix defines the base of the trinary system. TrinaryRadix = 3 // TryteRadix defines the radix used for tryte conversions. TryteRadix = 27 // TryteAlphabet are letters of the alphabet and the number 9 // which directly map to decimal values of a single Tryte value. TryteAlphabet = "9ABCDEFGHIJKLMNOPQRSTUVWXYZ" // TritsPerTryte is the number of trits in one tryte TritsPerTryte = 3 // MinTryteValue is the minimum value of a tryte value. MinTryteValue = -13 // MaxTryteValue is the maximum value of a tryte value. MaxTryteValue = 13 // MinTritValue is the minimum value of a trit value. MinTritValue = -1 // MaxTritValue is the maximum value of a trit value. MaxTritValue = 1 )
View Source
const ( // HashTrinarySize is the standard size for hashes from Curl or Kerl. HashTrinarySize = 243 // HashTrytesSize is the trytes size of HashTrinarySize. HashTrytesSize = HashTrinarySize / 3 // HashBytesSize is the bytes size of HashTrytesSize. HashBytesSize = 48 // IntLength is used for bytes-trytes conversion. IntLength = HashBytesSize / 4 // KeySegmentsPerFragment is the amount of segments per key fragment. KeySegmentsPerFragment = 27 // KeyFragmentLength defines the length of a key fragment. KeyFragmentLength = HashTrinarySize * KeySegmentsPerFragment // 6561 // KeySegmentHashRounds is the amount of hashing rounds during key segment hashing. KeySegmentHashRounds = 26 )
View Source
const ( AddressChecksumTrytesSize = 9 AddressWithChecksumTrytesSize = HashTrytesSize + AddressChecksumTrytesSize MinChecksumTrytesSize = 3 // Total supply of IOTA available in the network. Used for ensuring a balanced ledger state and bundle balances // = (3^33 - 1) / 2 TotalSupply uint64 = 2779530283277761 )
Address, balance and checksum constants.
View Source
const ( UpperBoundAttachmentTimestamp = (3 ^ 27 - 1) / 2 LowerBoundAttachmentTimestamp = 0 )
Attachment timestamp constants.
View Source
const ( SignatureMessageFragmentTrinaryOffset = 0 SignatureMessageFragmentTrinarySize = 6561 AddressTrinaryOffset = SignatureMessageFragmentTrinaryOffset + SignatureMessageFragmentTrinarySize AddressTrinarySize = 243 ValueOffsetTrinary = AddressTrinaryOffset + AddressTrinarySize ValueUsedSizeTrinary = 33 ValueSizeTrinary = 81 ObsoleteTagTrinaryOffset = ValueOffsetTrinary + ValueSizeTrinary ObsoleteTagTrinarySize = 81 TimestampTrinaryOffset = ObsoleteTagTrinaryOffset + ObsoleteTagTrinarySize TimestampTrinarySize = 27 CurrentIndexTrinaryOffset = TimestampTrinaryOffset + TimestampTrinarySize CurrentIndexTrinarySize = 27 LastIndexTrinaryOffset = CurrentIndexTrinaryOffset + CurrentIndexTrinarySize LastIndexTrinarySize = 27 BundleTrinaryOffset = LastIndexTrinaryOffset + LastIndexTrinarySize BundleTrinarySize = 243 TrunkTransactionTrinaryOffset = BundleTrinaryOffset + BundleTrinarySize TrunkTransactionTrinarySize = 243 BranchTransactionTrinaryOffset = TrunkTransactionTrinaryOffset + TrunkTransactionTrinarySize BranchTransactionTrinarySize = 243 TagTrinaryOffset = BranchTransactionTrinaryOffset + BranchTransactionTrinarySize TagTrinarySize = 81 AttachmentTimestampTrinaryOffset = TagTrinaryOffset + TagTrinarySize AttachmentTimestampTrinarySize = 27 AttachmentTimestampLowerBoundTrinaryOffset = AttachmentTimestampTrinaryOffset + AttachmentTimestampTrinarySize AttachmentTimestampLowerBoundTrinarySize = 27 AttachmentTimestampUpperBoundTrinaryOffset = AttachmentTimestampLowerBoundTrinaryOffset + AttachmentTimestampLowerBoundTrinarySize AttachmentTimestampUpperBoundTrinarySize = 27 NonceTrinaryOffset = AttachmentTimestampUpperBoundTrinaryOffset + AttachmentTimestampUpperBoundTrinarySize NonceTrinarySize = 81 TransactionTrinarySize = SignatureMessageFragmentTrinarySize + AddressTrinarySize + ValueSizeTrinary + ObsoleteTagTrinarySize + TimestampTrinarySize + CurrentIndexTrinarySize + LastIndexTrinarySize + BundleTrinarySize + TrunkTransactionTrinarySize + BranchTransactionTrinarySize + TagTrinarySize + AttachmentTimestampTrinarySize + AttachmentTimestampLowerBoundTrinarySize + AttachmentTimestampUpperBoundTrinarySize + NonceTrinarySize SignatureMessageFragmentSizeInTrytes = SignatureMessageFragmentTrinarySize / 3 TransactionTrytesSize = TransactionTrinarySize / 3 )
Transaction elements size and offsets.
View Source
const ( Radix int8 = 3 NumberOfTritsInAByte = 5 )
Trinary conversion constants.
View Source
const ( ISSFragments uint64 = 27 ISSKeyLength uint64 = HashTrinarySize * ISSFragments ISSChunkLength int = HashTrinarySize / TrinaryRadix )
Merkle constants.
View Source
const (
// DefaultMinWeightMagnitude is the default difficulty on mainnet.
DefaultMinWeightMagnitude = 14
)
Variables ¶
View Source
var ( NullHashTrytes = strings.Repeat("9", HashTrytesSize) NullTagTrytes = strings.Repeat("9", TagTrinarySize/3) NullNonceTrytes = strings.Repeat("9", NonceTrinarySize/3) NullSignatureMessageFragmentTrytes = strings.Repeat("9", SignatureMessageFragmentTrinarySize/3) NullAddressWithChecksum = strings.Repeat("9", HashTrytesSize) + "A9BEONKZW" )
Null value constants.
View Source
var ( // ErrSettingsNil gets returned when no settings are supplied to ComposeAPI(). ErrSettingsNil = errors.New("settings must not be nil") // ErrInvalidSettingsType gets returned if the wrong underlying type of Settings were supplied for creating a Provider. ErrInvalidSettingsType = errors.New("incompatible settings type supplied") // ErrInconsistentSubtangle gets returned when the tail transaction is not consistent during promotion. ErrInconsistentSubtangle = errors.New("inconsistent subtangle") // ErrInvalidSqueezeLength gets returned when the squeeze length is not a multiple of 243 (which it must be for Kerl). ErrInvalidSqueezeLength = errors.New("squeeze length must be a multiple of 243") // ErrInvalidTritsLength gets returned when the trits length are invalid for the given operation. ErrInvalidTritsLength = errors.New("invalid trits length") // ErrInvalidTrytesLength gets returned when the trytes length are invalid for the given operation. ErrInvalidTrytesLength = errors.New("invalid trytes length") // ErrInvalidBytesLength gets returned when the bytes length are invalid for the given operation. ErrInvalidBytesLength = errors.New("invalid bytes length") // ErrInsufficientBalance gets returned when an operation needs a certain amount of balance to fulfill the operation. ErrInsufficientBalance = errors.New("insufficient balance") // ErrInvalidAddress gets returned for invalid address parameters. ErrInvalidAddress = errors.New("invalid address") // ErrInvalidRemainderAddress gets returned for invalid remainder address parameters. ErrInvalidRemainderAddress = errors.New("invalid remainder address") // ErrInvalidBranchTransaction gets returned for invalid branch transaction parameters. ErrInvalidBranchTransaction = errors.New("invalid branch transaction") // ErrInvalidBundle gets returned for Bundles which are schematically wrong or/and don't pass validation. ErrInvalidBundle = errors.New("invalid bundle") // ErrInvalidBundleTotalValue gets returned for Bundles whose total value would overflow/underflow from the total supply. ErrInvalidBundleTotalValue = errors.New("invalid bundle total value") // ErrInvalidBundleAddressValue gets returned for Bundles with balance mutations in an address that would overflow/underflow from the total supply. ErrInvalidBundleAddressValue = errors.New("invalid bundle address value") // ErrInvalidBundleHash gets returned for invalid bundle hash parameters. ErrInvalidBundleHash = errors.New("invalid bundle hash") // ErrInvalidSignature gets returned for bundles with invalid signatures. ErrInvalidSignature = errors.New("invalid signature") // ErrInvalidChecksum gets returned for addresses with invalid checksum. ErrInvalidChecksum = errors.New("invalid checksum") // ErrInvalidHash gets returned for invalid hash parameters. ErrInvalidHash = errors.New("invalid hash") // ErrInvalidValue gets returned for invalid values (e.g. upper 48 trits of the value field used). ErrInvalidValue = errors.New("invalid value") // ErrInvalidIndex gets returned for invalid index parameters. ErrInvalidIndex = errors.New("invalid index option") // ErrInvalidTotalOption gets returned for invalid total option parameters. ErrInvalidTotalOption = errors.New("invalid total option") // ErrInvalidInput gets returned for invalid input parameters. ErrInvalidInput = errors.New("invalid input") // ErrInvalidSecurityLevel gets returned for invalid security level parameters. ErrInvalidSecurityLevel = errors.New("invalid security option") // ErrInvalidSeed gets returned for invalid seed parameters. ErrInvalidSeed = errors.New("invalid seed") // ErrInvalidStartEndOptions gets returned for invalid end options. ErrInvalidStartEndOptions = errors.New("invalid end option") // ErrInvalidTag gets returned for invalid tags. ErrInvalidTag = errors.New("invalid tag") // ErrInvalidTransaction gets returned when transactions trits don't make up a valid transaction. ErrInvalidTransaction = errors.New("invalid transaction") // ErrInvalidTransactionTrytes gets returned for invalid transaction trytes. ErrInvalidTransactionTrytes = errors.New("invalid transaction trytes") // ErrInvalidAttachedTrytes gets returned for invalid attached transaction trytes. ErrInvalidAttachedTrytes = errors.New("invalid attached trytes") // ErrInvalidTransactionHash gets returned for invalid transaction hash parameters. ErrInvalidTransactionHash = errors.New("invalid transaction hash") // ErrInvalidTailTransaction gets returned for invalid tail transaction hashes. ErrInvalidTailTransaction = errors.New("invalid tail transaction") // ErrInvalidTransfer gets returned for invalid transfer parameters. ErrInvalidTransfer = errors.New("invalid transfer object") // ErrInvalidTrunkTransaction gets returned for invalid trunk transaction parameters. ErrInvalidTrunkTransaction = errors.New("invalid trunk transaction") // ErrInvalidReferenceHash gets returned for invalid reference hashes. ErrInvalidReferenceHash = errors.New("invalid reference hash") // ErrInvalidTrytes gets returned for invalid trytes. ErrInvalidTrytes = errors.New("invalid trytes") // ErrInvalidByte gets returned for an invalid byte for a to trits conversion (5 packed trits in 1 byte). ErrInvalidByte = errors.New("invalid byte") // ErrInvalidTrit gets returned for invalid trit. ErrInvalidTrit = errors.New("invalid trit") // ErrInvalidURI gets returned for invalid URIs. ErrInvalidURI = errors.New("invalid uri") // ErrInvalidASCIIInput gets returned for invalid ASCII input for to trytes conversion. ErrInvalidASCIIInput = errors.New("conversion to trytes requires type of input to be encoded in ascii") // ErrInvalidOddLength gets returned for odd trytes length for to ASCII conversion. ErrInvalidOddLength = errors.New("conversion from trytes requires length of trytes to be even") // ErrInvalidTryteEncodedJSON gets returned for invalid tryte encoded JSON messages. ErrInvalidTryteEncodedJSON = errors.New("invalid tryte encoded JSON message") // ErrSendingBackToInputs gets returned when a transfer sends back to an Input. ErrSendingBackToInputs = errors.New("one of the transaction inputs is used as output") // ErrNoRemainderSpecified gets returned when no remainder was specified for certain type of operations. ErrNoRemainderSpecified = errors.New("remainder address is needed on a transfer with remainder") )
Functions ¶
This section is empty.
Types ¶
type SecurityLevel ¶
type SecurityLevel int
SecurityLevel defines the security level used for input transactions or respectively, how many signature fragments will be generated for value transfers.
const ( // SecurityLevelLow is for devices with low performance and only storing a small amount of value. SecurityLevelLow SecurityLevel = 1 // SecurityLevelMedium is the standard security level for wallets and other applications. SecurityLevelMedium SecurityLevel = 2 // SecurityLevelHigh is recommended for exchanges and other high security applications. SecurityLevelHigh SecurityLevel = 3 // MaxSecurityLevel is the maximum security level. MaxSecurityLevel = 3 )
Click to show internal directories.
Click to hide internal directories.