lib

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: MIT Imports: 70 Imported by: 7

Documentation

Overview

TODO(DELETEME): This entire file is replaced by remote_miner.go. We should delete all of this code and use remote_miner in all the places where we currently use the miner. The reason we don't do this now is it would break a lot of test cases that we have.

Index

Constants

View Source
const (
	// MaxOrphansInMemory is the maximum number of orphan blocks that we're willing to keep in memory. We set
	// a maximum here in order to prevent memory exhaustion from someone sending us too
	// many unconnectedTxns.
	MaxOrphansInMemory = 100

	// MaxBlockIndexNodes needs to allow the block index to grow large enough to accommodate multiple
	// forks of material length while allowing us to avoid an out-of-memory issue due to
	// a "disk-fill" attack. Notice that because we will only ever download blocks
	// after we have a header chain that has beaten all other header chains we're aware
	// of, the common case for an attack will be someone sending us long useless header
	// chains that we never actually download blocks for. This results in the block index
	// bloating up (indefinitely if we don't prune it) due to storing useless headers
	// but not resulting in the downloading of any blocks, which is a good thing.
	//
	// At ten minute block times, 5,000,000 comes out to roughly 95 years worth of blocks,
	// which seems like a reasonable limit for now (if we had 25 years of blocks, we'd still
	// have room for multiple forks each an entire history's length with this value). If
	// each node takes up 100 bytes of space this amounts to around 500MB, which also seems
	// like a reasonable size.
	MaxBlockIndexNodes = 5000000
)
View Source
const (
	StatusNone BlockStatus = 0

	// Headers must always be Validated or ValidateFailed. We
	// don't store orphan headers and therefore any header that we do
	// have in our node index will be known definitively to be valid or
	// invalid one way or the other.
	StatusHeaderValidated = 1 << iota
	StatusHeaderValidateFailed

	StatusBlockProcessed
	StatusBlockStored
	StatusBlockValidated
	StatusBlockValidateFailed

	StatusBitcoinHeaderValidated      // Deprecated
	StatusBitcoinHeaderValidateFailed // Deprecated
)
View Source
const (

	// Uint64Dec decrements a uint64 by one.
	Uint64Dec = ^uint64(0)
	// Uint32Dec decrements a uint32 by one.
	Uint32Dec = ^uint32(0)
)
View Source
const (
	// ConfigDirVendorName is the enclosing folder for user data.
	// It's required to created a ConfigDir.
	ConfigDirVendorName = "deso"
	// ConfigDirAppName is the folder where we keep user data.
	ConfigDirAppName = "deso"
	// UseridLengthBytes is the number of bytes of entropy to use for
	// a userid.
	UseridLengthBytes = 32

	// These constants are used by the DNS seed code to pick a random last
	// seen time.
	SecondsIn3Days int32 = 24 * 60 * 60 * 3
	SecondsIn4Days int32 = 24 * 60 * 60 * 4

	// MessagesToFetchPerCall is used to limit the number of messages to fetch
	// when getting a user's inbox.
	MessagesToFetchPerInboxCall = 10000
)
View Source
const (
	// GetSnapshotTimeout is used in Peer when we fetch a snapshot chunk, and we need to retry.
	GetSnapshotTimeout = 100 * time.Millisecond

	// SnapshotBlockHeightPeriod is the constant height offset between individual snapshot epochs.
	SnapshotBlockHeightPeriod uint64 = 1000

	// SnapshotBatchSize is the size in bytes of the snapshot batches sent to peers
	SnapshotBatchSize uint32 = 100 << 20 // 100MB

	// DatabaseCacheSize is used to save read operations when fetching records from the main Db.
	DatabaseCacheSize uint = 1000000 // 1M

	// HashToCurveCache is used to save computation on hashing to curve.
	HashToCurveCache uint = 10000 // 10K

	// MetadataRetryCount is used to retry updating data in badger just in case.
	MetadataRetryCount int = 5

	// EnableTimer
	EnableTimer  = true
	DisableTimer = false
)

Snapshot constants

View Source
const (
	// This is the header version that the blockchain started with.
	HeaderVersion0 = uint32(0)
	// This version made several changes to the previous header encoding format:
	// - The Nonce field was expanded to 64 bits
	// - Another ExtraNonce field was added to provide *another* 64 bits of entropy,
	//   for a total of 128 bits of entropy in the header that miners can twiddle.
	// - The header height was expanded to 64 bits
	// - The TstampSecs were expanded to 64 bits
	// - All fields were moved from encoding in little-endian to big-endian
	//
	// The benefit of this change is that miners can hash over a wider space without
	// needing to twiddle ExtraData ever.
	//
	// At the time of this writing, the intent is to deploy it in a backwards-compatible
	// fashion, with the eventual goal of phasing out blocks with the previous version.
	HeaderVersion1       = uint32(1)
	CurrentHeaderVersion = HeaderVersion1
)
View Source
const (
	// Key in transaction's extra data map that points to a post that the current transaction is reposting
	RepostedPostHash = "RecloutedPostHash"
	// Key in transaction's extra map -- The presence of this key indicates that this post is a repost with a quote.
	IsQuotedRepostKey = "IsQuotedReclout"
	// Key in transaction's extra data map that freezes a post rendering it immutable.
	IsFrozenKey = "IsFrozen"

	// Keys for a GlobalParamUpdate transaction's extra data map.
	USDCentsPerBitcoinKey            = "USDCentsPerBitcoin"
	MinNetworkFeeNanosPerKBKey       = "MinNetworkFeeNanosPerKB"
	CreateProfileFeeNanosKey         = "CreateProfileFeeNanos"
	CreateNFTFeeNanosKey             = "CreateNFTFeeNanos"
	MaxCopiesPerNFTKey               = "MaxCopiesPerNFT"
	ForbiddenBlockSignaturePubKeyKey = "ForbiddenBlockSignaturePubKey"

	DiamondLevelKey    = "DiamondLevel"
	DiamondPostHashKey = "DiamondPostHash"

	// Key in transaction's extra data map containing the derived key used in signing the txn.
	DerivedPublicKey = "DerivedPublicKey"

	// Messaging keys
	MessagingPublicKey             = "MessagingPublicKey"
	SenderMessagingPublicKey       = "SenderMessagingPublicKey"
	SenderMessagingGroupKeyName    = "SenderMessagingGroupKeyName"
	RecipientMessagingPublicKey    = "RecipientMessagingPublicKey"
	RecipientMessagingGroupKeyName = "RecipientMessagingGroupKeyName"

	// Key in transaction's extra data map. If it is there, the NFT is a "Buy Now" NFT and this is the Buy Now Price
	BuyNowPriceKey = "BuyNowPriceNanos"

	// Key in transaction's extra data map. If present, the value represents a map of pkid to basis points representing
	// the amount of royalties the pkid should receive upon sale of this NFT.
	DESORoyaltiesMapKey = "DESORoyaltiesMap"

	// Key in transaction's extra data map. If present, the value represents a map of pkid to basis points representing
	// the amount of royalties that should be added to pkid's creator coin upon sale of this NFT.
	CoinRoyaltiesMapKey = "CoinRoyaltiesMap"

	// Used to distinguish v3 messages from previous iterations
	MessagesVersionString = "V"
	MessagesVersion1      = 1
	MessagesVersion2      = 2
	MessagesVersion3      = 3

	// Key in transaction's extra data map. If present, this value represents the Node ID of the running node. This maps
	// to the map of nodes in ./lib/nodes.go
	NodeSourceMapKey = "NodeSource"

	// TransactionSpendingLimit
	TransactionSpendingLimitKey = "TransactionSpendingLimit"
	DerivedKeyMemoKey           = "DerivedKeyMemo"

	// V3 Group Chat Messages ExtraData Key
	MessagingGroupOperationType = "MessagingGroupOperationType"
)

Defines keys that may exist in a transaction's ExtraData map

View Source
const (
	// MinNetworkFeeNanosPerKBValue - Minimum value to which the minimum network fee per KB can be set.
	MinNetworkFeeNanosPerKBValue = 0
	// MaxNetworkFeeNanosPerKBValue - Maximum value to which the maximum network fee per KB can be set.
	MaxNetworkFeeNanosPerKBValue = 100 * NanosPerUnit
	// MinCreateProfileFeeNanos - Minimum value to which the create profile fee can be set.
	MinCreateProfileFeeNanos = 0
	// MaxCreateProfileFeeNanos - Maximum value to which the create profile fee can be set.
	MaxCreateProfileFeeNanos = 100 * NanosPerUnit
	// Min/MaxCreateNFTFeeNanos - Min/max value to which the create NFT fee can be set.
	MinCreateNFTFeeNanos = 0
	MaxCreateNFTFeeNanos = 100 * NanosPerUnit
	// Min/MaxMaxCopiesPerNFTNanos - Min/max value to which the create NFT fee can be set.
	MinMaxCopiesPerNFT = 1
	MaxMaxCopiesPerNFT = 10000
	// Messaging key constants
	MinMessagingKeyNameCharacters = 1
	MaxMessagingKeyNameCharacters = 32
	// Access group key constants
	MinAccessGroupKeyNameCharacters = 1
	MaxAccessGroupKeyNameCharacters = 32

	// TODO: Are these fields needed?
	// Access group enumeration max recursion depth.
	MaxAccessGroupMemberEnumerationRecursionDepth = 10
	// Dm and group chat message entries paginated fetch max recursion depth
	MaxDmMessageRecursionDepth        = 10
	MaxGroupChatMessageRecursionDepth = 10
)

Define min / max possible values for GlobalParams.

View Source
const (
	// BadgerDbFolder is the subfolder in the config dir where we
	// store the badgerdb database by default.
	BadgerDbFolder = "badgerdb"
	MaxPrefixLen   = 1
	// This string is added as a subdirectory of --data-dir flag that contains
	// everything our node is doing. We use it in order to force a "fresh sync"
	// of a node when making major updates. Not having this structure would
	// require node operators like Coinbase to change their --data-dir flag when
	// deploying a non-backwards-compatible version of the node.
	DBVersionString = "v-00000"
)
View Source
const (
	ChainTypeDeSoBlock = iota
	ChainTypeBitcoinHeader
)
View Source
const (
	// PerformanceMemTableSize is 3072 MB. Increases the maximum
	// amount of data we can commit in a single transaction.
	PerformanceMemTableSize = 3072 << 20

	// PerformanceLogValueSize is 256 MB.
	PerformanceLogValueSize = 256 << 20
)
View Source
const (
	// MaxTotalTransactionSizeBytes is the maximum number of bytes the pool can store
	// across all of its transactions. Once this limit is reached, transactions must
	// be evicted from the pool based on their feerate before new transactions can be
	// added.
	MaxTotalTransactionSizeBytes = 250000000 // 250MB

	// UnconnectedTxnExpirationInterval is how long we wait before automatically removing an
	// unconnected transaction.
	UnconnectedTxnExpirationInterval = time.Minute * 5

	// The maximum number of unconnected transactions the pool will store.
	MaxUnconnectedTransactions = 10000

	// The maximum number of bytes a single unconnected transaction can take up
	MaxUnconnectedTxSizeBytes = 100000
)
View Source
const (
	// MaxAddrsPerAddrMsg is the maximum number of addresses we allow in a single
	// addr message from a peer.
	MaxAddrsPerAddrMsg = 1000
	// AddrRelayIntervalSeconds is the amount of time we wait before relaying each
	// batch of addresses we've received recently.
	AddrRelayIntervalSeconds = 60

	// RebroadcastNodeAddrIntervalMinutes is how often we broadcast our own address
	// to our peers.
	RebroadcastNodeAddrIntervalMinutes = 24 * 60
)
View Source
const (
	// MaxDeSoInputSizeBytes is the size required to encode an DeSoInput.
	// 32 bytes for the TxID and 4 bytes for the Index = 36 bytes. Note
	// that because the index is encoded as a uvarint, this size represents
	// a maximum.
	MaxDeSoInputSizeBytes = 32 + 4
	// MaxDeSoOutputSizeBytes is the size required to encode an DeSoOutput.
	// It is 33 bytes for the public key and 8 bytes for the amount
	// = 41 bytes. Note that because the amount is encoded as a uvarint,
	// this size represents a maximum.
	MaxDeSoOutputSizeBytes = btcec.PubKeyBytesLenCompressed + 8
)
View Source
const (
	// AssociationClass: User || Post
	AssociationClassUndefined AssociationClass = 0
	AssociationClassUser      AssociationClass = 1
	AssociationClassPost      AssociationClass = 2
	// AssociationScope: Any || Scoped
	AssociationAppScopeTypeUndefined AssociationAppScopeType = 0
	AssociationAppScopeTypeAny       AssociationAppScopeType = 1
	AssociationAppScopeTypeScoped    AssociationAppScopeType = 2
	// AssociationOperation: Any || Create || Delete
	AssociationOperationUndefined AssociationOperation = 0
	AssociationOperationAny       AssociationOperation = 1
	AssociationOperationCreate    AssociationOperation = 2
	AssociationOperationDelete    AssociationOperation = 3
)
View Source
const (
	// Message Types
	NewMessageTypeDm        NewMessageType = 0
	NewMessageTypeGroupChat NewMessageType = 1

	// Message Operations
	NewMessageOperationCreate NewMessageOperation = 0
	NewMessageOperationUpdate NewMessageOperation = 1
)
View Source
const (
	// Note that "any" forces the node to be archival in order to remain
	// backwards-compatible with the rest of the network. This may change
	// in the future.
	NodeSyncTypeAny               = "any"
	NodeSyncTypeBlockSync         = "blocksync"
	NodeSyncTypeHyperSyncArchival = "hypersync-archival"
	NodeSyncTypeHyperSync         = "hypersync"
)
View Source
const (
	NanosPerUnit  = uint64(1000000000)
	BlocksPerYear = uint32(12 * 24 * 365)
	BlocksPerDay  = uint32(12 * 24)
	// Every 1M DeSo we sell causes the price to increase by a factor of 2.
	TrancheSizeNanos = uint64(1000000000000000)
	// When exchanging Bitcoin for DeSo, we don't allow transactions to create
	// less than this amount. This avoids issues around small transactions that
	// exploit floating point errors.
	MinNanosToCreate = 50

	// The price of DeSo at the beginning.
	StartDeSoPriceUSDCents = 50
	SatoshisPerBitcoin     = 100000000

	// The minimum and maximum Bitcoin prices, used as a sanity-check.
	MinUSDCentsPerBitcoin = 100 * 100
	MaxUSDCentsPerBitcoin = 1000000 * 100

	// Used for sanity checks for now. This is not necessarily the actual the max supply.
	MaxNanos = uint64(30000000) * NanosPerUnit
)
View Source
const (
	MaxVarintLen16 = 3
	MaxVarintLen32 = 5
	MaxVarintLen64 = 10
)

MaxVarintLenN is the maximum length of a varint-encoded N-bit integer.

View Source
const AssociationNullTerminator = byte(0)
View Source
const AssociationTypeReservedPrefix = "DESO"
View Source
const (
	FloatPrecision uint = 53
)
View Source
const HashSizeBytes = 32
View Source
const (
	MAIN_CHAIN = "main"
)
View Source
const MaxAssociationTypeByteLength int = 64

Constants for UserAssociation and PostAssociation txn types.

View Source
const MaxAssociationValueByteLength int = 256
View Source
const (
	// MaxBlocksInFlight is the maximum number of blocks that can be requested
	// from a peer.
	MaxBlocksInFlight = 250
)
View Source
const MaxMessagePayload = (1024 * 1024 * 1000) // 1GB

MaxMessagePayload is the maximum size alowed for a message payload.

View Source
const (
	MaxUsernameLengthBytes = 25
)
View Source
const PublicKeyLenCompressed int = 33

A PKID is an ID associated with a public key. In the DB, various fields are indexed using the PKID rather than the user's public key directly in order to create one layer of indirection between the public key and the user's data. This makes it easy for the user to transfer certain data to a new public key.

View Source
const SECURE_MIDDLEWARE_RESTRICTIVE_CONTENT_SECURITY_POLICY = "default-src 'self'"

Variables

View Source
var (
	MaxUint256, _ = uint256.FromHex("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")

	// These values are used by the DAOCoinLimitOrder logic in order to convert
	// fixed-point numbers to and from their exponentiated representation. For
	// more info on how this works, see the comment on DAOCoinLimitOrderEntry.
	//
	// This value is a uint256 form of 1e38, or 10^38. We mainly use it to represent a
	// "fixed-point" exchange rate when processing limit orders. See the comment on
	// DAOCoinLimitOrderEntry for more info.
	OneE38, _ = uint256.FromHex("0x4b3b4ca85a86c47a098a224000000000") // 1e38
	// This is the number of base units within a single "coin". It is mainly used to
	// convert from base units, which is what we deal with in core, to a human-readable
	// value in the UI. It is equal to 1e18.
	BaseUnitsPerCoin, _ = uint256.FromHex("0xde0b6b3a7640000") // 1e18
)
View Source
var (
	UsernameRegex = regexp.MustCompile("^[a-zA-Z0-9_]+$")
	// Profile pics are Base64 encoded plus ": ; ," used in the mime type spec.
	ProfilePicRegex = regexp.MustCompile("^[a-zA-Z0-9+/:;,]+$")

	TikTokShortURLRegex = regexp.MustCompile("^.*(vm\\.tiktok\\.com/)([A-Za-z0-9]{6,12}).*")
	TikTokFullURLRegex  = regexp.MustCompile("^.*((tiktok\\.com/)(v/)|(@[A-Za-z0-9_-]{2,24}/video/)|(embed/v2/))(\\d{0,30}).*")
)
View Source
var (
	ArchitectPubKeyBase58Check = "BC1YLg3oh6Boj8e2boCo1vQCYHLk1rjsHF6jthBdvSw79bixQvKK6Qa"
	// This is the public key corresponding to the BitcoinBurnAddress on mainnet.
	BurnPubKeyBase58Check = "BC1YLjWBf2qnDJmi8HZzzCPeXqy4dCKq95oqqzerAyW8MUTbuXTb1QT"

	GenesisBlock = MsgDeSoBlock{
		Header: &MsgDeSoHeader{
			Version:               0,
			PrevBlockHash:         &BlockHash{},
			TransactionMerkleRoot: mustDecodeHexBlockHash("4b71d103dd6fff1bd6110bc8ed0a2f3118bbe29a67e45c6c7d97546ad126906f"),
			TstampSecs:            uint64(1610948544),
			Height:                uint64(0),
			Nonce:                 uint64(0),
		},
		Txns: []*MsgDeSoTxn{
			{
				TxInputs: []*DeSoInput{},

				TxOutputs: SeedBalances,

				TxnMeta: &BlockRewardMetadataa{
					ExtraData: []byte(
						"They came here, to the New World. World 2.0, version 1776."),
				},
			},
		},
	}
	GenesisBlockHashHex = "5567c45b7b83b604f9ff5cb5e88dfc9ad7d5a1dd5818dd19e6d02466f47cbd62"
	GenesisBlockHash    = mustDecodeHexBlockHash(GenesisBlockHashHex)
)

GenesisBlock defines the genesis block used for the DeSo mainnet and testnet

View Source
var (
	QuotedRepostVal    = []byte{1}
	NotQuotedRepostVal = []byte{0}
	IsFrozenPostVal    = []byte{1}
)
View Source
var (
	IsGraylisted   = []byte{1}
	IsBlacklisted  = []byte{1}
	NotGraylisted  = []byte{0}
	NotBlacklisted = []byte{0}
)
View Source
var (
	// The readOnlyUtxoView will update after the number of seconds specified here OR
	// the number of transactions specified here, whichever comes first. An update
	// resets both counters.
	//
	// We make these vars rather than const for testing
	ReadOnlyUtxoViewRegenerationIntervalSeconds = float64(1.0)
	ReadOnlyUtxoViewRegenerationIntervalTxns    = int64(1000)

	// LowFeeTxLimitBytesPerTenMinutes defines the number of bytes per 10 minutes of "low fee"
	// transactions the mempool will tolerate before it starts rejecting transactions
	// that fail to meet the MinTxFeePerKBNanos threshold.
	LowFeeTxLimitBytesPerTenMinutes = 150000 // Allow 150KB per minute in low-fee txns.
)
View Source
var (
	AllTxnTypes = []TxnType{
		TxnTypeUnset, TxnTypeBlockReward, TxnTypeBasicTransfer, TxnTypeBitcoinExchange, TxnTypePrivateMessage,
		TxnTypeSubmitPost, TxnTypeUpdateProfile, TxnTypeUpdateBitcoinUSDExchangeRate, TxnTypeFollow, TxnTypeLike,
		TxnTypeCreatorCoin, TxnTypeSwapIdentity, TxnTypeUpdateGlobalParams, TxnTypeCreatorCoinTransfer,
		TxnTypeCreateNFT, TxnTypeUpdateNFT, TxnTypeAcceptNFTBid, TxnTypeNFTBid, TxnTypeNFTTransfer,
		TxnTypeAcceptNFTTransfer, TxnTypeBurnNFT, TxnTypeAuthorizeDerivedKey, TxnTypeMessagingGroup,
		TxnTypeDAOCoin, TxnTypeDAOCoinTransfer, TxnTypeDAOCoinLimitOrder, TxnTypeCreateUserAssociation,
		TxnTypeDeleteUserAssociation, TxnTypeCreatePostAssociation, TxnTypeDeletePostAssociation,
		TxnTypeAccessGroup, TxnTypeAccessGroupMembers, TxnTypeNewMessage,
	}
	AllTxnString = []TxnString{
		TxnStringUnset, TxnStringBlockReward, TxnStringBasicTransfer, TxnStringBitcoinExchange, TxnStringPrivateMessage,
		TxnStringSubmitPost, TxnStringUpdateProfile, TxnStringUpdateBitcoinUSDExchangeRate, TxnStringFollow, TxnStringLike,
		TxnStringCreatorCoin, TxnStringSwapIdentity, TxnStringUpdateGlobalParams, TxnStringCreatorCoinTransfer,
		TxnStringCreateNFT, TxnStringUpdateNFT, TxnStringAcceptNFTBid, TxnStringNFTBid, TxnStringNFTTransfer,
		TxnStringAcceptNFTTransfer, TxnStringBurnNFT, TxnStringAuthorizeDerivedKey, TxnStringMessagingGroup,
		TxnStringDAOCoin, TxnStringDAOCoinTransfer, TxnStringDAOCoinLimitOrder, TxnStringCreateUserAssociation,
		TxnStringDeleteUserAssociation, TxnStringCreatePostAssociation, TxnStringDeletePostAssociation,
		TxnStringAccessGroup, TxnStringAccessGroupMembers, TxnStringNewMessage,
	}
)
View Source
var (
	// These transactions are simply here to bootstrap the profiles on the network. We had
	// some people testing things before it went live and wanted to preserve their profiles.
	SeedTxns     = []string{}
	TestSeedTxns = []string{

		"015e71a8a3b43fddb2cb9d487116338ffc8a089be76ce55b5fd16f7e20e3f47ebb000103aad5affbeee6118a91b914495f2bd0abffd0ac4782c2139a3ced0e353aa4ae49da7a068a20000762616c616a69731a3c703e747769747465722e636f6d2f62616c616a69733c2f703edf1f646174613a696d6167652f6a7065673b6261736536342c2f396a2f327743454141674742676347425167484277634a4351674b4442514e4441734c44426b534577385548526f6648683061484277674a43346e49434973497877634b4463704c4441784e44513048796335505467795043347a4e44494243516b4a4441734d4741304e47444968484345794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d762f4141424549414751415a414d4249674143455145444551482f7841476941414142425145424151454241514141414141414141414141514944424155474277674a436773514141494241774d4342414d4642515145414141426651454341774145455155534954464242684e525951636963525179675a476843434e4373634556557448774a444e69636f494a4368595847426b614a53596e4b436b714e4455324e7a67354f6b4e4552555a4853456c4b55315256566c64595756706a5a47566d5a326870616e4e3064585a3365486c3667345346686f6549695971536b3553566c7065596d5a71696f36536c7071656f716171797337533174726534756272437738544678736649796372533039545631746659326472683475506b3565626e364f6e7138664c7a39505832392f6a352b674541417745424151454241514542415141414141414141414543417751464267634943516f4c455141434151494542414d454277554542414142416e6341415149444551514649544547456b4652423246784579497967516755517047687363454a497a4e53384256696374454b46695130345358784678675a4769596e4b436b714e5459334f446b3651305246526b644953557054564656575631685a576d4e6b5a575a6e61476c7163335231646e64346558714367345346686f6549695971536b3553566c7065596d5a71696f36536c7071656f71617179733753317472653475627243773854467873664979637253303954563174665932647269342b546c3575666f36657279382f5431397666342b66722f3267414d41774541416845444551412f415061714b4b4d554146464648656741724d31727842706e682b32576655626c596735784847427565512b69714f542f41434663763852764878384a515132646973556d70334b6c6c4d764b776f4f4e784838524a3644323572784b396b3137786a657463586f6b75626c2f6b524a4d7156547163486f427766595a59347851423631716e7877384f5753736c7062334e334f4239304655516656763841616d384e2f46375364616e534f356c74724d75514172376c4f536363453848394b385930587772642b4b4e6353783062543175436f4264324a45435a343345396476314f546a69757a732f6778724c366d624f613349695253383871756f67633956566568395058337851423732724b36686c594d7036454867307465642b4835727277536e396e5874764f4e50334b49354c69596c687a3878554867714377393864754b39452f484e41425252525141744846464641435555744a514155645342533144647a6931733537672f38736f326b2f49452f77424b41504c62505459504748784d6b757232454745764967336b4b776a69796971423179784c6b6e2f437655443455306357567a6152326363635679686a6c32714d6c434d46515430424848487236313466384a333148567646736d71346b6b74394f676c6e534b4d457449584a4155456e4753636e6e6976554e61755048733976492b6c33476a576268437867614b53575350324c3872752f444641485736586f2b6e364c5a72616164615257304b67446247754d344741536570507561745453724247585a584948397853782f4963317a76677134312b62523258784463576339326a63535732506d552f3367414144394b79746138512b4a3766574a76374d4f697a574b714367637973787a3359714d4139652b4d55415876487470623674344c6e6b61586244437958445344494b71724173523379426b3439735646344e31523956384c5755307362527a704749706b62727555446e38657634314264617464613334583150547458734873356269786d4d63304c6834704d4b6337574249427a324a7a5758384d373058656e616a47522b3874706f6f6e4f63352f644b66356c767a6f41376d69696c6f414b4b4b4b41456f7061536742617a64654262517278414d37343968474d35424942483467347252714b35682b3057386b4f6346317744364873667a6f41356e34582b48573850324771776d4e6c4275676b6538446473564163456a726773772f4374505566437a7a617061366c50712b6f7969327933326447594c49782f3255494834592f4876544e4e3175574456622b30466d6d48564c75504d6f5142577970427a334471335156646e6e753954426a597869412f6569694a4959656a76787837415a2b6f6f4157317649493765565239706d615253486c6951754d386a6876346950555a35724558773232705132306474724e2f614a6163524e6253756762414149594167412b716b5a7963383130613269716f4453535a2f77426c746f2f4143713777584670634765336b4b7351417a624e7759446f4855646364694f61414456724a6f2f434772724737795379573072466e473073517077534f6d6341633435726a50684a7072576e686d34765a485a704e51754463454850413644723378585a334774734c4f51584e744538624c73667972674837334851674876533658617732576e5257317648356345513252726e4f4642774f66776f41755555555541464c69696967424b4b576b6f414b4f3946464146413238635775777a42522b2b67654d3539517763667a6170314d4c74734e354e757a3978704e702f4c414e564e58756862477a4b4b306c783536736b61444a5a656a2f6f33356b4372766d2b65676c524575625a786c53754d6a38447766304e4144785a322b442b35567339537733452f69615930554d4b2f386644776a303833414834484e526b5747666d67436e304d4a422f6c546c43352f30617a56542f66644e6748395451425876315734736f6f6b6c636d61346a5153734275474733456a4939464e5831554b67555a77426a6e72564e5a5264366b4657525a46737752497939504e5959782b43352f373646586141436969696742614b4b50776f41536969766e2f414f49586a2f786270766937556446743955614332676b2b517752694e74704149426247652b4f74414876747850466177505063537044436779306b6a42565565354e6342346c2b4d50686e5259474668634c71393252387364733379412f375439422b4754587a74714f7033757059463366334e797a4e3879764d7a2f6e6b6d71766c4c437042366e6f4b4150706e345758643534773054565045656f794c39766e752f4a673272386c756b574756564870754a4a3961363636747271654e727253646c766568735845442f635a752b3465762b304f534d56792f7752486b6541594c567475384d3078412f7742706d4838314e6478717a783246744c71545863566f734346705a4a76395755485a763645636a333655415a367936384a7843644d743258484d77754e696a2f674f436169764876476d537a38784a6275515a4e7462457173612f774236522f76626659594a7244384b664537536648476f5461665a585a7335567946526b4f2b5565714d65423334786d75323257656b574538345552777871303072395332426b7354314a774f706f413841316278394a34492b4b3839724377754e4b746f59724f36695142664d59444c4f423259466a6a3871396330507868346638526f447065715154502f7a7959374a422f774142626d766b37554c32585639617664546d623537715a37673768335a69522b6c5269507a477a76773436464f4d554166615051386969766c50512f696e3471384f4f74762f41476c4a6332364841697550336f78376275522b424665362b427669435047706b5347316a67654251307761546b357a3978526e6a703150656744754b4b5369674376663330476e57636c3163797048476e566e4f426e734b2b512f4645332f41425074516e74377837714b5335636965513879416b6e4a3631394e66456d79612b2b486574526f32313067383154366253442f41434272356a38523664467046326c684664435a746b636a507377446c6338653349363830415a3855697167437141657541436169754a585a6c546b44647a6e4171504c37386e6e36442b56575462454a6c786a75445142394a66434f36537a384761464b3771493556757265527a324b4f30696b2f6876726e664862613538522f433271367a424b396e346373464d746a616e68722f59666d6c663055444f3056642b44735547752f44753730753733474f432f634d46624232756f6247527941637344374531612b4d757477364c344c68304b30437850666b524b69444153424d5a2b672b36763530416563664348775a633633667a366e6d534f307465456c336c6633352b36526a6e4b416c76726756363538515045747a59664448573757396662716769573233714d435a5a4732695266596a646b646a6b656c63743842395a4c323271614849774c52737435467832623557483567666e566e3438583061614870476e74747a5063744b337273526638574835554165426252457a6c7541427836553172686b494233344a3639525669634b3879746b6263347a394b626454774e45565162736359365541567849584c6771583534794b2b67766770345a6974744a6b312b614d66616267744644496b755159754d67714f683344767a58694f67576e397058456b4a6c696a4372764d6b37375555444136386e754f42583052384c76446a364a7042757266567865324e2b676b38725951497051634e7450636359375a774b414f2f6f70614b414d627854382f68793968494253614d784e6b5a34595950343831386b367239387365544849554830782f774457723632385466384149436d2b712f7a72354a31582f6c722f414e64322f6b61414d637a4f534d48475053725379755967704a507a3479547a564772612f63482f4146306f4139342f5a2b6b59326576785a2b5153774f42376c5748394258492f4779396e6c386679784f2b5937654f4b4f4e66514664782f566a58562f732f66367278422f7651667965754d2b4e482f41435557392b6b502f6f746141462b4564334e423854394e6a6a62437a7779787944315861542f4d4374663436584d736e6a61317432624d55476e6f794c36466e596e2b512f4b734834552f386c5430582f646b2f7744526256736648442f6b66302f374230582f414b453141486c666d47545a45796772752f4774473567686874564b524c6b6e6b6e6d7374503841584a2f76567358332f48716c414768704869613674644d753950743757786957555a615a4950336e48624f6666307a3731395465484c4333307a7737703970616f5669574257414a7963734e7850356b3138666164392b622f645038712b79394d2f35424e6c2f313752662b674367433352525251422f2f32513d3de807d461002103aad5affbeee6118a91b914495f2bd0abffd0ac4782c2139a3ced0e353aa4ae4900463044022041123e82f809b41e566782a3f672ba78e7fead560a3cac5a0c2ce7738aefd41e02204af70a96b05b5e12b3503d41e106606ea5c57c0d754158165fcd14ee668c56b7",

		"01f0a8bf832ff02ee8bf0936db0666c9c1af7bc36ab57c747fe9bd2108902cc8f3000103aad5affbeee6118a91b914495f2bd0abffd0ac4782c2139a3ced0e353aa4ae49d07405ce040000bc047b22426f6479223a225c75303033636469765c75303033655c7530303363705c753030336554686973206973206120746573742e20486572655c75303032362333393b7320746865204b6c65696e20666f75722d67726f75703a5c7530303363696d67207372633d5c2268747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f7468756d622f392f39372f4b6c65696e5f666f75722d67726f75702533425f4361796c65795f7461626c652533425f73756267726f75705f6f665f53345f253238656c656d656e74735f302532433125324336253243372532392e7376672f32303070782d4b6c65696e5f666f75722d67726f75702533425f4361796c65795f7461626c652533425f73756267726f75705f6f665f53345f253238656c656d656e74735f302532433125324336253243372532392e7376672e706e675c2220616c743d5c227376672e706e675c225c7530303365205c75303033632f705c75303033655c7530303363705c75303033655c75303033636120687265663d5c2268747470733a2f2f656e2e77696b6970656469612e6f72672f77696b692f4b6c65696e5f666f75722d67726f75705c222072656c3d5c226e6f666f6c6c6f775c225c753030336568747470733a2f2f656e2e77696b6970656469612e6f72672f77696b692f4b6c65696e5f666f75722d67726f7570205c75303033632f615c75303033655c75303033632f705c75303033655c75303033632f6469765c7530303365227de807d46182bdd490cbb6e7a016002103aad5affbeee6118a91b914495f2bd0abffd0ac4782c2139a3ced0e353aa4ae49004630440220195f30b5afa46a8c854286a1bf4b3c484c0761c03dbbaf6658f05dfaadd421e702201359806b6d632d1fc9735d5f0652ecaf75767bb3d09f3873363143f60387890d",

		"019006717275a77fb150188e4522187065cfbc771ae47cf609f536956cb740df6f020102123085059a2f85bdd2e3e514b4aef0f3128652da20d40883cb2f70950c9a2be4c1ddeb170583020000f1017b22426f6479223a225c753030336368325c753030336541207461737465206f662066726565646f6d2063616e206d616b6520796f7520756e656d706c6f7961626c6520666f72206c6966655c753030336362725c75303033655c75303033632f68325c75303033655c75303033636469765c75303033655c7530303363696d67207372633d5c2268747470733a2f2f692e7974696d672e636f6d2f76692f35617665495a456c6d734d2f6d617872657364656661756c742e6a70675c2220616c743d5c226d617872657364656661756c742e6a70675c225c7530303365205c75303033632f6469765c7530303365227de807d461b189e7e9d7e8e99e16002102123085059a2f85bdd2e3e514b4aef0f3128652da20d40883cb2f70950c9a2be40046304402200ce37e660dfa13a9e6bb55a92f5522f43e01e9a8db662c94b54f7fde9aabefde0220531302c99524f744e669eb7742750857eeb766a07ee89a0fcebffef4335dd380",

		"01c8e71ed7bbc785fbb014ebbf21a45b411f28dbb1be528c1f72712f1bbd819fa8000102123085059a2f85bdd2e3e514b4aef0f3128652da20d40883cb2f70950c9a2be4ceaaeb1706f51a0008766c6164696d697200e31a646174613a696d6167652f6a7065673b6261736536342c2f396a2f327743454141674742676347425167484277634a4351674b4442514e4441734c44426b534577385548526f6648683061484277674a43346e49434973497877634b4463704c4441784e44513048796335505467795043347a4e44494243516b4a4441734d4741304e47444968484345794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d762f4141424549414573415a414d4249674143455145444551482f7841476941414142425145424151454241514141414141414141414141514944424155474277674a436773514141494241774d4342414d4642515145414141426651454341774145455155534954464242684e525951636963525179675a476843434e4373634556557448774a444e69636f494a4368595847426b614a53596e4b436b714e4455324e7a67354f6b4e4552555a4853456c4b55315256566c64595756706a5a47566d5a326870616e4e3064585a3365486c3667345346686f6549695971536b3553566c7065596d5a71696f36536c7071656f716171797337533174726534756272437738544678736649796372533039545631746659326472683475506b3565626e364f6e7138664c7a39505832392f6a352b674541417745424151454241514542415141414141414141414543417751464267634943516f4c455141434151494542414d454277554542414142416e6341415149444551514649544547456b4652423246784579497967516755517047687363454a497a4e53384256696374454b46695130345358784678675a4769596e4b436b714e5459334f446b3651305246526b644953557054564656575631685a576d4e6b5a575a6e61476c7163335231646e64346558714367345346686f6549695971536b3553566c7065596d5a71696f36536c7071656f71617179733753317472653475627243773854467873664979637253303954563174665932647269342b546c3575666f36657279382f5431397666342b66722f3267414d41774541416845444551412f41504438303544544f314f5470534b366a7761565430706e7255397243626935696858724977583836426f3662777234516b312b565a7271593231687577584179386d4f7577663150483172325052664450672f5372666246346468756d364e4c654d5a585035384438414b352f526f3067736f6767323844414136416442585132643742396f386e37516d2f70744a727a5a3469626c377578364650445135627a473674384e76436e694f316b2f7336322f73612b41796a524e6d4e6a3771655079785869586958773171666854552f73577077624759626f33427973712f336c5070587638414c6370417059796f75665671354834673278316a77704d585979535749382b4167357750346839434d2f6b4b306f346d584e797a366d6466435255584b4234715a4f4b694c356f592b394d4a7230447a6863304e77545463386970722b50794c32574c2b366636564e396246637235655968794b4d696d5a6f7a5645682f44546f786d676a3933546f686b564639446f55666551673731306e676d316a7539644964555a6f344864413534794d44383845317a593731712b4864554f6a3635615878424b5274687776557152672f7a714b6962673069714c536d6d396a313278674d396d4556796a5979434f745248514c6a7a2f41445074443767516435427a2f50485771396a716b4631494c2b336c64344a574f474b3753656534375630563365547459683765487a6e5567695064743344767a586c7136756a316c613130564e52307536613653534f59694d375142754b37654f54304f54557374764d746d304e367764586a5a584b6a2b457152302f4772756d616c4a65704a4a505a74417531514e357a7550394b77664632745132756936684e35717249497a46437537424c74787750624a2f4b7031756b74796e626c626c7365486e6a6a303470704e4b656e576d4531375a38384f4235725438524b453132354136664b662f4852575154576e34686666724d726735796b5a2f3841484257542f697839482b6876482b424c315835534d374e47615a6d6a507657706757796e2b6a4530747375564e5373762b676b303679584d5a72427939316e70716e2b38697649716763742b4e4f6a483361756162706c3571743662577774704c6963676b4a474d6e48716653756d58345a654b6f6a4573326e787846756f6534544b2f55416b6971636b747a434d4e55546544395245576d74424f7045586e4d71766a6a6e422f72585672625863397635746c6379507a38346a75504b782b50616f5044386567785742384c617578302f55726432594e4e494e73724e7a6c473645644f4436567a6b326f7757657358466c61547335686c614c664753466b77635a466364536b2b5a795231557138624b4c334f346a6a314f3274773933634d426e4152335279332f4167425843654c70497232385246473559304b6c76636e4a727576442b6c535879704e4f353873454576492b45583854785847654934625a64587649725734676e6a535674725179623132354f4d48765745564a53352b683079634a707762314f42754944412b436367394455445674586b4f3846652b4f4b647048672f584e64686561787374384b6e486d5049714b5437466a7a2b46656e436f6d727338657252635a57534d426a78567a56574c337537316a542f414e42464f316e5272375174516179314345527a716f6241594d47553943434f434b70334c6c354153663456483656567279545246375163583566715238305a4e4e7a526e33717a4d33594c64377132454d52547a484f46447571412f69534257705a364e6232635a2f74445662614a6765597263475a2f707867412f6a58506b354f505374337733706333695058725054496e43764f34566e592f6455444a5076674138566b6f4b327032564d544c6e7648533268332f41494f307a543757306c75744e467952636346376a415a73487342304761374270316d5569596c6d3735593830532b48786f5670486232323537574e51456475575564743376373944584e367a717161626154586330677847506b6a2f7648734b345a336c4a6e5a536b6c424f357a6e78415741616c7049756f4565315865485346747262636a7636342f437558306a7737724775582f2f41424b374b65544d6a415368534634353550544f4b7058577058477058472b6438675a32676e4f4d3831374838492f476c705a61524c6f326f794349514d30304d6836624479775066673950726975326e4677676b7a7a6130314f6f3549383238565776696d796e6a734e5a4e35354b6a3931356d566a59663750474b69384b7461616672476454684531724c47555a577a67636a6b456335474b2b705a4470327536566c6c6875374364417973774452794b5231482b4e654466466653744e304b37307550544c564c654e684c77766341726a2b5a71756c694533653548652b4664426d6d6975374c575761325935613345666d534165675966314661646c71467a4e644b746c617157414f576d4b694b41442b4841364848714d3135786233525268496b3677734477532b30316f326572726433506c586c2b493432484c42507645644d6e76584e557074367061486f554b385637736e7164623436304b665739434d376d4c37625949307165577077366457546e38783950657647584f534437563942364a4a466361636a4b356c2f684f57445a483172786e78543461766443316d346761306e2b796c79626558793232756e55594f4d635a77617644536573575a34324375706f352b6b707852676346534437696b326e30503556316e41614841596a72394b75326431505958554e31617974465043346b6a646571734f68716e4879546d704b676535394665472f47316e346c30574b376d6c696776455a596269497342686a774d5a366875333556795078566a305748534147486c616d307761336a6a66377939474c4c3041392f58474f39655a36456979612f5952754e794e637835553944387772582b4a6b7276342f31494d784954793158324777636671617a355065755770766c73637645635341383472566a6a456157383038544e62752b666b62617a41486b4139756e577379443775652b613648554f50446d6a34342f316e2f6f5272526b4830786f4d476e522b4372434853636d7746735049334e6b6c547a7966584a4f66657646766a59344f75365a45702f31646f5352365a632f345633587765755a7076682f50484a49575347376b534d482b46537174676669536678727a6a34754f7a654e63453543326b514874393430756f4938364c5a4f434f6c4b43696b4d565545486a4e4a363143354a3450536d467a313777566f63757257384d79615642645730772f312b7864716b443574782f684950623656662b4a576c36566f50684f4f4f794b322b705856796f6a6b684a517146423341592f6836412b7049394b58344e54534877753646323270645368567a774274552f7a4e637638565a704a4e547367376c68746b362f55437346424b65683054717555624d38372f747a56304a582b3037304563454764755031705037653166384136436c352f77422f322f787174666b2f616433646c42507561725a5072585263357a2f2f32513d3de807d461002102123085059a2f85bdd2e3e514b4aef0f3128652da20d40883cb2f70950c9a2be4004730450221008b352a6233e00b7ccfed62e40ab518b031f24ef2471bcee4b6a0c020d9c8c76602207e3a7ab017374854b3a0cfc34db7e9766a56e6d3a34f608e331cfb21582520c8",

		"011aa7e639a5c1c4f3923bdd5f36e0cc54c04bba68342de82e038cb212e7dc2e80020102123085059a2f85bdd2e3e514b4aef0f3128652da20d40883cb2f70950c9a2be494c0d72f06310000283c703e566c6164696d6972206861732066756e20706f7374696e67206e6577733c62723e3c2f703e00e807d461002102123085059a2f85bdd2e3e514b4aef0f3128652da20d40883cb2f70950c9a2be40046304402204aa9ab0a3e78524441609dfd9c0e028de0d9016a8d28fd54c3b55cbc2674db2002206e35dd4118449252967fa263e7e923015e39b168ae622d8625ce8f3051ef906b",

		"0141f58714ed013b1ee16e06dbe28b47f738ec159704269975a5dcbe0752138322010102397b1a80eba0a60644650af13c2a6ffdfbbf38830cafc34937a75ddd44b8ce52f7dfcfaa06054e00208c86eede87a561553c5672ada25cc0724938d7134de5f8e81040a3cf177480a21e7b22426f6479223a2266666666666666666666666666666666666666227d00d461f2b692b0ace797a116002102397b1a80eba0a60644650af13c2a6ffdfbbf38830cafc34937a75ddd44b8ce520046304402203cb2f4e486caf8bbc674781b976cb71f779da0cbe4d83b823eeaec1687e44c7f02200f78335ba3d4fee1625162ae71e224f84ca6e920c9989e25ad1f042dc88ab991",

		"0182d2f0b361e4f00161f81247bb27c173065a315b37c1b2a30dbb45b167c448e3000102397b1a80eba0a60644650af13c2a6ffdfbbf38830cafc34937a75ddd44b8ce52fbddcfaa06054100207eba2b76e2b1851070f2740e25c1c70c64a228e226f0dff5734f19d3baca8224117b22426f6479223a226c617777776c227d00d46180df88abc5e797a116002102397b1a80eba0a60644650af13c2a6ffdfbbf38830cafc34937a75ddd44b8ce5200473045022100bdd3b1348c8709c385a5ebbb7fda3f6ebd8fc368c8e95e2f7cdc1b0f6d00b4b002201e355fe9b04acd192b3e552eac667b7697d7c9913286ab8091b718a37e542308",

		"0147f91c232d725f915493355620709dd759ff8620452d2b145a17d6950cca4b38010102397b1a80eba0a60644650af13c2a6ffdfbbf38830cafc34937a75ddd44b8ce52dd80f8fa0506e71d000b43727970746f5472756d702f3c703e4920414d20544845204245535420504552534f4e204f4e205448495320504c4154464f524d2121213c2f703ea31d646174613a696d6167652f6a7065673b6261736536342c2f396a2f327743454141674742676347425167484277634a4351674b4442514e4441734c44426b534577385548526f6648683061484277674a43346e49434973497877634b4463704c4441784e44513048796335505467795043347a4e44494243516b4a4441734d4741304e47444968484345794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d6a49794d762f4141424549414751415a414d4249674143455145444551482f7841476941414142425145424151454241514141414141414141414141514944424155474277674a436773514141494241774d4342414d4642515145414141426651454341774145455155534954464242684e525951636963525179675a476843434e4373634556557448774a444e69636f494a4368595847426b614a53596e4b436b714e4455324e7a67354f6b4e4552555a4853456c4b55315256566c64595756706a5a47566d5a326870616e4e3064585a3365486c3667345346686f6549695971536b3553566c7065596d5a71696f36536c7071656f716171797337533174726534756272437738544678736649796372533039545631746659326472683475506b3565626e364f6e7138664c7a39505832392f6a352b674541417745424151454241514542415141414141414141414543417751464267634943516f4c455141434151494542414d454277554542414142416e6341415149444551514649544547456b4652423246784579497967516755517047687363454a497a4e53384256696374454b46695130345358784678675a4769596e4b436b714e5459334f446b3651305246526b644953557054564656575631685a576d4e6b5a575a6e61476c7163335231646e64346558714367345346686f6549695971536b3553566c7065596d5a71696f36536c7071656f71617179733753317472653475627243773854467873664979637253303954563174665932647269342b546c3575666f36657279382f5431397666342b66722f3267414d41774541416845444551412f414f692b4d5069582b7a644c743947743550333932664d6d414f4349683042396966304272784e726f7941687052763646683058324662587846316c6462386258313270486c4b5242486c7543715a476678362f6a57426257356c797952672b2b44696f6c4b37495553534f4568774e3252366e76567943324c6b63452f30716531302b5238626c7a5856615a6f6a4f46496a7839617a647a6f6843356957326d747838754165685061744b4c5357786e49493954585677364b45786e6731502f5a36727755552f685335724779676a6a704e4f38735a3446514e45454a36676a314f525858543251412b377a37566961685971716c6c47574866464371436c5254324d706f784b426a747a7a3142714a3430427943446a723378534e3573545a49497765445353346c2b5948424a344f4b3035726e504b6d346b7355757a47472b5850466574664432627a39456b5134506c79484848596976474a495a5558666a497a31577657506867386e3247354439474b6b66686b56634c6d556a3044416f7750536c78526a337261784a386777774d376c705474424f5170417961362f51744d2b314141634c363434726a596c437a446447514d392b4b377a5362703472634c4777585047514f61775453315a70474c62736a6654547257435256484c66537569302b4f4e59686852396177724333553757596b74366b354a72637470466a35504f4f657459637a6b7a73355646574e456846475770725252794a77617a376a5737464d52794d413550417752556158316934334c6468474842556d6d78786148584b4144672f685652376353416738357156376d4f515a527732546747677a4972424e347a744a7a6d736d624c597a4a64475275617248536f30626851635666625537627a6d426c36635a3756473135437a426b6c556a317a546a6447636d6e6f7a4f314b3152624d7156414937676331315077352f63466f54314959342f4556792b757a374c62654d594a4177666575693847466c31477763634b386367505074782f4c394b366f75364f476f724d394f41346f785551626755753456707a6f7a3557664e77303570775a376b69516c69547741525776706c7447484730644f4d314e66326b73576e736c735173684f30635a4f54314e50302b4d326b5563552f456f476135334b3650516c54355a58527078735647464f43505563556b75732f5a6c45666b504c4d352b564931334d7839753334303677635453685736567269326a57514d6971472f7659352f4f736c4b7a4b6b726e44333133346775575a5234595a6b50386254416e394b7a787032704759724e617952385a4731695150782f2f565870666b3344483547544872564339745a465a53386d543246564b55626145786a4b2b707a6d673239306c3669547a7533505139716c3854527a77334551686b6b546370425a6131724b46557651527a67302f57596c6c6e55594848576f586331656d68357264586a3238684d6e32356f6a3064454a42476670697569304856744e6d5a454e772b39683871797274592f6e5853573865457973616e334e52582b6d52586b5369346843674d47444b65515256707857706b34747655794e64496c736d57507363382f57756c30435a597276535931497a6c546a366a4e595637624567526a6c5467416a767a577034657335726a58496d4f504a74634e7a2f75344662306c7a5051354b2f75725539534536592b384b504f542b2b4b797830706136507178792f57456563724c495651424e3338594f4f6e4743507a724d6c6b616443374169524a43507771696e695951333777334a327779536c30596475324b747665326c7a644d4c5a6965686359774161382f37586b6575704b554c6b39764f384c3548424865756a7337337a6f3848466338792f506b437230475938484f5070536c7558485648524356554755775437316d617065724568643247515038414f4b55546c59386a705748715564334f4775493033694a6779702f65494e536d56796d70704a6b6e4a6c5a434f6334702b74544d6b443341552f4a676668584b32666950574c46705a6275785a494750794564562b6f7039783473754c6f78775232627949342b647359412f787254545968706e57576b6d4978774f6c4f7535564b383167615663797046484849434758672f30713764796c6b3436314679334571336c776937587a674b635a4e645a3459516d796c6c4947576647665841726c466745694a752f7668695055597276394e736d744e4e696a503373626a78334e642b4456356568354759797444314c426b7765744a357676556252746d6b387331363268345632654f7034664f735274634c7749474750553449712f64774c6150357139536356706174716b58674f3264627a5a4f4a326279496c487a6e312f41565731574b66374350744d4a696d43493749653251442f4931343034636b667a506f4d50506d6b794b326e38357335366442577a626a7a4f505431726c624363724c744a344a7270724f5651334c59394b354a486f775a64534d2b5946623776657035486941324c6a36656c56376f476359686b326e47633436566b7a3241747a766d315737436e37786a566344394b5564536d7a556131696c5678685366516e72564e374f4b493543716655656c557862366249344b2b495855676447565254477462555a4d5775795353486b624556686e2f50765776497262695a63614e4d68312b68715a347949386b6331485932386f634a4c634c4b765864747766787135644f7149514f6e63316c31427651302f444f6c513330725454676c6263676852305a7565746468494d566b65456f44466f6f6d624f626879347a2f6448412f6c57784a3372317350486c696a352f4679353576794b6a45687162754e4f6637314e72724f4b783832572b7233506a4c346a366663366951566e76496b57503841685350654d4b4b392f77444847682b666172714d532f63587935675037765a7677503647766d5051727a2b7a7466734c7739494c694f512f514d43612b306c45647842304478534c30504949492f77727a313730476d656e666b714a6f2b635a6f7a62546e726b486b56705756336e44416a4831726538622b465a4e4b757674454d5a617a632f492f58596637702f6f61344b5a70725a795559685431466356534469657054714a366f3941745a49356b2b384433344f4b5357304374754c6b44766e30726837445570625a3978636b64733130796131485043724e4b75635949724e4c716271535a6f2f32626179414f59304f6535417173326c787874694a4651483046527071614b7679754d65745176726c75736d412b653541717655624c61774e4143533350765459466c314f2f68735973683558326e483849376e38426d734b2b3851504e4b7363436b353448756670586f76677a773950706b4c582b6f4c69396d58416a50574a66512b35372b6c5852703838374935635458564f462b7031634d53515178777872694f4e51716a3041706b687a557537696f47363136305565424a3349474850536b775054394b632f7742377152394b622b4a72557a506a3448357858324e34467535623777506f74784f515a4874493978486641782f53766a67666648317237412b48502f4a5074442f3639457267702f437a30716e78493653356769757264345a34316b6963595a5747515258687669765372585464637562573356764b424741787a6a4e65374e3072786678332f77416a52646638422f6b4b552f684e6144393678773030616f53464655704352304a4658376e37782f4371456c656655305a337732497a4c4a356530534d4239616662707563416b6b66576f6a39327072582f41466c5a377330364550695741516547594c794a3357563777786b687363424e772f57765a506866346931447846345557665558575361462f4b4567474377413674366d76495046582f496c327638413245472f394669765376676e2f774169644c2f3138742f4956362b4753533037486a5976586675656c476f32342f4b704433706a663072704f4568666871626d6e5038416570745751662f5ae807d461002102397b1a80eba0a60644650af13c2a6ffdfbbf38830cafc34937a75ddd44b8ce520047304502210099eeee29c1a51b4de0b8bfe42977dc95d76c168e75df83f4faa401f37743bc3102201f6d4f9239754fa58d1e67f2db6f86cf0977b78e8dc6dc24449e4ffaec34d2cd",

		"0176af9a4ea8a9783249fbad57743ee9f12ff10e5a02bac7e40d397162b69549a9000102397b1a80eba0a60644650af13c2a6ffdfbbf38830cafc34937a75ddd44b8ce52c8fef7fa05055a0000497b22426f6479223a225c7530303363705c753030336554686973206973206120706f73742066726f6d207468652043727970746f5472756d705c75303033632f705c7530303365227df403d461d0e7f3a2a2fc97a116002102397b1a80eba0a60644650af13c2a6ffdfbbf38830cafc34937a75ddd44b8ce52004630440220151fb0af92ac4db9b3c0fcc35306df1c0f4e00c314802f8f7080b86ed6199f9502203c92d4e0ac33ee4981d1e8e1abb2dafea2e7cba4dccedc1d3cffaf919c5ccaa5",

		"014b161a70f82c0853ecbd42bf934e139eac1857675578f112c2ff3aa6ec5d9812020102397b1a80eba0a60644650af13c2a6ffdfbbf38830cafc34937a75ddd44b8ce52f581af5f06500000473c703e4920414d20544845204245535420504552534f4e204f4e205448495320504c4154464f524d21212120414e4f544845522050524f46494c4520555044415445213c2f703e00e807d461002102397b1a80eba0a60644650af13c2a6ffdfbbf38830cafc34937a75ddd44b8ce5200473045022100a5714789c19fbba22d8f5845ef8ffd53c48dd41995e283753ba0c67744b73cd2022026b806c5b756da02cbde6480888e9d88aeb83e6adf161cd2b0b21b23575f9454",

		"0147dc3c620db733240a309c01f501d0d01c21e7a5f795308dccc100b133869ec1000102397b1a80eba0a60644650af13c2a6ffdfbbf38830cafc34937a75ddd44b8ce52fafdae5f057c00006b7b22426f6479223a225c753030336368315c7530303365414e4f5448455220504f53545c75303033632f68315c75303033655c75303033636469765c7530303365486f775c75303032362333393b732074686973206f6e653f5c75303033632f6469765c7530303365227df403d461ea95c6f8d98198a116002102397b1a80eba0a60644650af13c2a6ffdfbbf38830cafc34937a75ddd44b8ce520046304402206d6335b5d7ecba50626411695f17955e523ea0d8ebec75c076aadbc95d6c439202203b3365c7c6ec5ab7565e64cdeae8f2b0a4932b7a1906339d55fd88d1db9afb9a",

		"013e42215a120a6e9d4848117f5829a2c4d9f692360fd14b78daea483a72d142dc000102397b1a80eba0a60644650af13c2a6ffdfbbf38830cafc34937a75ddd44b8ce52f9fbae5f054600203e42215a120a6e9d4848117f5829a2c4d9f692360fd14b78daea483a72d142dc167b22426f6479223a226666666666666666666666227d00d461a682a4f9f18198a116002102397b1a80eba0a60644650af13c2a6ffdfbbf38830cafc34937a75ddd44b8ce520046304402203ae6599a5b81e0c0a85cc5efbf008ed1e78a82c6152b2ad9127e10952faecbdd0220211475a8384c52d7a04781f7d704835e6ed8543a466551dd7c39187cecb714a0",
	}
	SeedBalances = []*DeSoOutput{}/* 482 elements not displayed */

	// In early blocks there was a bug that allowed users to claim usernames that
	// weren't actually available. This map defines exceptions for these cases that
	// assign a new username to the profile. It maps transaction hashes to new
	// usernames.
	ForgivenProfileUsernameClaims = map[BlockHash]string{
		*mustDecodeHexBlockHash("1f30c115192d72aa01149f08879db14158e66d859c1bd3bee3a2127cbd6f89fd"): "_nbatopshot",
		*mustDecodeHexBlockHash("8fe4f1ec5e5c53d610be773aa8e45680a3d7a55abf29aaab4e9ce2482e06c994"): "__nbatopshot",
		*mustDecodeHexBlockHash("3337781344dd5005541d028e8605bbc0851219d70b28d86a7f352877f3a1fde5"): "___nbatopshot",
		*mustDecodeHexBlockHash("5f52811f80c73764d887d7f82c6c233bb11da00a77dff11a85f7be851bd5745b"): "____nbatopshot",
		*mustDecodeHexBlockHash("02a3a9e28622b59ee59148847814deedb41b160c1edb5100b6964909351b4c04"): "_JulSwap",
	}
)
View Source
var (
	NaturalLogOfTwo = BigFloatLog(NewFloat().SetUint64(2))

	DeflationBombBlockRewardAdjustmentBlockHeight = uint32(32060)

	MiningSupplyIntervals = []*MiningSupplyIntervalStart{
		{
			StartBlockHeight: 0,
			BlockRewardNanos: 1 * NanosPerUnit,
		},

		{
			StartBlockHeight: DeflationBombBlockRewardAdjustmentBlockHeight,
			BlockRewardNanos: NanosPerUnit * 3 / 4,
		},
		{
			StartBlockHeight: DeflationBombBlockRewardAdjustmentBlockHeight + BlocksPerDay,
			BlockRewardNanos: NanosPerUnit / 2,
		},
		{
			StartBlockHeight: DeflationBombBlockRewardAdjustmentBlockHeight + 2*BlocksPerDay,
			BlockRewardNanos: NanosPerUnit / 4,
		},
		{
			StartBlockHeight: DeflationBombBlockRewardAdjustmentBlockHeight + 3*BlocksPerDay,
			BlockRewardNanos: NanosPerUnit / 8,
		},
		{
			StartBlockHeight: DeflationBombBlockRewardAdjustmentBlockHeight + 4*BlocksPerDay,
			BlockRewardNanos: NanosPerUnit / 10,
		},

		{
			StartBlockHeight: 15 * BlocksPerYear,
			BlockRewardNanos: NanosPerUnit / 20,
		},
		{
			StartBlockHeight: 32 * BlocksPerYear,
			BlockRewardNanos: 0,
		},
	}

	// This is used for various calculations but can be updated on the fly with a
	// special transaction type in the event that the Bitcoin price fluctuates
	// significantly. We make this a var rather than a const so that tests can
	// change the value.
	InitialUSDCentsPerBitcoinExchangeRate = uint64(3000000)
)
View Source
var (
	ZeroPKID      = PKID{}
	ZeroPublicKey = PublicKey{
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00}
	ZeroBlockHash = BlockHash{}
	MaxPKID       = PKID{
		0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
		0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
		0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
		0xff, 0xff, 0xff}
)
View Source
var DeSoMainnetParams = DeSoParams{
	NetworkType:        NetworkType_MAINNET,
	ProtocolVersion:    1,
	MinProtocolVersion: 1,
	UserAgent:          "Architect",
	DNSSeeds: []string{
		"deso.coinbase.com",
		"deso.gemini.com",
		"deso.kraken.com",
		"deso.bitstamp.com",
		"deso.bitfinex.com",
		"deso.binance.com",
		"deso.hbg.com",
		"deso.okex.com",
		"deso.bithumb.com",
		"deso.upbit.com",
	},
	DNSSeedGenerators: [][]string{
		{
			"deso-seed-",
			".io",
		},
	},

	GenesisBlock:        &GenesisBlock,
	GenesisBlockHashHex: GenesisBlockHashHex,

	MinDifficultyTargetHex: "000001FFFF000000000000000000000000000000000000000000000000000000",

	MinChainWorkHex: "000000000000000000000000000000000000000000000000006314f9a85a949b",

	MaxTipAge: 24 * time.Hour,

	BitcoinBtcdParams:  &chaincfg.MainNetParams,
	BitcoinBurnAddress: "1PuXkbwqqwzEYo9SPGyAihAge3e9Lc71b",

	BitcoinStartBlockNode: NewBlockNode(
		nil,
		mustDecodeHexBlockHashBitcoin("000000000000000000092d577cc673bede24b6d7199ee69c67eeb46c18fc978c"),

		653184,
		_difficultyBitsToHash(386798414),

		big.NewInt(0),

		&MsgDeSoHeader{
			TstampSecs: 1602950620,
			Height:     0,
		},
		StatusBitcoinHeaderValidated,
	),

	BitcoinExchangeFeeBasisPoints: 10,
	BitcoinDoubleSpendWaitSeconds: 5.0,
	DeSoNanosPurchasedAtGenesis:   uint64(6000000000000000),
	DefaultSocketPort:             uint16(17000),
	DefaultJSONPort:               uint16(17001),

	DialTimeout:               30 * time.Second,
	VersionNegotiationTimeout: 30 * time.Second,

	BlockRewardMaturity: time.Hour * 3,

	V1DifficultyAdjustmentFactor: 10,

	TimeBetweenBlocks: 5 * time.Minute,

	TimeBetweenDifficultyRetargets: 24 * time.Hour,

	MaxDifficultyRetargetFactor: 4,
	Base58PrefixPublicKey:       [3]byte{0xcd, 0x14, 0x0},
	Base58PrefixPrivateKey:      [3]byte{0x35, 0x0, 0x0},

	MaxTstampOffsetSeconds: 2 * 60 * 60,

	MaxBlockSizeBytes: 16000000,

	MinerMaxBlockSizeBytes: 2000000,

	MiningIterationsPerCycle: 95000,

	MaxUsernameLengthBytes: MaxUsernameLengthBytes,

	MaxUserDescriptionLengthBytes: 20000,

	MaxProfilePicLengthBytes: 20000,
	MaxProfilePicDimensions:  100,

	MaxPrivateMessageLengthBytes: 10000,

	MaxNewMessageLengthBytes: 10000,

	StakeFeeBasisPoints: 10 * 100,

	MaxPostBodyLengthBytes: 20000,
	MaxPostSubLengthBytes:  140,

	MaxStakeMultipleBasisPoints: 10 * 100 * 100,

	MaxCreatorBasisPoints:    100 * 100,
	MaxNFTRoyaltyBasisPoints: 100 * 100,

	SeedTxns: SeedTxns,

	SeedBalances: SeedBalances,

	CreatorCoinTradeFeeBasisPoints: 1,

	CreatorCoinSlope:        NewFloat().SetFloat64(0.003),
	CreatorCoinReserveRatio: NewFloat().SetFloat64(0.3333333),

	CreatorCoinAutoSellThresholdNanos: uint64(10),

	ForkHeights:                 MainnetForkHeights,
	EncoderMigrationHeights:     GetEncoderMigrationHeights(&MainnetForkHeights),
	EncoderMigrationHeightsList: GetEncoderMigrationHeightsList(&MainnetForkHeights),
}

DeSoMainnetParams defines the DeSo parameters for the mainnet.

View Source
var DeSoTestnetParams = DeSoParams{
	NetworkType:        NetworkType_TESTNET,
	ProtocolVersion:    0,
	MinProtocolVersion: 0,
	UserAgent:          "Architect",
	DNSSeeds: []string{
		"dorsey.bitclout.com",
	},
	DNSSeedGenerators: [][]string{},

	BitcoinBtcdParams:             &chaincfg.TestNet3Params,
	BitcoinBurnAddress:            "mhziDsPWSMwUqvZkVdKY92CjesziGP3wHL",
	BitcoinExchangeFeeBasisPoints: 10,
	BitcoinDoubleSpendWaitSeconds: 5.0,
	DeSoNanosPurchasedAtGenesis:   uint64(6000000000000000),

	BitcoinStartBlockNode: NewBlockNode(
		nil,
		mustDecodeHexBlockHashBitcoin("000000000000003aae8fb976056413aa1d863eb5bee381ff16c9642283b1da1a"),
		1897056,
		_difficultyBitsToHash(424073553),

		big.NewInt(0),

		&MsgDeSoHeader{
			TstampSecs: 1607659152,
			Height:     0,
		},
		StatusBitcoinHeaderValidated,
	),

	DefaultSocketPort: uint16(18000),
	DefaultJSONPort:   uint16(18001),

	DialTimeout:               30 * time.Second,
	VersionNegotiationTimeout: 30 * time.Second,

	GenesisBlock:        &GenesisBlock,
	GenesisBlockHashHex: GenesisBlockHashHex,

	TimeBetweenBlocks: 1 * time.Minute,

	TimeBetweenDifficultyRetargets: 3 * time.Minute,

	MinDifficultyTargetHex: "0090000000000000000000000000000000000000000000000000000000000000",

	MinChainWorkHex: "0000000000000000000000000000000000000000000000000000000000000000",

	MaxTipAge: time.Hour * 24,

	MaxDifficultyRetargetFactor: 2,

	BlockRewardMaturity: 5 * time.Minute,

	V1DifficultyAdjustmentFactor: 10,

	MaxTstampOffsetSeconds: 2 * 60 * 60,

	MaxBlockSizeBytes: 1000000,

	MinerMaxBlockSizeBytes: 1000000,

	Base58PrefixPublicKey:  [3]byte{0x11, 0xc2, 0x0},
	Base58PrefixPrivateKey: [3]byte{0x4f, 0x6, 0x1b},

	MiningIterationsPerCycle: 9500,

	MaxUsernameLengthBytes: MaxUsernameLengthBytes,

	MaxUserDescriptionLengthBytes: 20000,

	MaxProfilePicLengthBytes: 20000,
	MaxProfilePicDimensions:  100,

	MaxPrivateMessageLengthBytes: 10000,

	MaxNewMessageLengthBytes: 10000,

	StakeFeeBasisPoints: 5 * 100,

	MaxPostBodyLengthBytes: 50000,
	MaxPostSubLengthBytes:  140,

	MaxStakeMultipleBasisPoints: 10 * 100 * 100,

	MaxCreatorBasisPoints:    100 * 100,
	MaxNFTRoyaltyBasisPoints: 100 * 100,

	SeedTxns: TestSeedTxns,

	SeedBalances: SeedBalances,

	CreatorCoinTradeFeeBasisPoints: 1,

	CreatorCoinSlope:        NewFloat().SetFloat64(0.003),
	CreatorCoinReserveRatio: NewFloat().SetFloat64(0.3333333),

	CreatorCoinAutoSellThresholdNanos: uint64(10),

	ForkHeights:                 TestnetForkHeights,
	EncoderMigrationHeights:     GetEncoderMigrationHeights(&TestnetForkHeights),
	EncoderMigrationHeightsList: GetEncoderMigrationHeightsList(&TestnetForkHeights),
}

DeSoTestnetParams defines the DeSo parameters for the testnet.

View Source
var GlobalDeSoParams = DeSoTestnetParams

GlobalDeSoParams is a global instance of DeSoParams that can be used inside nested functions, like encoders, without having to pass DeSoParams everywhere. It can be set when node boots. Testnet params are used as default. FIXME: This shouldn't be used a lot.

View Source
var (
	InitialGlobalParamsEntry = GlobalParamsEntry{

		USDCentsPerBitcoin: 0,

		MinimumNetworkFeeNanosPerKB: 0,

		CreateProfileFeeNanos: 0,

		CreateNFTFeeNanos: 0,
		MaxCopiesPerNFT:   0,
	}
)

InitialGlobalParamsEntry to be used before ParamUpdater creates the first update.

View Source
var (
	// "false" is used as a hack to indicate that an account should have a blue check mark.
	IsReserved = map[string]bool{}/* 14113 elements not displayed */

)
View Source
var MainnetForkHeights = ForkHeights{
	DefaultHeight:                0,
	DeflationBombBlockHeight:     33783,
	SalomonFixBlockHeight:        uint32(15270),
	DeSoFounderRewardBlockHeight: uint32(21869),
	BuyCreatorCoinAfterDeletedBalanceEntryFixBlockHeight: uint32(39713),
	ParamUpdaterProfileUpdateFixBlockHeight:              uint32(39713),
	UpdateProfileFixBlockHeight:                          uint32(46165),
	BrokenNFTBidsFixBlockHeight:                          uint32(46917),
	DeSoDiamondsBlockHeight:                              uint32(52112),
	NFTTransferOrBurnAndDerivedKeysBlockHeight:           uint32(60743),

	DeSoV3MessagesBlockHeight:     uint32(98474),
	BuyNowAndNFTSplitsBlockHeight: uint32(98474),
	DAOCoinBlockHeight:            uint32(98474),

	ExtraDataOnEntriesBlockHeight:            uint32(130901),
	DerivedKeySetSpendingLimitsBlockHeight:   uint32(130901),
	DerivedKeyTrackSpendingLimitsBlockHeight: uint32(130901),
	DAOCoinLimitOrderBlockHeight:             uint32(130901),

	DerivedKeyEthSignatureCompatibilityBlockHeight: uint32(137173),
	OrderBookDBFetchOptimizationBlockHeight:        uint32(137173),

	ParamUpdaterRefactorBlockHeight: uint32(141193),

	DeSoUnlimitedDerivedKeysBlockHeight: uint32(166066),

	AssociationsAndAccessGroupsBlockHeight: uint32(205386),

	AssociationsDerivedKeySpendingLimitBlockHeight: uint32(213487),
}
View Source
var MaxBitcoinHeadersPerMsg = uint32(2000)

MaxBitcoinHeadersPerMsg is the maximum number of headers Bitcoin allows in a getheaders response. It is used to determine whether a node has more headers to give us.

View Source
var MaxBlockRewardDataSizeBytes = 250

MaxBlockRewardDataSizeBytes is the maximum size allowed for a BLOCK_REWARD's ExtraData field.

View Source
var MaxHeadersPerMsg = uint32(2000)

MaxHeadersPerMsg is the maximum numbers allowed in a GetHeaders response.

Mode determines if Timer will be used by the node. Set --time-events=true to enable timing.

View Source
var NODES = map[uint64]DeSoNode{
	1: {
		Name:  "DeSo",
		URL:   "https://node.deso.org",
		Owner: "diamondhands",
	},
	2: {
		Name:  "BitClout",
		URL:   "https://bitclout.com",
		Owner: "diamondhands",
	},
	3: {
		Name:  "Diamond",
		URL:   "https://diamondapp.com",
		Owner: "Zordon",
	},
	4: {
		Name:  "Desofy",
		URL:   "https://desofy.app",
		Owner: "Ribal",
	},
	5: {
		Name:  "Flick",
		URL:   "https://flickapp.com",
		Owner: "nigeleccles",
	},
	6: {
		Name:  "tijn's club",
		URL:   "https://tijn.club",
		Owner: "tijn",
	},
	7: {
		Name:  "Nacho Average",
		URL:   "https://nachoaverage.com/",
		Owner: "ClayPerryMusic",
	},
	8: {
		Name:  "love4src",
		URL:   "https://love4src.com",
		Owner: "kanshi",
	},
	9: {
		Name:  "Supernovas",
		URL:   "https://supernovas.app",
		Owner: "fransarthur",
	},
	10: {
		Name:  "GiftClout",
		URL:   "https://members.giftclout.com",
		Owner: "RajLahoti",
	},
	11: {
		Name:  "DeSocialWorld",
		URL:   "https://desocialworld.com",
		Owner: "edokoevoet",
	},
	12: {
		Name:  "NFTz",
		URL:   "https://nftz.me",
		Owner: "mvanhalen",
	},
	13: {
		Name:  "Cloutible",
		URL:   "https://cloutible.club",
		Owner: "DawaynePerza",
	},
	14: {
		Name:  "Agbegbe",
		URL:   "https://agbegbe.org",
		Owner: "TheParkerazzi",
	},
	15: {
		Name:  "CloutingAround",
		URL:   "https://cloutingaround.dev",
		Owner: "TheParkerazzi",
	},
	16: {
		Name:  "MediaTech",
		URL:   "https://deso.mediatech.ventures",
		Owner: "paulobrien",
	},
	17: {
		Name:  "Mousai",
		URL:   "https://deso.mousai.stream",
		Owner: "marlonjm2k",
	},
	18: {
		Name:  "KoalaTBooks",
		URL:   "https://koalatbooks.com",
		Owner: "chriscelaya",
	},
	19: {
		Name:  "Beyond",
		URL:   "https://beyond.restartu.org",
		Owner: "RestartU",
	},
	20: {
		Name:  "DeverSo",
		URL:   "https://deverso.io/",
		Owner: "Nordian",
	},
	21: {
		Name:  "VoSocial",
		URL:   "https://vosoapp.com",
		Owner: "voso",
	},
	22: {
		Name:  "Tunel",
		URL:   "https://tunel.app",
		Owner: "hazrodriguez",
	},
	23: {
		Name:  "Entre",
		URL:   "https://joinentre.com",
		Owner: "entre",
	},
	24: {
		Name:  "Elmas",
		URL:   "https://elmas.app",
		Owner: "elmas",
	},
	25: {
		Name:  "İnci",
		URL:   "https://inci.app",
		Owner: "inci",
	},
	26: {
		Name:  "Overclout",
		URL:   "https://overclout.com",
		Owner: "Overclout",
	},
	27: {
		Name:  "DesoNoCode",
		URL:   "https://node.desonocode.com",
		Owner: "DeSoNoCode",
	},
	28: {
		Name:  "Post2EarnDao",
		URL:   "https://node.post2earndao.com",
		Owner: "edokoevoet",
	},
	29: {
		Name:  "Pearl",
		URL:   "https://pearl.app",
		Owner: "pearl",
	},
}
View Source
var (
	PostExtraDataConsensusKeys = [2]string{RepostedPostHash, IsQuotedRepostKey}
)

Defines values that may exist in a transaction's ExtraData map

View Source
var Prefixes = GetPrefixes()

Prefixes is a static variable that contains all the parsed prefix_id values. We use the Prefixes var when fetching prefixes to avoid parsing the prefix_id tags every time.

View Source
var RegtestForkHeights = ForkHeights{
	DefaultHeight:                0,
	DeflationBombBlockHeight:     0,
	SalomonFixBlockHeight:        uint32(0),
	DeSoFounderRewardBlockHeight: uint32(0),
	BuyCreatorCoinAfterDeletedBalanceEntryFixBlockHeight: uint32(0),
	ParamUpdaterProfileUpdateFixBlockHeight:              uint32(0),
	UpdateProfileFixBlockHeight:                          uint32(0),
	BrokenNFTBidsFixBlockHeight:                          uint32(0),
	DeSoDiamondsBlockHeight:                              uint32(0),
	NFTTransferOrBurnAndDerivedKeysBlockHeight:           uint32(0),
	DeSoV3MessagesBlockHeight:                            uint32(0),
	BuyNowAndNFTSplitsBlockHeight:                        uint32(0),
	DAOCoinBlockHeight:                                   uint32(0),
	ExtraDataOnEntriesBlockHeight:                        uint32(0),
	DerivedKeySetSpendingLimitsBlockHeight:               uint32(0),
	DerivedKeyTrackSpendingLimitsBlockHeight:             uint32(0),
	DAOCoinLimitOrderBlockHeight:                         uint32(0),
	DerivedKeyEthSignatureCompatibilityBlockHeight:       uint32(0),
	OrderBookDBFetchOptimizationBlockHeight:              uint32(0),
	ParamUpdaterRefactorBlockHeight:                      uint32(0),
	DeSoUnlimitedDerivedKeysBlockHeight:                  uint32(0),
	AssociationsAndAccessGroupsBlockHeight:               uint32(0),
	AssociationsDerivedKeySpendingLimitBlockHeight:       uint32(0),
}
View Source
var StatePrefixes = GetStatePrefixes()

StatePrefixes is a static variable that allows us to quickly fetch state-related prefixes. We make the distinction between state and non-state prefixes for hyper sync, where the node is only syncing state prefixes. This significantly speeds up the syncing process and the node will still work properly.

View Source
var TestnetForkHeights = ForkHeights{

	DefaultHeight:                0,
	DeflationBombBlockHeight:     33783,
	SalomonFixBlockHeight:        uint32(15270),
	DeSoFounderRewardBlockHeight: uint32(21869),
	BuyCreatorCoinAfterDeletedBalanceEntryFixBlockHeight: uint32(39713),
	ParamUpdaterProfileUpdateFixBlockHeight:              uint32(39713),
	UpdateProfileFixBlockHeight:                          uint32(46165),
	BrokenNFTBidsFixBlockHeight:                          uint32(46917),
	DeSoDiamondsBlockHeight:                              uint32(52112),
	NFTTransferOrBurnAndDerivedKeysBlockHeight:           uint32(60743),

	DeSoV3MessagesBlockHeight:     uint32(97322),
	BuyNowAndNFTSplitsBlockHeight: uint32(97322),
	DAOCoinBlockHeight:            uint32(97322),

	ExtraDataOnEntriesBlockHeight:          uint32(304087),
	DerivedKeySetSpendingLimitsBlockHeight: uint32(304087),

	DerivedKeyTrackSpendingLimitsBlockHeight: uint32(304087 + 18*60),
	DAOCoinLimitOrderBlockHeight:             uint32(304087),

	DerivedKeyEthSignatureCompatibilityBlockHeight: uint32(360584),
	OrderBookDBFetchOptimizationBlockHeight:        uint32(360584),

	ParamUpdaterRefactorBlockHeight: uint32(373536),

	DeSoUnlimitedDerivedKeysBlockHeight: uint32(467217),

	AssociationsAndAccessGroupsBlockHeight: uint32(596555),

	AssociationsDerivedKeySpendingLimitBlockHeight: uint32(642270),
}

Functions

func AccessKeyNameDecode added in v3.2.0

func AccessKeyNameDecode(name *GroupKeyName) []byte

Decode filled message key of length MaxAccessKeyNameCharacters array.

func Add

func Add(a *big.Float, b *big.Float) *big.Float

func AssembleAccessBytesWithMetamaskStrings

func AssembleAccessBytesWithMetamaskStrings(derivedPublicKey []byte, expirationBlock uint64,
	transactionSpendingLimit *TransactionSpendingLimit, params *DeSoParams) []byte

AssembleAccessBytesWithMetamaskStrings constructs Access Bytes Encoding 2.0. It encodes the derived key access bytes into a Metamask-compatible string. There are three components of a derived key that comprise the access bytes, it is the derived public key, expiration block, and transaction spending limit. We encode these three into a single string that is unique, displays nicely, and can be signed with MetaMask. This is intended to be an equivalent alternative to the standard Access Bytes Encoding 1.0.

func AssertDependencyStructFieldNumbers

func AssertDependencyStructFieldNumbers[T any](obj T, num int)

AssertDependencyStructFieldNumbers checks if a struct has a specified number of fields, otherwise it panics. The idea is to place this as an anti-bug feature that will detect changes to the code that poses a risk of causing a bug.

func Base58CheckDecode

func Base58CheckDecode(input string) (_result []byte, _prefix []byte, _err error)

func Base58CheckDecodePrefix

func Base58CheckDecodePrefix(input string, prefixLen int) (_result []byte, _prefix []byte, _err error)

func Base58CheckEncode

func Base58CheckEncode(input []byte, isPrivate bool, params *DeSoParams) string

func Base58CheckEncodeWithPrefix

func Base58CheckEncodeWithPrefix(input []byte, prefix [3]byte) string

func BigFloatExp

func BigFloatExp(z *big.Float) *big.Float

Exp returns a big.Float representation of exp(z).

func BigFloatExpMulti

func BigFloatExpMulti(hi, lo *big.Float, k int64) *big.Float

func BigFloatLog

func BigFloatLog(x *big.Float) *big.Float

Log returns the natural logarithm of x.

func BigFloatLog2

func BigFloatLog2(x *big.Float) *big.Float

Log2 returns the binary logarithm of x. The special cases are the same as for Log.

func BigFloatPow

func BigFloatPow(z *big.Float, w *big.Float) *big.Float

Pow returns a big.Float representation of z**w.

func BigintToBytes

func BigintToBytes(bigint *big.Int) []byte

func BlockCypherCheckBitcoinDoubleSpend

func BlockCypherCheckBitcoinDoubleSpend(txnHash *chainhash.Hash, blockCypherAPIKey string, params *DeSoParams) (
	_isDoubleSpend bool, _err error)

func BlockCypherPushAndWaitForTxn

func BlockCypherPushAndWaitForTxn(txnHex string, txnHash *chainhash.Hash,
	blockCypherAPIKey string, doubleSpendWaitSeconds float64, params *DeSoParams) (_isDoubleSpend bool, _err error)

func BlockCypherPushTransaction

func BlockCypherPushTransaction(txnHex string, txnHash *chainhash.Hash, blockCypherAPIKey string, params *DeSoParams) (
	_added bool, _err error)

func BlockHashToBlockKey

func BlockHashToBlockKey(blockHash *BlockHash) []byte

func BlockchainInfoCheckBitcoinDoubleSpend

func BlockchainInfoCheckBitcoinDoubleSpend(txnHash *chainhash.Hash, blockCypherAPIKey string, params *DeSoParams) (
	_isDoubleSpend bool, _err error)

func BlockonomicsCheckRBF

func BlockonomicsCheckRBF(bitcoinTxnHash string) (
	_hasRBF bool, _err error)

func BlocksPerDuration

func BlocksPerDuration(duration time.Duration, timeBetweenBlocks time.Duration) uint32

func BoolToByte

func BoolToByte(val bool) byte

func BytesToBigint

func BytesToBigint(bb []byte) *big.Int

func CLog

func CLog(c *color.Color, str string) string

func CalcBlockRewardNanos

func CalcBlockRewardNanos(blockHeight uint32) uint64

CalcBlockRewardNanos computes the block reward for a given block height.

func CalcNanosToCreate

func CalcNanosToCreate(
	startNanos uint64, satoshisToBurn uint64, usdCentsPerBitcoinExchangeRate uint64) (
	_nanosToCreate uint64)

func CalculateCreatorCoinToMint

func CalculateCreatorCoinToMint(
	desoToSellNanos uint64,
	coinsInCirculationNanos uint64, desoLockedNanos uint64,
	params *DeSoParams) uint64

func CalculateCreatorCoinToMintBancor

func CalculateCreatorCoinToMintBancor(
	deltaDeSoNanos uint64, currentCreatorCoinSupplyNanos uint64,
	currentDeSoLockedNanos uint64, params *DeSoParams) uint64

func CalculateCreatorCoinToMintPolynomial

func CalculateCreatorCoinToMintPolynomial(
	deltaDeSoNanos uint64, currentCreatorCoinSupplyNanos uint64, params *DeSoParams) uint64

func CalculateDeSoToReturn

func CalculateDeSoToReturn(
	deltaCreatorCoinNanos uint64, currentCreatorCoinSupplyNanos uint64,
	currentDeSoLockedNanos uint64, params *DeSoParams) uint64

func CalculateScaledExchangeRate

func CalculateScaledExchangeRate(price float64) (*uint256.Int, error)

func CalculateScaledExchangeRateFromString

func CalculateScaledExchangeRateFromString(priceStr string) (*uint256.Int, error)

func CheckBitcoinDoubleSpend

func CheckBitcoinDoubleSpend(txnHash *chainhash.Hash, blockCypherAPIKey string, params *DeSoParams) error

func CheckRBF

func CheckRBF(bitcoinTxn *wire.MsgTx, bitcoinTxnHash chainhash.Hash, desoParams *DeSoParams) (bool, error)

Check whether the deposits being used to construct this transaction have RBF enabled. If they do then we force the user to wait until those deposits have been mined into a block before allowing this transaction to go through. This prevents double-spend attacks where someone replaces a dependent transaction with a higher fee.

TODO: We use a pretty janky API to check for this, and if it goes down then BitcoinExchange txns break. But without it we're vulnerable to double-spends so we keep it for now.

func CheckTransactionSanity

func CheckTransactionSanity(txn *MsgDeSoTxn) error

func ComputeBaseUnitsToBuyUint256

func ComputeBaseUnitsToBuyUint256(
	scaledExchangeRateCoinsToSellPerCoinToBuy *uint256.Int,
	quantityToSellBaseUnits *uint256.Int) (*uint256.Int, error)

func ComputeBaseUnitsToSellUint256

func ComputeBaseUnitsToSellUint256(
	scaledExchangeRateCoinsToSellPerCoinToBuy *uint256.Int,
	quantityToBuyBaseUnits *uint256.Int) (*uint256.Int, error)

func ComputeKeysFromSeed

func ComputeKeysFromSeed(seedBytes []byte, index uint32, params *DeSoParams) (_pubKey *btcec.PublicKey, _privKey *btcec.PrivateKey, _btcAddress string, _err error)

func ComputeKeysFromSeedWithNet

func ComputeKeysFromSeedWithNet(seedBytes []byte, index uint32, isTestnet bool) (_pubKey *btcec.PublicKey, _privKey *btcec.PrivateKey, _btcAddress string, _err error)

func ComputeMerkleRoot

func ComputeMerkleRoot(txns []*MsgDeSoTxn) (_merkle *BlockHash, _txHashes []*BlockHash, _err error)

func CreateBitcoinSpendTransaction

func CreateBitcoinSpendTransaction(
	spendAmountSatoshis uint64, feeRateSatoshisPerKB uint64,
	pubKey *btcec.PublicKey,
	recipientAddrString string, params *DeSoParams,
	utxoSource func(addr string, params *DeSoParams) ([]*BitcoinUtxo, error)) (_txn *wire.MsgTx, _totalInput uint64, _fee uint64, _unsignedHashes []string, _err error)

func CreateUnsignedBitcoinSpendTransaction

func CreateUnsignedBitcoinSpendTransaction(
	spendAmountSatoshis uint64,
	feeRateSatoshisPerKB uint64,
	spendAddrString string,
	recipientAddrString string,
	params *DeSoParams,
	utxoSource func(addr string, params *DeSoParams) ([]*BitcoinUtxo, error)) (
	_txn *wire.MsgTx, _totalInput uint64, _fee uint64, _err error)

func DBCheckTxnExistenceWithTxn

func DBCheckTxnExistenceWithTxn(txn *badger.Txn, snap *Snapshot, txID *BlockHash) bool

func DBDeleteAcceptedNFTBidEntriesMappingsWithTxn

func DBDeleteAcceptedNFTBidEntriesMappingsWithTxn(txn *badger.Txn, snap *Snapshot,
	nftPostHash *BlockHash, serialNumber uint64) error

func DBDeleteAcceptedNFTBidMappings

func DBDeleteAcceptedNFTBidMappings(handle *badger.DB, snap *Snapshot,
	postHash *BlockHash, serialNumber uint64) error

func DBDeleteAccessGroupEntry added in v3.2.0

func DBDeleteAccessGroupEntry(db *badger.DB, snap *Snapshot, accessGroupOwnerPublicKey PublicKey,
	accessGroupKeyName GroupKeyName) error

func DBDeleteAccessGroupEntryWithTxn added in v3.2.0

func DBDeleteAccessGroupEntryWithTxn(txn *badger.Txn, snap *Snapshot, accessGroupOwnerPublicKey PublicKey,
	accessGroupKeyName GroupKeyName) error

func DBDeleteAccessGroupMemberEntry added in v3.2.0

func DBDeleteAccessGroupMemberEntry(db *badger.DB, snap *Snapshot,
	accessGroupMemberPublicKey PublicKey, accessGroupOwnerPublicKey PublicKey, accessGroupKeyName GroupKeyName) error

func DBDeleteAccessGroupMemberEntryWithTxn added in v3.2.0

func DBDeleteAccessGroupMemberEntryWithTxn(txn *badger.Txn, snap *Snapshot,
	accessGroupMemberPublicKey PublicKey, accessGroupOwnerPublicKey PublicKey, accessGroupKeyName GroupKeyName) error

func DBDeleteAccessGroupMemberEnumerationIndex added in v3.2.0

func DBDeleteAccessGroupMemberEnumerationIndex(handle *badger.DB, snap *Snapshot,
	groupMemberPublicKey PublicKey, groupOwnerPublicKey PublicKey, groupKeyName GroupKeyName) error

func DBDeleteAccessGroupMemberEnumerationIndexWithTxn added in v3.2.0

func DBDeleteAccessGroupMemberEnumerationIndexWithTxn(txn *badger.Txn, snap *Snapshot,
	groupOwnerPublicKey PublicKey, groupKeyName GroupKeyName, groupMemberPublicKey PublicKey) error

func DBDeleteAllStateRecords

func DBDeleteAllStateRecords(db *badger.DB) (_shouldErase bool, _error error)

DBDeleteAllStateRecords is an auxiliary function that is used to clean up the state before starting hyper sync. _shouldErase = true is returned when it is faster to use os.RemoveAll(dbDir) instead of deleting records manually.

func DBDeleteBalanceEntryMappings

func DBDeleteBalanceEntryMappings(handle *badger.DB, snap *Snapshot,
	hodlerPKID *PKID, creatorPKID *PKID, isDAOCoin bool) error

func DBDeleteBalanceEntryMappingsWithTxn

func DBDeleteBalanceEntryMappingsWithTxn(txn *badger.Txn, snap *Snapshot,
	hodlerPKID *PKID, creatorPKID *PKID, isDAOCoin bool) error

func DBDeleteDAOCoinLimitOrderWithTxn

func DBDeleteDAOCoinLimitOrderWithTxn(txn *badger.Txn, snap *Snapshot, order *DAOCoinLimitOrderEntry) error

func DBDeleteDerivedKeyMapping

func DBDeleteDerivedKeyMapping(handle *badger.DB, snap *Snapshot,
	ownerPublicKey PublicKey, derivedPublicKey PublicKey) error

func DBDeleteDerivedKeyMappingWithTxn

func DBDeleteDerivedKeyMappingWithTxn(txn *badger.Txn, snap *Snapshot,
	ownerPublicKey PublicKey, derivedPublicKey PublicKey) error

func DBDeleteDmMessageEntryWithTxn added in v3.2.0

func DBDeleteDmMessageEntryWithTxn(txn *badger.Txn, snap *Snapshot, key DmMessageKey) error

func DBDeleteDmThreadIndex added in v3.2.0

func DBDeleteDmThreadIndex(db *badger.DB, snap *Snapshot, dmThreadKey DmThreadKey) error

func DBDeleteDmThreadIndexWithTxn added in v3.2.0

func DBDeleteDmThreadIndexWithTxn(txn *badger.Txn, snap *Snapshot, dmThreadKey DmThreadKey) error

func DBDeleteGroupChatMessageEntryWithTxn added in v3.2.0

func DBDeleteGroupChatMessageEntryWithTxn(txn *badger.Txn, snap *Snapshot, key GroupChatMessageKey) error

func DBDeleteMessageEntryMappings

func DBDeleteMessageEntryMappings(handle *badger.DB, snap *Snapshot,
	publicKey []byte, tstampNanos uint64) error

func DBDeleteMessageEntryMappingsWithTxn

func DBDeleteMessageEntryMappingsWithTxn(txn *badger.Txn, snap *Snapshot,
	publicKey []byte, tstampNanos uint64) error

Note this deletes the message for the sender *and* receiver since a mapping should exist for each.

func DBDeleteMessagingGroupEntry

func DBDeleteMessagingGroupEntry(handle *badger.DB, snap *Snapshot,
	messagingGroupKey *MessagingGroupKey) error

func DBDeleteMessagingGroupEntryWithTxn

func DBDeleteMessagingGroupEntryWithTxn(txn *badger.Txn, snap *Snapshot,
	messagingGroupKey *MessagingGroupKey) error

func DBDeleteMessagingGroupMemberMappingWithTxn

func DBDeleteMessagingGroupMemberMappingWithTxn(txn *badger.Txn, snap *Snapshot,
	messagingGroupMember *MessagingGroupMember, messagingGroupEntry *MessagingGroupEntry) error

Note this deletes the message for the sender *and* receiver since a mapping should exist for each.

func DBDeleteMessagingGroupMemberMappings

func DBDeleteMessagingGroupMemberMappings(handle *badger.DB, snap *Snapshot,
	messagingGroupMember *MessagingGroupMember, messagingGroupEntry *MessagingGroupEntry) error

func DBDeleteNFTBidMappings

func DBDeleteNFTBidMappings(handle *badger.DB, snap *Snapshot, nftBidKey *NFTBidKey) error

func DBDeleteNFTBidMappingsWithTxn

func DBDeleteNFTBidMappingsWithTxn(txn *badger.Txn, snap *Snapshot, nftBidKey *NFTBidKey) error

func DBDeleteNFTMappings

func DBDeleteNFTMappings(
	handle *badger.DB, snap *Snapshot, postHash *BlockHash, serialNumber uint64) error

func DBDeleteNFTMappingsWithTxn

func DBDeleteNFTMappingsWithTxn(txn *badger.Txn, snap *Snapshot,
	nftPostHash *BlockHash, serialNumber uint64) error

func DBDeletePKIDMappingsWithTxn

func DBDeletePKIDMappingsWithTxn(txn *badger.Txn, snap *Snapshot,
	publicKey []byte, params *DeSoParams) error

func DBDeletePostAssociationWithTxn added in v3.2.0

func DBDeletePostAssociationWithTxn(txn *badger.Txn, snap *Snapshot, associationEntry *PostAssociationEntry) error

func DBDeletePostEntryMappings

func DBDeletePostEntryMappings(handle *badger.DB, snap *Snapshot,
	postHash *BlockHash, params *DeSoParams) error

func DBDeletePostEntryMappingsWithTxn

func DBDeletePostEntryMappingsWithTxn(txn *badger.Txn, snap *Snapshot,
	postHash *BlockHash, params *DeSoParams) error

func DBDeleteProfileEntryMappingsWithTxn

func DBDeleteProfileEntryMappingsWithTxn(txn *badger.Txn, snap *Snapshot,
	pkid *PKID, params *DeSoParams) error

func DBDeleteUserAssociationWithTxn added in v3.2.0

func DBDeleteUserAssociationWithTxn(txn *badger.Txn, snap *Snapshot, associationEntry *UserAssociationEntry) error

func DBDeleteWithTxn

func DBDeleteWithTxn(txn *badger.Txn, snap *Snapshot, key []byte) error

DBDeleteWithTxn is a wrapper function around BadgerDB delete function. It allows us to update the snapshot LRU cache, checksum, and ancestral records.

func DBGetAcceptedNFTBidEntriesByPostHashSerialNumber

func DBGetAcceptedNFTBidEntriesByPostHashSerialNumber(db *badger.DB, snap *Snapshot,
	postHash *BlockHash, serialNumber uint64) *[]*NFTBidEntry

func DBGetAcceptedNFTBidEntriesByPostHashSerialNumberWithTxn

func DBGetAcceptedNFTBidEntriesByPostHashSerialNumberWithTxn(txn *badger.Txn, snap *Snapshot,
	postHash *BlockHash, serialNumber uint64) *[]*NFTBidEntry

func DBGetAccessGroupExistenceByAccessGroupId added in v3.2.0

func DBGetAccessGroupExistenceByAccessGroupId(db *badger.DB, snap *Snapshot,
	accessGroupOwnerPublicKey *PublicKey, accessGroupKeyName *GroupKeyName) (bool, error)

func DBGetAccessGroupExistenceByAccessGroupIdWithTxn added in v3.2.0

func DBGetAccessGroupExistenceByAccessGroupIdWithTxn(txn *badger.Txn, snap *Snapshot,
	accessGroupOwnerPublicKey *PublicKey, accessGroupKeyName *GroupKeyName) (bool, error)

DBGetAccessGroupExistenceByAccessGroupIdWithTxn checks whether an access group exists in the db using some optimized db queries.

func DBGetAccessGroupMemberExistenceFromEnumerationIndex added in v3.2.0

func DBGetAccessGroupMemberExistenceFromEnumerationIndex(handle *badger.DB, snap *Snapshot,
	groupMemberPublicKey PublicKey, groupOwnerPublicKey PublicKey, groupKeyName GroupKeyName) (
	_exists bool, _err error)

func DBGetAllPostsAndCommentsForPublicKeyOrderedByTimestamp

func DBGetAllPostsAndCommentsForPublicKeyOrderedByTimestamp(handle *badger.DB,
	snap *Snapshot, publicKey []byte, fetchEntries bool, minTimestampNanos uint64, maxTimestampNanos uint64) (
	_tstamps []uint64, _postAndCommentHashes []*BlockHash, _postAndCommentEntries []*PostEntry, _err error)

Specifying minTimestampNanos gives you all posts after minTimestampNanos Pass minTimestampNanos = 0 && maxTimestampNanos = 0 if you want all posts Setting maxTimestampNanos = 0, will default maxTimestampNanos to the current time.

func DBGetAllPostsByTstamp

func DBGetAllPostsByTstamp(handle *badger.DB, snap *Snapshot, fetchEntries bool) (
	_tstamps []uint64, _postHashes []*BlockHash, _postEntries []*PostEntry, _err error)

DBGetAllPostsByTstamp returns all the posts in the db with the newest posts first.

TODO(performance): This currently fetches all posts. We should implement some kind of pagination instead though.

func DBGetAllProfilesByCoinValue

func DBGetAllProfilesByCoinValue(handle *badger.DB, snap *Snapshot, fetchEntries bool) (
	_lockedDeSoNanos []uint64, _profilePKIDs []*PKID,
	_profileEntries []*ProfileEntry, _err error)

DBGetAllProfilesByCoinValue returns all the profiles in the db with the highest coin values first.

TODO(performance): This currently fetches all profiles. We should implement some kind of pagination instead though.

func DBGetCommentPostHashesForParentStakeID

func DBGetCommentPostHashesForParentStakeID(
	handle *badger.DB, snap *Snapshot, stakeIDXXX []byte, fetchEntries bool) (
	_tstamps []uint64, _commentPostHashes []*BlockHash, _commentPostEntryes []*PostEntry, _err error)

DBGetCommentPostHashesForParentStakeID returns all the comments, which are indexed by their stake ID rather than by their timestamp.

TODO(performance): This currently fetches all comments. We should implement something where we only get the comments for particular posts instead.

func DBGetGroupMemberExistenceFromEnumerationIndexWithTxn added in v3.2.0

func DBGetGroupMemberExistenceFromEnumerationIndexWithTxn(txn *badger.Txn, snap *Snapshot,
	groupMemberPublicKey PublicKey, groupOwnerPublicKey PublicKey, groupKeyName GroupKeyName) (
	_exists bool, _err error)

DBGetGroupMemberForAccessGroupWithTxn for a given group.

func DBGetPaginatedKeysAndValuesForPrefix

func DBGetPaginatedKeysAndValuesForPrefix(
	db *badger.DB, startPrefix []byte, validForPrefix []byte,
	keyLen int, numToFetch int, reverse bool, fetchValues bool) (
	_keysFound [][]byte, _valsFound [][]byte, _err error)

func DBGetPaginatedKeysAndValuesForPrefixWithTxn

func DBGetPaginatedKeysAndValuesForPrefixWithTxn(
	txn *badger.Txn, startPrefix []byte, validForPrefix []byte,
	maxKeyLen int, numToFetch int, reverse bool, fetchValues bool) (

	_keysFound [][]byte, _valsFound [][]byte, _err error)

startPrefix specifies a point in the DB at which the iteration should start. It doesn't have to map to an exact key because badger will just binary search and start right before/after that location.

validForPrefix helps determine when the iteration should stop. The iteration stops at the last entry that has this prefix. Setting it to an empty byte string would cause the iteration to seek to the beginning of the db, whereas setting it to one of the Prefix bytes would cause the iteration to stop at the last entry with that prefix.

maxKeyLen is required so we can pad the key with FF in the case the user wants to seek backwards. This is required due to a quirk of badgerdb. It is ignored if reverse == false.

numToFetch specifies the number of entries to fetch. If set to zero then it fetches all entries that match the validForPrefix passed in.

func DBGetPaginatedPostsOrderedByTime

func DBGetPaginatedPostsOrderedByTime(
	db *badger.DB, snap *Snapshot, startPostTimestampNanos uint64,
	startPostHash *BlockHash, numToFetch int, fetchPostEntries bool, reverse bool) (
	_postHashes []*BlockHash, _tstampNanos []uint64, _postEntries []*PostEntry,
	_err error)

func DBGetPublicKeyForPKID

func DBGetPublicKeyForPKID(db *badger.DB, snap *Snapshot, pkidd *PKID) []byte

func DBGetPublicKeyForPKIDWithTxn

func DBGetPublicKeyForPKIDWithTxn(txn *badger.Txn, snap *Snapshot, pkidd *PKID) []byte

func DBGetWithTxn

func DBGetWithTxn(txn *badger.Txn, snap *Snapshot, key []byte) ([]byte, error)

DBGetWithTxn is a wrapper function around the BadgerDB get function. It returns the DB entry associated with the given key and handles the logic around the LRU cache. Whenever we read/write records in the DB, we place a copy in the LRU cache to save us lookup time.

func DBKeyForDAOCoinLimitOrder

func DBKeyForDAOCoinLimitOrder(order *DAOCoinLimitOrderEntry) []byte

func DBKeyForDAOCoinLimitOrderByOrderID

func DBKeyForDAOCoinLimitOrderByOrderID(order *DAOCoinLimitOrderEntry) []byte

func DBKeyForDAOCoinLimitOrderByTransactorPKID

func DBKeyForDAOCoinLimitOrderByTransactorPKID(order *DAOCoinLimitOrderEntry) []byte

func DBKeyForPostAssociationByID added in v3.2.0

func DBKeyForPostAssociationByID(associationEntry *PostAssociationEntry) []byte

func DBKeyForPostAssociationByPost added in v3.2.0

func DBKeyForPostAssociationByPost(associationEntry *PostAssociationEntry) []byte

func DBKeyForPostAssociationByPrefix added in v3.2.0

func DBKeyForPostAssociationByPrefix(associationEntry *PostAssociationEntry, prefixType []byte) ([]byte, error)

func DBKeyForPostAssociationByTransactor added in v3.2.0

func DBKeyForPostAssociationByTransactor(associationEntry *PostAssociationEntry) []byte

func DBKeyForPostAssociationByType added in v3.2.0

func DBKeyForPostAssociationByType(associationEntry *PostAssociationEntry) []byte

func DBKeyForUserAssociationByID added in v3.2.0

func DBKeyForUserAssociationByID(associationEntry *UserAssociationEntry) []byte

func DBKeyForUserAssociationByPrefix added in v3.2.0

func DBKeyForUserAssociationByPrefix(associationEntry *UserAssociationEntry, prefixType []byte) ([]byte, error)

func DBKeyForUserAssociationByTargetUser added in v3.2.0

func DBKeyForUserAssociationByTargetUser(associationEntry *UserAssociationEntry) []byte

func DBKeyForUserAssociationByTransactor added in v3.2.0

func DBKeyForUserAssociationByTransactor(associationEntry *UserAssociationEntry) []byte

func DBKeyForUserAssociationByUsers added in v3.2.0

func DBKeyForUserAssociationByUsers(associationEntry *UserAssociationEntry) []byte

func DBPrefixKeyForDAOCoinLimitOrder

func DBPrefixKeyForDAOCoinLimitOrder(order *DAOCoinLimitOrderEntry) []byte

func DBPutAcceptedNFTBidEntriesMapping

func DBPutAcceptedNFTBidEntriesMapping(handle *badger.DB, snap *Snapshot, blockHeight uint64,
	nftKey NFTKey, nftBidEntries *[]*NFTBidEntry) error

func DBPutAcceptedNFTBidEntriesMappingWithTxn

func DBPutAcceptedNFTBidEntriesMappingWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64,
	nftKey NFTKey, nftBidEntries *[]*NFTBidEntry) error

TODO: are we sure we want to pass a pointer to an array here?

func DBPutAccessGroupEntry added in v3.2.0

func DBPutAccessGroupEntry(db *badger.DB, snap *Snapshot, blockHeight uint64, accessGroupEntry *AccessGroupEntry) error

func DBPutAccessGroupEntryWithTxn added in v3.2.0

func DBPutAccessGroupEntryWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64, accessGroupEntry *AccessGroupEntry) error

func DBPutAccessGroupMemberEntry added in v3.2.0

func DBPutAccessGroupMemberEntry(db *badger.DB, snap *Snapshot, blockHeight uint64,
	accessGroupMemberEntry *AccessGroupMemberEntry, accessGroupOwnerPublicKey PublicKey, groupKeyName GroupKeyName) error

func DBPutAccessGroupMemberEntryWithTxn added in v3.2.0

func DBPutAccessGroupMemberEntryWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64,
	accessGroupMemberEntry *AccessGroupMemberEntry, accessGroupOwnerPublicKey PublicKey, groupKeyName GroupKeyName) error

func DBPutAccessGroupMemberEnumerationIndex added in v3.2.0

func DBPutAccessGroupMemberEnumerationIndex(handle *badger.DB, snap *Snapshot, blockHeight uint64,
	groupOwnerPublicKey PublicKey, groupKeyName GroupKeyName, accessGroupMemberPublicKey PublicKey) error

func DBPutAccessGroupMemberEnumerationIndexWithTxn added in v3.2.0

func DBPutAccessGroupMemberEnumerationIndexWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64,
	groupOwnerPublicKey PublicKey, groupKeyName GroupKeyName, accessGroupMemberPublicKey PublicKey) error

DBPutAccessGroupMemberEnumerationIndexWithTxn puts a mapping from a group member to a group in the db.

func DBPutBalanceEntryMappings

func DBPutBalanceEntryMappings(handle *badger.DB, snap *Snapshot, blockHeight uint64,
	balanceEntry *BalanceEntry, isDAOCoin bool) error

func DBPutBalanceEntryMappingsWithTxn

func DBPutBalanceEntryMappingsWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64,
	balanceEntry *BalanceEntry, isDAOCoin bool) error

func DBPutDAOCoinLimitOrderWithTxn

func DBPutDAOCoinLimitOrderWithTxn(txn *badger.Txn, snap *Snapshot, order *DAOCoinLimitOrderEntry, blockHeight uint64) error

func DBPutDerivedKeyMapping

func DBPutDerivedKeyMapping(handle *badger.DB, snap *Snapshot, blockHeight uint64,
	ownerPublicKey PublicKey, derivedPublicKey PublicKey, derivedKeyEntry *DerivedKeyEntry) error

func DBPutDerivedKeyMappingWithTxn

func DBPutDerivedKeyMappingWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64,
	ownerPublicKey PublicKey, derivedPublicKey PublicKey, derivedKeyEntry *DerivedKeyEntry) error

func DBPutDmMessageEntryWithTxn added in v3.2.0

func DBPutDmMessageEntryWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64,
	key DmMessageKey, messageEntry *NewMessageEntry) error

func DBPutDmThreadIndex added in v3.2.0

func DBPutDmThreadIndex(db *badger.DB, snap *Snapshot, blockHeight uint64, dmThreadKey DmThreadKey) error

func DBPutDmThreadIndexWithTxn added in v3.2.0

func DBPutDmThreadIndexWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64, dmThreadKey DmThreadKey) error

func DBPutGroupChatMessageEntryWithTxn added in v3.2.0

func DBPutGroupChatMessageEntryWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64,
	key GroupChatMessageKey, messageEntry *NewMessageEntry) error

func DBPutMessageEntry

func DBPutMessageEntry(handle *badger.DB, snap *Snapshot, blockHeight uint64,
	messageKey MessageKey, messageEntry *MessageEntry) error

func DBPutMessageEntryWithTxn

func DBPutMessageEntryWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64,
	messageKey MessageKey, messageEntry *MessageEntry) error

Note that this adds a mapping for the sender *and* the recipient.

func DBPutMessagingGroupEntry

func DBPutMessagingGroupEntry(handle *badger.DB, snap *Snapshot, blockHeight uint64,
	ownerPublicKey *PublicKey, messagingGroupEntry *MessagingGroupEntry) error

func DBPutMessagingGroupEntryWithTxn

func DBPutMessagingGroupEntryWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64,
	ownerPublicKey *PublicKey, messagingGroupEntry *MessagingGroupEntry) error

func DBPutMessagingGroupMember

func DBPutMessagingGroupMember(handle *badger.DB, snap *Snapshot, blockHeight uint64,
	messagingGroupMember *MessagingGroupMember, ownerPublicKey *PublicKey, messagingGroupEntry *MessagingGroupEntry) error

func DBPutMessagingGroupMemberWithTxn

func DBPutMessagingGroupMemberWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64,
	messagingGroupMember *MessagingGroupMember, groupOwnerPublicKey *PublicKey,
	messagingGroupEntry *MessagingGroupEntry) error

func DBPutNFTBidEntryMappings

func DBPutNFTBidEntryMappings(handle *badger.DB, snap *Snapshot, nftEntry *NFTBidEntry) error

func DBPutNFTBidEntryMappingsWithTxn

func DBPutNFTBidEntryMappingsWithTxn(txn *badger.Txn, snap *Snapshot, nftBidEntry *NFTBidEntry) error

func DBPutNFTEntryMappings

func DBPutNFTEntryMappings(handle *badger.DB, snap *Snapshot, blockHeight uint64, nftEntry *NFTEntry) error

func DBPutNFTEntryMappingsWithTxn

func DBPutNFTEntryMappingsWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64, nftEntry *NFTEntry) error

func DBPutPKIDMappingsWithTxn

func DBPutPKIDMappingsWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64,
	publicKey []byte, pkidEntry *PKIDEntry, params *DeSoParams) error

func DBPutPostAssociationWithTxn added in v3.2.0

func DBPutPostAssociationWithTxn(
	txn *badger.Txn,
	snap *Snapshot,
	associationEntry *PostAssociationEntry,
	blockHeight uint64,
) error

func DBPutPostEntryMappings

func DBPutPostEntryMappings(handle *badger.DB, snap *Snapshot, blockHeight uint64,
	postEntry *PostEntry, params *DeSoParams) error

func DBPutPostEntryMappingsWithTxn

func DBPutPostEntryMappingsWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64,
	postEntry *PostEntry, params *DeSoParams) error

func DBPutProfileEntryMappings

func DBPutProfileEntryMappings(handle *badger.DB, snap *Snapshot, blockHeight uint64,
	profileEntry *ProfileEntry, pkid *PKID, params *DeSoParams) error

func DBPutProfileEntryMappingsWithTxn

func DBPutProfileEntryMappingsWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64,
	profileEntry *ProfileEntry, pkid *PKID, params *DeSoParams) error

func DBPutUserAssociationWithTxn added in v3.2.0

func DBPutUserAssociationWithTxn(
	txn *badger.Txn,
	snap *Snapshot,
	associationEntry *UserAssociationEntry,
	blockHeight uint64,
) error

func DBSetWithTxn

func DBSetWithTxn(txn *badger.Txn, snap *Snapshot, key []byte, value []byte) error

DBSetWithTxn is a wrapper around BadgerDB Set function which allows us to add computation prior to DB writes. In particular, we use it to maintain a dynamic LRU cache, compute the state checksum, and to build DB snapshots with ancestral records.

func DbBulkDeleteHeightHashToNodeInfo

func DbBulkDeleteHeightHashToNodeInfo(handle *badger.DB, snap *Snapshot,
	nodes []*BlockNode, bitcoinNodes bool) error

func DbCheckTxnExistence

func DbCheckTxnExistence(handle *badger.DB, snap *Snapshot, txID *BlockHash) bool

func DbDeleteAllMempoolTxns

func DbDeleteAllMempoolTxns(handle *badger.DB, snap *Snapshot) error

func DbDeleteAllMempoolTxnsWithTxn

func DbDeleteAllMempoolTxnsWithTxn(txn *badger.Txn, snap *Snapshot) error

func DbDeleteAllRepostMappingsWithTxn

func DbDeleteAllRepostMappingsWithTxn(txn *badger.Txn, snap *Snapshot, userPubKey []byte, repostedPostHash BlockHash) error

func DbDeleteBitcoinBurnTxIDWithTxn

func DbDeleteBitcoinBurnTxIDWithTxn(txn *badger.Txn, snap *Snapshot, bitcoinBurnTxID *BlockHash) error

func DbDeleteDiamondMappings

func DbDeleteDiamondMappings(handle *badger.DB, snap *Snapshot, diamondEntry *DiamondEntry) error

func DbDeleteDiamondMappingsWithTxn

func DbDeleteDiamondMappingsWithTxn(txn *badger.Txn, snap *Snapshot, diamondEntry *DiamondEntry) error

func DbDeleteFollowMappings

func DbDeleteFollowMappings(handle *badger.DB, snap *Snapshot,
	followerPKID *PKID, followedPKID *PKID) error

func DbDeleteFollowMappingsWithTxn

func DbDeleteFollowMappingsWithTxn(txn *badger.Txn, snap *Snapshot,
	followerPKID *PKID, followedPKID *PKID) error

Note this deletes the follow for the follower *and* followed since a mapping should exist for each.

func DbDeleteForbiddenBlockSignaturePubKey

func DbDeleteForbiddenBlockSignaturePubKey(
	handle *badger.DB, snap *Snapshot, publicKey []byte) error

func DbDeleteForbiddenBlockSignaturePubKeyWithTxn

func DbDeleteForbiddenBlockSignaturePubKeyWithTxn(
	txn *badger.Txn, snap *Snapshot, publicKey []byte) error

func DbDeleteHeightHashToNodeInfoWithTxn

func DbDeleteHeightHashToNodeInfoWithTxn(txn *badger.Txn, snap *Snapshot,
	node *BlockNode, bitcoinNodes bool) error

func DbDeleteLikeMappings

func DbDeleteLikeMappings(handle *badger.DB, snap *Snapshot,
	userPubKey []byte, likedPostHash BlockHash) error

func DbDeleteLikeMappingsWithTxn

func DbDeleteLikeMappingsWithTxn(txn *badger.Txn, snap *Snapshot,
	userPubKey []byte, likedPostHash BlockHash) error

Note this deletes the like for the user *and* the liked post since a mapping should exist for each.

func DbDeleteMempoolTxn

func DbDeleteMempoolTxn(handle *badger.DB, snap *Snapshot, mempoolTx *MempoolTx) error

func DbDeleteMempoolTxnKey

func DbDeleteMempoolTxnKey(handle *badger.DB, snap *Snapshot, txnKey []byte) error

func DbDeleteMempoolTxnKeyWithTxn

func DbDeleteMempoolTxnKeyWithTxn(txn *badger.Txn, snap *Snapshot, txnKey []byte) error

func DbDeleteMempoolTxnWithTxn

func DbDeleteMempoolTxnWithTxn(txn *badger.Txn, snap *Snapshot, mempoolTx *MempoolTx) error

func DbDeletePublicKeyToDeSoBalance

func DbDeletePublicKeyToDeSoBalance(handle *badger.DB, snap *Snapshot, publicKey []byte) error

func DbDeletePublicKeyToDeSoBalanceWithTxn

func DbDeletePublicKeyToDeSoBalanceWithTxn(txn *badger.Txn, snap *Snapshot, publicKey []byte) error

func DbDeleteRepostMappingsWithTxn

func DbDeleteRepostMappingsWithTxn(txn *badger.Txn, snap *Snapshot, repostEntry RepostEntry) error

Note this deletes the repost for the user *and* the reposted post since a mapping should exist for each.

func DbDeleteTxindexNextIndexForPublicKeyWithTxn

func DbDeleteTxindexNextIndexForPublicKeyWithTxn(txn *badger.Txn, snap *Snapshot, publicKey []byte) error

func DbDeleteTxindexPublicKeyToTxnMappingSingleWithTxn

func DbDeleteTxindexPublicKeyToTxnMappingSingleWithTxn(txn *badger.Txn,
	snap *Snapshot, publicKey []byte, txID *BlockHash) error

func DbDeleteTxindexTransactionMappings

func DbDeleteTxindexTransactionMappings(handle *badger.DB, snap *Snapshot, blockHeight uint64,
	desoTxn *MsgDeSoTxn, params *DeSoParams) error

func DbDeleteTxindexTransactionMappingsWithTxn

func DbDeleteTxindexTransactionMappingsWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64,
	desoTxn *MsgDeSoTxn, params *DeSoParams) error

func DbExistsBitcoinBurnTxID

func DbExistsBitcoinBurnTxID(db *badger.DB, snap *Snapshot, bitcoinBurnTxID *BlockHash) bool

func DbExistsBitcoinBurnTxIDWithTxn

func DbExistsBitcoinBurnTxIDWithTxn(txn *badger.Txn, snap *Snapshot, bitcoinBurnTxID *BlockHash) bool

func DbGetBlockRewardForPublicKeyBlockHash

func DbGetBlockRewardForPublicKeyBlockHash(db *badger.DB, snap *Snapshot, publicKey []byte, blockHash *BlockHash,
) (_balance uint64, _err error)

func DbGetBlockRewardForPublicKeyBlockHashWithTxn

func DbGetBlockRewardForPublicKeyBlockHashWithTxn(txn *badger.Txn, snap *Snapshot, publicKey []byte, blockHash *BlockHash,
) (_balance uint64, _err error)

func DbGetDeSoBalanceNanosForPublicKey

func DbGetDeSoBalanceNanosForPublicKey(db *badger.DB, snap *Snapshot, publicKey []byte,
) (_balance uint64, _err error)

func DbGetDeSoBalanceNanosForPublicKeyWithTxn

func DbGetDeSoBalanceNanosForPublicKeyWithTxn(txn *badger.Txn, snap *Snapshot, publicKey []byte,
) (_balance uint64, _err error)

func DbGetFollowerToFollowedMapping

func DbGetFollowerToFollowedMapping(db *badger.DB, snap *Snapshot,
	followerPKID *PKID, followedPKID *PKID) []byte

func DbGetFollowerToFollowedMappingWithTxn

func DbGetFollowerToFollowedMappingWithTxn(txn *badger.Txn,
	snap *Snapshot, followerPKID *PKID, followedPKID *PKID) []byte

func DbGetForbiddenBlockSignaturePubKey

func DbGetForbiddenBlockSignaturePubKey(db *badger.DB, snap *Snapshot, publicKey []byte) []byte

func DbGetForbiddenBlockSignaturePubKeyWithTxn

func DbGetForbiddenBlockSignaturePubKeyWithTxn(txn *badger.Txn, snap *Snapshot, publicKey []byte) []byte

func DbGetLikerPubKeyToLikedPostHashMapping

func DbGetLikerPubKeyToLikedPostHashMapping(
	db *badger.DB, snap *Snapshot, userPubKey []byte, likedPostHash BlockHash) []byte

func DbGetLikerPubKeyToLikedPostHashMappingWithTxn

func DbGetLikerPubKeyToLikedPostHashMappingWithTxn(txn *badger.Txn,
	snap *Snapshot, userPubKey []byte, likedPostHash BlockHash) []byte

func DbGetLikerPubKeysLikingAPostHash

func DbGetLikerPubKeysLikingAPostHash(handle *badger.DB, likedPostHash BlockHash) (
	_pubKeys [][]byte, _err error)

func DbGetNanosPurchased

func DbGetNanosPurchased(handle *badger.DB, snap *Snapshot) uint64

func DbGetNanosPurchasedWithTxn

func DbGetNanosPurchasedWithTxn(txn *badger.Txn, snap *Snapshot) uint64

func DbGetPKIDsThatDiamondedYouMap

func DbGetPKIDsThatDiamondedYouMap(handle *badger.DB, yourPKID *PKID, fetchYouDiamonded bool) (
	_pkidToDiamondsMap map[PKID][]*DiamondEntry, _err error)

This function returns a map of PKIDs that gave diamonds to a list of DiamondEntrys that contain post hashes.

func DbGetPrefixForPublicKeyToDesoBalanceNanos

func DbGetPrefixForPublicKeyToDesoBalanceNanos() []byte

func DbGetPubKeysFollowingYou

func DbGetPubKeysFollowingYou(handle *badger.DB, snap *Snapshot, yourPubKey []byte) (
	_pubKeys [][]byte, _err error)

func DbGetPubKeysYouFollow

func DbGetPubKeysYouFollow(handle *badger.DB, snap *Snapshot, yourPubKey []byte) (
	_pubKeys [][]byte, _err error)

func DbGetTxindexFullTransactionByTxID

func DbGetTxindexFullTransactionByTxID(txindexDBHandle *badger.DB, snap *Snapshot,
	blockchainDBHandle *badger.DB, txID *BlockHash) (
	_txn *MsgDeSoTxn, _txnMeta *TransactionMetadata)

DbGetTxindexFullTransactionByTxID TODO: This makes lookups inefficient when blocks are large. Shouldn't be a problem for a while, but keep an eye on it.

func DbGetTxindexNextIndexForPublicKey

func DbGetTxindexNextIndexForPublicKey(handle *badger.DB, snap *Snapshot, publicKey []byte) *uint64

func DbGetUSDCentsPerBitcoinExchangeRate

func DbGetUSDCentsPerBitcoinExchangeRate(handle *badger.DB, snap *Snapshot) uint64

func DbGetUSDCentsPerBitcoinExchangeRateWithTxn

func DbGetUSDCentsPerBitcoinExchangeRateWithTxn(txn *badger.Txn, snap *Snapshot) uint64

func DbPrefixForCreatorDeSoLockedNanosCreatorPKID

func DbPrefixForCreatorDeSoLockedNanosCreatorPKID() []byte

func DbPutBitcoinBurnTxIDWithTxn

func DbPutBitcoinBurnTxIDWithTxn(txn *badger.Txn, snap *Snapshot, bitcoinBurnTxID *BlockHash) error

func DbPutDeSoBalanceForPublicKey

func DbPutDeSoBalanceForPublicKey(handle *badger.DB, snap *Snapshot,
	publicKey []byte, balanceNanos uint64) error

func DbPutDeSoBalanceForPublicKeyWithTxn

func DbPutDeSoBalanceForPublicKeyWithTxn(txn *badger.Txn, snap *Snapshot,
	publicKey []byte, balanceNanos uint64) error

func DbPutDiamondMappings

func DbPutDiamondMappings(handle *badger.DB, snap *Snapshot, blockHeight uint64,
	diamondEntry *DiamondEntry) error

func DbPutDiamondMappingsWithTxn

func DbPutDiamondMappingsWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64,
	diamondEntry *DiamondEntry) error

func DbPutFollowMappings

func DbPutFollowMappings(handle *badger.DB, snap *Snapshot,
	followerPKID *PKID, followedPKID *PKID) error

func DbPutFollowMappingsWithTxn

func DbPutFollowMappingsWithTxn(txn *badger.Txn, snap *Snapshot,
	followerPKID *PKID, followedPKID *PKID) error

Note that this adds a mapping for the follower *and* the pub key being followed.

func DbPutForbiddenBlockSignaturePubKey

func DbPutForbiddenBlockSignaturePubKey(handle *badger.DB, snap *Snapshot, publicKey []byte) error

func DbPutForbiddenBlockSignaturePubKeyWithTxn

func DbPutForbiddenBlockSignaturePubKeyWithTxn(txn *badger.Txn, snap *Snapshot, publicKey []byte) error

func DbPutGlobalParamsEntry

func DbPutGlobalParamsEntry(handle *badger.DB, snap *Snapshot, blockHeight uint64,
	globalParamsEntry GlobalParamsEntry) error

func DbPutGlobalParamsEntryWithTxn

func DbPutGlobalParamsEntryWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64,
	globalParamsEntry GlobalParamsEntry) error

func DbPutLikeMappings

func DbPutLikeMappings(handle *badger.DB, snap *Snapshot,
	userPubKey []byte, likedPostHash BlockHash) error

func DbPutLikeMappingsWithTxn

func DbPutLikeMappingsWithTxn(txn *badger.Txn, snap *Snapshot,
	userPubKey []byte, likedPostHash BlockHash) error

Note that this adds a mapping for the user *and* the liked post.

func DbPutMempoolTxn

func DbPutMempoolTxn(handle *badger.DB, snap *Snapshot, blockHeight uint64, mempoolTx *MempoolTx) error

func DbPutMempoolTxnWithTxn

func DbPutMempoolTxnWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64, mempoolTx *MempoolTx) error

func DbPutNanosPurchased

func DbPutNanosPurchased(handle *badger.DB, snap *Snapshot, nanosPurchased uint64) error

func DbPutNanosPurchasedWithTxn

func DbPutNanosPurchasedWithTxn(txn *badger.Txn, snap *Snapshot, nanosPurchased uint64) error

func DbPutRepostMappings

func DbPutRepostMappings(handle *badger.DB, snap *Snapshot, blockHeight uint64,
	userPubKey []byte, repostedPostHash BlockHash, repostEntry RepostEntry) error

func DbPutRepostMappingsWithTxn

func DbPutRepostMappingsWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64,
	repostEntry RepostEntry) error

Note that this adds a mapping for the user *and* the reposted post.

func DbPutTxindexNextIndexForPublicKeyWithTxn

func DbPutTxindexNextIndexForPublicKeyWithTxn(txn *badger.Txn, snap *Snapshot,
	publicKey []byte, nextIndex uint64) error

func DbPutTxindexPublicKeyToTxnMappingSingleWithTxn

func DbPutTxindexPublicKeyToTxnMappingSingleWithTxn(txn *badger.Txn, snap *Snapshot,
	publicKey []byte, txID *BlockHash) error

func DbPutTxindexTip

func DbPutTxindexTip(handle *badger.DB, snap *Snapshot, tipHash *BlockHash) error

func DbPutTxindexTipWithTxn

func DbPutTxindexTipWithTxn(txn *badger.Txn, snap *Snapshot, tipHash *BlockHash) error

func DbPutTxindexTransaction

func DbPutTxindexTransaction(handle *badger.DB, snap *Snapshot, blockHeight uint64,
	txID *BlockHash, txnMeta *TransactionMetadata) error

func DbPutTxindexTransactionMappings

func DbPutTxindexTransactionMappings(handle *badger.DB, snap *Snapshot, blockHeight uint64,
	desoTxn *MsgDeSoTxn, params *DeSoParams, txnMeta *TransactionMetadata) error

func DbPutTxindexTransactionMappingsWithTxn

func DbPutTxindexTransactionMappingsWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64,
	desoTxn *MsgDeSoTxn, params *DeSoParams, txnMeta *TransactionMetadata) error

func DbPutTxindexTransactionWithTxn

func DbPutTxindexTransactionWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64,
	txID *BlockHash, txnMeta *TransactionMetadata) error

func DbPutUSDCentsPerBitcoinExchangeRateWithTxn

func DbPutUSDCentsPerBitcoinExchangeRateWithTxn(txn *badger.Txn, snap *Snapshot,
	usdCentsPerBitcoinExchangeRate uint64) error

func DbTxindexPublicKeyIndexToTxnKey

func DbTxindexPublicKeyIndexToTxnKey(publicKey []byte, index uint32) []byte

func DbTxindexPublicKeyPrefix

func DbTxindexPublicKeyPrefix(publicKey []byte) []byte

func DbTxindexTxIDKey

func DbTxindexTxIDKey(txID *BlockHash) []byte

func DecodeByteArray

func DecodeByteArray(reader io.Reader) ([]byte, error)

func DecodeExtraData

func DecodeExtraData(rr io.Reader) (map[string][]byte, error)

DecodeExtraData is used in consensus so don't change it

func DecodeFromBytes

func DecodeFromBytes(encoder DeSoEncoder, rr *bytes.Reader) (_existenceByte bool, _error error)

DecodeFromBytes decodes a DeSoEncoder type from bytes. We check for the existence byte, which tells us whether actual data was encoded, or a nil pointer.

func DecodeMapStringUint64

func DecodeMapStringUint64(rr *bytes.Reader) (map[string]uint64, error)

func DecodePKIDuint64Map

func DecodePKIDuint64Map(rr io.Reader) (map[PKID]uint64, error)

func DecodeUint256

func DecodeUint256(rr *bytes.Reader) (*uint256.Int, error)

func DecodeUint32

func DecodeUint32(num []byte) uint32

func DecodeUint64

func DecodeUint64(scoreBytes []byte) uint64

func DecryptBytesWithPrivateKey

func DecryptBytesWithPrivateKey(bytesToDecrypt []byte, privKey *ecdsa.PrivateKey) ([]byte, error)

func DeleteBlockReward

func DeleteBlockReward(handle *badger.DB, snap *Snapshot, desoBlock *MsgDeSoBlock) error

func DeleteBlockRewardWithTxn

func DeleteBlockRewardWithTxn(txn *badger.Txn, snap *Snapshot, desoBlock *MsgDeSoBlock) error

func DeletePubKeyUtxoKeyMappingWithTxn

func DeletePubKeyUtxoKeyMappingWithTxn(txn *badger.Txn, snap *Snapshot,
	publicKey []byte, utxoKey *UtxoKey) error

func DeleteUnmodifiedMappingsForUtxoWithTxn

func DeleteUnmodifiedMappingsForUtxoWithTxn(txn *badger.Txn, snap *Snapshot, utxoKey *UtxoKey) error

func DeleteUtxoEntryForKeyWithTxn

func DeleteUtxoEntryForKeyWithTxn(txn *badger.Txn, snap *Snapshot, utxoKey *UtxoKey) error

func DeleteUtxoOperationsForBlockWithTxn

func DeleteUtxoOperationsForBlockWithTxn(txn *badger.Txn, snap *Snapshot, blockHash *BlockHash) error

func DeserializePubKeyToUint64Map

func DeserializePubKeyToUint64Map(data []byte) (map[PublicKey]uint64, error)

func Diff

func Diff(expected interface{}, actual interface{}) string

Diff returns a diff of both values as long as both are of the same type and are a struct, map, slice, array or string. Otherwise it returns an empty string.

func Div

func Div(a *big.Float, b *big.Float) *big.Float

func EncodeByteArray

func EncodeByteArray(bytes []byte) []byte

func EncodeExtraData

func EncodeExtraData(extraData map[string][]byte) []byte

EncodeExtraData is used in consensus so don't change it

func EncodeKeyAndValueForChecksum

func EncodeKeyAndValueForChecksum(key []byte, value []byte, blockHeight uint64) []byte

func EncodeKeyValue

func EncodeKeyValue(key []byte, value []byte) []byte

EncodeKeyValue encodes DB key and value similarly to how DER signatures are encoded. The format is: len(key + value) || len(key) || key || len(value) || value This encoding is unique meaning (key, value) and (key', value') pairs have the same encoding if and only if key = key' and value = value'

func EncodeMapStringUint64

func EncodeMapStringUint64(mapStruct map[string]uint64) []byte

func EncodeOptionalBlockHash

func EncodeOptionalBlockHash(val *BlockHash) []byte

func EncodeOptionalPublicKey

func EncodeOptionalPublicKey(val *PublicKey) []byte

func EncodeOptionalUint256

func EncodeOptionalUint256(val *uint256.Int) []byte

func EncodePKIDuint64Map

func EncodePKIDuint64Map(pkidMap map[PKID]uint64) []byte

func EncodeToBytes

func EncodeToBytes(blockHeight uint64, encoder DeSoEncoder, skipMetadata ...bool) []byte

EncodeToBytes encodes a DeSoEncoder type to bytes, including encoder metadata such as existence byte, the encoder type, and the current blockHeight. The skipMetadata parameter should be always passed if we're nesting DeSoEncoders, but in general it shouldn't be passed. This parameter is only used when we're computing the state checksum.

func EncodeUint256

func EncodeUint256(number *uint256.Int) []byte

func EncodeUint64

func EncodeUint64(num uint64) []byte

func EncryptBytesWithPublicKey

func EncryptBytesWithPublicKey(bytesToEncrypt []byte, pubkey *ecdsa.PublicKey) ([]byte, error)

func EnumerateKeysForPrefix

func EnumerateKeysForPrefix(db *badger.DB, dbPrefix []byte) (_keysFound [][]byte, _valsFound [][]byte)

func EnumerateKeysForPrefixWithLimitOffsetOrder added in v3.2.0

func EnumerateKeysForPrefixWithLimitOffsetOrder(
	db *badger.DB,
	prefix []byte,
	limit int,
	lastSeenKey []byte,
	sortDescending bool,
	skipKeys *Set[string],
) ([][]byte, [][]byte, error)

func EqualGroupKeyName

func EqualGroupKeyName(a, b *GroupKeyName) bool

func EstimateBitcoinTxFee

func EstimateBitcoinTxFee(
	numInputs int, numOutputs int, feeRateSatoshisPerKB uint64) uint64

func ExtractBitcoinBurnTransactionsFromBitcoinBlock

func ExtractBitcoinBurnTransactionsFromBitcoinBlock(
	bitcoinBlock *wire.MsgBlock, bitcoinBurnAddress string, params *DeSoParams) []*wire.MsgTx

func ExtractBitcoinBurnTransactionsFromBitcoinBlockWithMerkleProofs

func ExtractBitcoinBurnTransactionsFromBitcoinBlockWithMerkleProofs(
	bitcoinBlock *wire.MsgBlock, burnAddress string, params *DeSoParams) (
	_txns []*wire.MsgTx, _merkleProofs [][]*merkletree.ProofPart, _err error)

func ExtractBitcoinPublicKeyFromBitcoinTransactionInputs

func ExtractBitcoinPublicKeyFromBitcoinTransactionInputs(
	bitcoinTransaction *wire.MsgTx, btcdParams *chaincfg.Params) (
	_publicKey *btcec.PublicKey, _err error)

func FlushMempoolToDb

func FlushMempoolToDb(handle *badger.DB, snap *Snapshot, blockHeight uint64, allTxns []*MempoolTx) error

func FlushMempoolToDbWithTxn

func FlushMempoolToDbWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64, allTxns []*MempoolTx) error

func FormatScaledUint256AsDecimalString

func FormatScaledUint256AsDecimalString(v *big.Int, scalingFactor *big.Int) string

Given a value v that is a scaled uint256 with the provided scaling factor, this prints the decimal representation of v as a string Ex: if v = 12345 and scalingFactor = 100, then this outputs 123.45

func GetBadgerDbPath

func GetBadgerDbPath(dataDir string) string

GetBadgerDbPath returns the path where we store the badgerdb data.

func GetBlockIndex

func GetBlockIndex(handle *badger.DB, bitcoinNodes bool) (map[BlockHash]*BlockNode, error)

func GetBlockTipHeight

func GetBlockTipHeight(handle *badger.DB, bitcoinNodes bool) (uint64, error)

GetBlockTipHeight fetches the current block tip height from the database.

func GetCreatorCoinNanosForDiamondLevelAtBlockHeight

func GetCreatorCoinNanosForDiamondLevelAtBlockHeight(
	coinsInCirculationNanos uint64, desoLockedNanos uint64,
	diamondLevel int64, blockHeight int64, params *DeSoParams) uint64

At a particular diamond level, a fixed amount of DeSo is converted into creator coins and then sent to a user. This function computes the amount of creator coins required for a particular level.

func GetDataDir

func GetDataDir(params *DeSoParams) string

GetDataDir gets the user data directory where we store files in a cross-platform way.

func GetDeSoNanosDiamondLevelMapAtBlockHeight

func GetDeSoNanosDiamondLevelMapAtBlockHeight(
	blockHeight int64) map[int64]uint64

Each diamond level is worth a fixed amount of DeSo. These amounts can be changed in the future by simply returning a new set of values after a particular block height.

func GetDeSoNanosForDiamondLevelAtBlockHeight

func GetDeSoNanosForDiamondLevelAtBlockHeight(
	diamondLevel int64, blockHeight int64) uint64

func GetMigrationVersion

func GetMigrationVersion(blockHeight uint64, appliedMigrationNames ...MigrationName) byte

GetMigrationVersion can be returned in GetVersionByte when implementing DeSoEncoders. The way to do it is simply calling `return GetMigrationVersion(blockHeight, [Migration Names])` where migration names are all EncoderMigrationHeights that were used in RawEncodeWithoutMetadata and RawDecodeWithoutMetadata. [Migration Names] can be simply a list of MigrationName strings corresponding to these EncodeMigrationHeights.

func GetNumDigits

func GetNumDigits(val *big.Int) int

func GetNumberOfStructFields

func GetNumberOfStructFields[T any](obj T) int

func GetParamUpdaterPublicKeys

func GetParamUpdaterPublicKeys(blockHeight uint32, params *DeSoParams) map[PkMapKey]bool

func GetReorgBlocks

func GetReorgBlocks(tip *BlockNode, newNode *BlockNode) (_commonAncestor *BlockNode, _detachNodes []*BlockNode, _attachNodes []*BlockNode)

func GetS256BasePointCompressed

func GetS256BasePointCompressed() []byte

func GetSatoshisPerUnitExchangeRate

func GetSatoshisPerUnitExchangeRate(startNanos uint64, usdCentsPerBitcoinExchangeRate uint64) uint64

func GetStartPriceSatoshisPerDeSo

func GetStartPriceSatoshisPerDeSo(usdCentsPerBitcoinExchangeRate uint64) uint64

func GetUtxoNumEntries

func GetUtxoNumEntries(handle *badger.DB, snap *Snapshot) uint64

func GetUtxoNumEntriesWithTxn

func GetUtxoNumEntriesWithTxn(txn *badger.Txn, snap *Snapshot) uint64

func GetUtxoOperationsForBlock

func GetUtxoOperationsForBlock(handle *badger.DB, snap *Snapshot, blockHash *BlockHash) ([][]*UtxoOperation, error)

func GetUtxoOperationsForBlockWithTxn

func GetUtxoOperationsForBlockWithTxn(txn *badger.Txn, snap *Snapshot, blockHash *BlockHash) ([][]*UtxoOperation, error)

func HashToBigint

func HashToBigint(hash *BlockHash) *big.Int

func HeaderSizeBytes

func HeaderSizeBytes() int

func HexToUint256

func HexToUint256(input string) *uint256.Int

func IPToNetAddr

func IPToNetAddr(ipStr string, addrMgr *addrmgr.AddrManager, params *DeSoParams) (*wire.NetAddress, error)

func InitDbWithDeSoGenesisBlock

func InitDbWithDeSoGenesisBlock(params *DeSoParams, handle *badger.DB,
	eventManager *EventManager, snap *Snapshot) error

InitDbWithGenesisBlock initializes the database to contain only the genesis block.

func InitializeSecureMiddleware

func InitializeSecureMiddleware(allowedHosts []string, isDevelopment bool, contentSecurityPolicy string) *secure.Secure

allowedHost is expected to be of the form "bitclout.com" See comments in this function for a description of these params

Note: FeaturePolicy is apparently renamed to PermissionsPolicy. Maybe we should fork secure.go and add that. https://scotthelme.co.uk/goodbye-feature-policy-and-hello-permissions-policy/

func IntAdd

func IntAdd(a *big.Int, b *big.Int) *big.Int

func IntDiv

func IntDiv(a *big.Int, b *big.Int) *big.Int

func IntMul

func IntMul(a *big.Int, b *big.Int) *big.Int

func IntSub

func IntSub(a *big.Int, b *big.Int) *big.Int

func IntToBuf

func IntToBuf(xx int64) []byte

func IsBitcoinTestnet

func IsBitcoinTestnet(params *DeSoParams) bool

func IsByteArrayValidPublicKey

func IsByteArrayValidPublicKey(bytes []byte) error

IsByteArrayValidPublicKey is a general functionality that is used to verify if a byte array is a valid secp256k1 public key

func IsControlMessage

func IsControlMessage(msgType MsgType) bool

IsControlMessage is used by functions to determine whether a particular message is a control message. This is useful, for example, in disallowing external Peers from manipulating our node by sending control messages of their own.

func IsDerivedSignature

func IsDerivedSignature(txn *MsgDeSoTxn, blockHeight uint32) (_derivedPkBytes []byte, _isDerived bool, _err error)

IsDerivedSignature checks if a transaction was signed using a derived key. If so, it will recover the derived key used to sign the transaction. There are two possible ways to serialize transaction's ECDSA signature for a derived key. Either to use the DER encoding and place the derived public key in transaction's ExtraData, or to use DeSo-DER signature encoding and pass a special recovery ID into the signature's bytes. However, both encodings can't be used at the same time.

func IsNodeArchival

func IsNodeArchival(syncType NodeSyncType) bool

func IsQuotedRepost

func IsQuotedRepost(postEntry *PostEntry) bool

func IsRuleError

func IsRuleError(err error) bool

IsRuleError returns true if the error is any of the errors specified above.

func IsVanillaRepost

func IsVanillaRepost(postEntry *PostEntry) bool

Return true if postEntry is a vanilla repost. A vanilla repost is a post that reposts another post, but does not have a body.

func LeftPaddedHexToUint256

func LeftPaddedHexToUint256(input string) *uint256.Int

func LessThan

func LessThan(aa *BlockHash, bb *BlockHash) bool

func LogDBSummarySnapshot

func LogDBSummarySnapshot(db *badger.DB)

func LogSelect

func LogSelect(query *orm.Query) error

LogSelect is a helpful utility when developing or debugging queries. Simply call LogSelect(query) instead of query.Select() to get a log of the raw query.

func MakeDirIfNonExistent

func MakeDirIfNonExistent(filePath string) error

This function attempts to make the file path provided. Returns an =errors if a parent directory in the path does not exist or another error is encountered. User permissions are set to "rwx" so that it can be manipulated. See: https://stackoverflow.com/questions/14249467/os-mkdir-and-os-mkdirall-permission-value/31151508

func MapKeysToNonDeterministicPointerSlice added in v3.2.0

func MapKeysToNonDeterministicPointerSlice[K comparable, V any](inputMap map[K]V) []*K

func MapSet added in v3.2.0

func MapSet[T comparable, K any](set *Set[T], mapFunc func(elem T) (K, error)) ([]K, error)

func MessagingKeyNameDecode

func MessagingKeyNameDecode(name *GroupKeyName) []byte

Decode filled message key of length MaxMessagingKeyNameCharacters array.

func MigrationTriggered

func MigrationTriggered(blockHeight uint64, migrationName MigrationName) bool

MigrationTriggered is a suggested conditional check to be called within RawEncodeWithoutMetadata and RawDecodeWithoutMetadata when defining the encoding migrations for DeSoEncoders. Consult constants.go for more info.

func MinInt

func MinInt(a, b int) int

func MinUint32

func MinUint32(a, b uint32) uint32

func Mul

func Mul(a *big.Float, b *big.Float) *big.Float

func MustBase58CheckDecode

func MustBase58CheckDecode(input string) []byte

func NewFloat

func NewFloat() *big.Float

func NodeCanHypersyncState

func NodeCanHypersyncState(syncType NodeSyncType) bool

func PKIDToPublicKey

func PKIDToPublicKey(pkid *PKID) []byte

func PPrintJSON

func PPrintJSON(xx interface{})

PPrintJSON prints a JSON object but pretty.

func ParsePostgresURI

func ParsePostgresURI(pgURI string) *pg.Options

func PerformanceBadgerOptions

func PerformanceBadgerOptions(dir string) badger.Options

PerformanceBadgerOptions are performance geared BadgerDB options that use much more RAM than the default settings.

func PkToString

func PkToString(pk []byte, params *DeSoParams) string

func PkToStringBoth

func PkToStringBoth(pk []byte) string

func PkToStringMainnet

func PkToStringMainnet(pk []byte) string

func PkToStringTestnet

func PkToStringTestnet(pk []byte) string

func PrivToString

func PrivToString(priv []byte, params *DeSoParams) string

func PublicKeyBlockHashToBlockRewardKey

func PublicKeyBlockHashToBlockRewardKey(publicKey []byte, blockHash *BlockHash) []byte

func PutBestHash

func PutBestHash(handle *badger.DB, snap *Snapshot, bh *BlockHash, chainType ChainType) error

func PutBestHashWithTxn

func PutBestHashWithTxn(txn *badger.Txn, snap *Snapshot,
	bh *BlockHash, chainType ChainType) error

func PutBlock

func PutBlock(handle *badger.DB, snap *Snapshot, desoBlock *MsgDeSoBlock) error

func PutBlockWithTxn

func PutBlockWithTxn(txn *badger.Txn, snap *Snapshot, desoBlock *MsgDeSoBlock) error

func PutHeightHashToNodeInfo

func PutHeightHashToNodeInfo(handle *badger.DB, snap *Snapshot, node *BlockNode, bitcoinNodes bool) error

func PutHeightHashToNodeInfoWithTxn

func PutHeightHashToNodeInfoWithTxn(txn *badger.Txn, snap *Snapshot,
	node *BlockNode, bitcoinNodes bool) error

func PutMappingsForUtxoWithTxn

func PutMappingsForUtxoWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64,
	utxoKey *UtxoKey, utxoEntry *UtxoEntry) error

func PutPubKeyUtxoKeyWithTxn

func PutPubKeyUtxoKeyWithTxn(txn *badger.Txn, snap *Snapshot, publicKey []byte, utxoKey *UtxoKey) error

func PutUtxoEntryForUtxoKeyWithTxn

func PutUtxoEntryForUtxoKeyWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64,
	utxoKey *UtxoKey, utxoEntry *UtxoEntry) error

func PutUtxoNumEntriesWithTxn

func PutUtxoNumEntriesWithTxn(txn *badger.Txn, snap *Snapshot, newNumEntries uint64) error

func PutUtxoOperationsForBlockWithTxn

func PutUtxoOperationsForBlockWithTxn(txn *badger.Txn, snap *Snapshot, blockHeight uint64,
	blockHash *BlockHash, utxoOpsForBlock [][]*UtxoOperation) error

func PutUvarint

func PutUvarint(buf []byte, x uint64) int

PutUvarint encodes a uint64 into buf and returns the number of bytes written. If the buffer is too small, PutUvarint will panic.

func PutVarint

func PutVarint(buf []byte, x int64) int

PutVarint encodes an int64 into buf and returns the number of bytes written. If the buffer is too small, PutVarint will panic.

func RandInt32

func RandInt32(max int32) int32

RandInt32 returns a random 32-bit int.

func RandInt64

func RandInt64(max int64) int64

RandInt64 returns a random 64-bit int.

func RandomBytes

func RandomBytes(numBytes int32) []byte

RandomBytes returns a []byte with random values.

func RandomBytesHex

func RandomBytesHex(numBytes int32) string

RandomBytesHex returns a hex string representing numBytes of entropy.

func ReadBoolByte

func ReadBoolByte(rr *bytes.Reader) (bool, error)

func ReadMessageVersion

func ReadMessageVersion(txn *MsgDeSoTxn) (_version uint8, _err error)

func ReadOptionalUint256

func ReadOptionalUint256(rr *bytes.Reader) (*uint256.Int, error)

func ReadUvarint

func ReadUvarint(r io.Reader) (uint64, error)

ReadUvarint reads an encoded unsigned integer from r and returns it as a uint64.

func ReadVarString

func ReadVarString(rr io.Reader) ([]byte, error)

func ReadVarint

func ReadVarint(r io.Reader) (int64, error)

ReadVarint reads an encoded signed integer from r and returns it as an int64.

func SafeMakeMapWithCapacity added in v3.0.2

func SafeMakeMapWithCapacity[K comparable, V any](length uint64) (_ map[K]V, outputError error)

SafeMakeMapWithCapacity catches a panic in the make function and returns and error if the make function panics. Note that we typically do not allow named return value in function signatures. However, in this case, we must use a named return value for the error, so we can properly return an error if make panics.

func SafeMakeRecover added in v3.0.2

func SafeMakeRecover(outputError *error)

SafeMakeRecover recovers from a panic and sets the value of error parameter. This function should be called with defer so it ALWAYS runs after the execution of a function. This way if a function execution ends with a panic, SafeMakeRecover will "recover" the panic and set the error appropriately. We set the value of the pointer to the output error such that the calling function will return an error instead of a nil value. Unfortunately, there is no way to overwrite the return value of the calling function with a deferred function without the usage of named return values.

func SafeMakeSliceWithLength added in v3.0.2

func SafeMakeSliceWithLength[T any](length uint64) (_ []T, outputError error)

SafeMakeSliceWithLength catches a panic in the make function and returns and error if the make function panics. Note that we typically do not allow named return value in function signatures. However, in this case, we must use a named return value for the error, so we can properly return an error if make panics.

func SafeMakeSliceWithLengthAndCapacity added in v3.0.2

func SafeMakeSliceWithLengthAndCapacity[T any](length uint64, capacity uint64) (_ []T, outputError error)

SafeMakeSliceWithLengthAndCapacity catches a panic in the make function and returns and error if the make function panics. Note that we typically do not allow named return value in function signatures. However, in this case, we must use a named return value for the error, so we can properly return an error if make panics.

func SafeUint256

func SafeUint256() *_SafeUint256

func SafeUint64

func SafeUint64() *_SafeUint64

func ScaleFloatFormatStringToUint256

func ScaleFloatFormatStringToUint256(floatStr string, scaleFactor *uint256.Int) (*uint256.Int, error)

ScaleFloatFormatStringToUint256 The most accurate way we've found to convert a decimal into a "scaled" value is to parse a string representation into a "whole" bigint and a "decimal" bigint. Once we have these two pieces of the number, we can scale the value without losing any precision.

In contrast, note that performing these operations on a big.Float results in an immediate loss of precision.

func SerializeBlockNode

func SerializeBlockNode(blockNode *BlockNode) ([]byte, error)

func SerializePubKeyToUint64Map

func SerializePubKeyToUint64Map(mm map[PublicKey]uint64) ([]byte, error)

func SignTransactionBytes

func SignTransactionBytes(txnBytes []byte, privateKey *btcec.PrivateKey, isDerived bool) ([]byte, []byte, error)

SignTransactionWithDerivedKey the signature contains solution iteration, which allows us to recover signer public key from the signature. Returns (new txn bytes, txn signature, error)

func StartDBSummarySnapshots

func StartDBSummarySnapshots(db *badger.DB)

func Sub

func Sub(a *big.Float, b *big.Float) *big.Float

func TextAndHash

func TextAndHash(data []byte) ([]byte, string)

TextAndHash corresponds to the Eth's accounts/account.go TextAndHash. Copied it here for security reasons.

func Uint256ToLeftPaddedHex

func Uint256ToLeftPaddedHex(input *uint256.Int) string

func UintToBuf

func UintToBuf(xx uint64) []byte

func Uvarint

func Uvarint(buf []byte) (uint64, int)

Uvarint decodes a uint64 from buf and returns that value and the number of bytes read (> 0). If an error occurred, the value is 0 and the number of bytes n is <= 0 meaning:

n == 0: buf too small
n  < 0: value larger than 64 bits (overflow)
        and -n is the number of bytes read

func ValidateAccessGroupPublicKeyAndName added in v3.2.0

func ValidateAccessGroupPublicKeyAndName(accessGroupOwnerPublicKey, keyName []byte) error

ValidateAccessGroupPublicKeyAndName validates that the provided access group public key and name are correctly formatted.

func ValidateGroupPublicKeyAndName

func ValidateGroupPublicKeyAndName(messagingPublicKey, keyName []byte) error

func ValidateHyperSyncFlags

func ValidateHyperSyncFlags(isHypersync bool, syncType NodeSyncType)

func Varint

func Varint(buf []byte) (int64, int)

Varint decodes an int64 from buf and returns that value and the number of bytes read (> 0). If an error occurred, the value is 0 and the number of bytes n is <= 0 with the following meaning:

n == 0: buf too small
n  < 0: value larger than 64 bits (overflow)
        and -n is the number of bytes read

func VerifyEthPersonalSignature

func VerifyEthPersonalSignature(signer, data, signature []byte) error

VerifyEthPersonalSignature checks the signature assuming it follows Ethereum's personal_sign standard. This is used for the MetaMask DeSo integration.

func VersionByteToMigrationHeight

func VersionByteToMigrationHeight(version byte, params *DeSoParams) (_blockHeight uint64)

func WriteMessage

func WriteMessage(ww io.Writer, msg DeSoMessage, networkType NetworkType) ([]byte, error)

WriteMessage takes an io.Writer and serializes and writes the specified message to it. Returns an error if the message is malformed or invalid for any reason. Otherwise returns the payload that was written sans the header.

Types

type AcceptNFTBidMetadata

type AcceptNFTBidMetadata struct {
	NFTPostHash    *BlockHash
	SerialNumber   uint64
	BidderPKID     *PKID
	BidAmountNanos uint64
	UnlockableText []byte

	// When an NFT owner accepts a bid, they must specify the bidder's UTXO inputs they will lock up
	// as payment for the purchase. This prevents the transaction from accidentally using UTXOs
	// that are used by future transactions.
	BidderInputs []*DeSoInput
}

func (*AcceptNFTBidMetadata) FromBytes

func (txnData *AcceptNFTBidMetadata) FromBytes(dataa []byte) error

func (*AcceptNFTBidMetadata) GetTxnType

func (txnData *AcceptNFTBidMetadata) GetTxnType() TxnType

func (*AcceptNFTBidMetadata) New

func (txnData *AcceptNFTBidMetadata) New() DeSoTxnMetadata

func (*AcceptNFTBidMetadata) ToBytes

func (txnData *AcceptNFTBidMetadata) ToBytes(preSignature bool) ([]byte, error)

type AcceptNFTBidTxindexMetadata

type AcceptNFTBidTxindexMetadata struct {
	NFTPostHashHex       string
	SerialNumber         uint64
	BidAmountNanos       uint64
	NFTRoyaltiesMetadata *NFTRoyaltiesMetadata
}

func (*AcceptNFTBidTxindexMetadata) GetEncoderType

func (txnMeta *AcceptNFTBidTxindexMetadata) GetEncoderType() EncoderType

func (*AcceptNFTBidTxindexMetadata) GetVersionByte

func (txnMeta *AcceptNFTBidTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*AcceptNFTBidTxindexMetadata) RawDecodeWithoutMetadata

func (txnMeta *AcceptNFTBidTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*AcceptNFTBidTxindexMetadata) RawEncodeWithoutMetadata

func (txnMeta *AcceptNFTBidTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type AcceptNFTTransferMetadata

type AcceptNFTTransferMetadata struct {
	NFTPostHash  *BlockHash
	SerialNumber uint64
}

func (*AcceptNFTTransferMetadata) FromBytes

func (txnData *AcceptNFTTransferMetadata) FromBytes(dataa []byte) error

func (*AcceptNFTTransferMetadata) GetTxnType

func (txnData *AcceptNFTTransferMetadata) GetTxnType() TxnType

func (*AcceptNFTTransferMetadata) New

func (*AcceptNFTTransferMetadata) ToBytes

func (txnData *AcceptNFTTransferMetadata) ToBytes(preSignature bool) ([]byte, error)

type AcceptNFTTransferTxindexMetadata

type AcceptNFTTransferTxindexMetadata struct {
	NFTPostHashHex string
	SerialNumber   uint64
}

func (*AcceptNFTTransferTxindexMetadata) GetEncoderType

func (txnMeta *AcceptNFTTransferTxindexMetadata) GetEncoderType() EncoderType

func (*AcceptNFTTransferTxindexMetadata) GetVersionByte

func (txnMeta *AcceptNFTTransferTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*AcceptNFTTransferTxindexMetadata) RawDecodeWithoutMetadata

func (txnMeta *AcceptNFTTransferTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*AcceptNFTTransferTxindexMetadata) RawEncodeWithoutMetadata

func (txnMeta *AcceptNFTTransferTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type AccessGroupEntry added in v3.2.0

type AccessGroupEntry struct {
	AccessGroupOwnerPublicKey *PublicKey
	AccessGroupKeyName        *GroupKeyName
	AccessGroupPublicKey      *PublicKey

	ExtraData map[string][]byte
	// contains filtered or unexported fields
}

func DBGetAccessGroupEntryByAccessGroupId added in v3.2.0

func DBGetAccessGroupEntryByAccessGroupId(db *badger.DB, snap *Snapshot,
	accessGroupOwnerPublicKey *PublicKey, accessGroupKeyName *GroupKeyName) (*AccessGroupEntry, error)

func DBGetAccessGroupEntryByAccessGroupIdWithTxn added in v3.2.0

func DBGetAccessGroupEntryByAccessGroupIdWithTxn(txn *badger.Txn, snap *Snapshot,
	accessGroupOwnerPublicKey *PublicKey, accessGroupKeyName *GroupKeyName) (*AccessGroupEntry, error)

func (*AccessGroupEntry) GetAccessGroupId added in v3.2.0

func (entry *AccessGroupEntry) GetAccessGroupId() AccessGroupId

func (*AccessGroupEntry) GetEncoderType added in v3.2.0

func (entry *AccessGroupEntry) GetEncoderType() EncoderType

func (*AccessGroupEntry) GetVersionByte added in v3.2.0

func (entry *AccessGroupEntry) GetVersionByte(blockHeight uint64) byte

func (*AccessGroupEntry) IsDeleted added in v3.2.0

func (entry *AccessGroupEntry) IsDeleted() bool

func (*AccessGroupEntry) RawDecodeWithoutMetadata added in v3.2.0

func (entry *AccessGroupEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*AccessGroupEntry) RawEncodeWithoutMetadata added in v3.2.0

func (entry *AccessGroupEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

func (*AccessGroupEntry) String added in v3.2.0

func (entry *AccessGroupEntry) String() string

type AccessGroupId added in v3.2.0

type AccessGroupId struct {
	AccessGroupOwnerPublicKey PublicKey
	AccessGroupKeyName        GroupKeyName
}

func DBGetAccessGroupIdsForMember added in v3.2.0

func DBGetAccessGroupIdsForMember(db *badger.DB, snap *Snapshot,
	accessGroupMemberPublicKey PublicKey) (_accessGroupIdsMember []*AccessGroupId, _err error)

func DBGetAccessGroupIdsForMemberWithTxn added in v3.2.0

func DBGetAccessGroupIdsForMemberWithTxn(txn *badger.Txn, snap *Snapshot,
	accessGroupMemberPublicKey PublicKey) (_accessGroupIdsMember []*AccessGroupId, _err error)

func DBGetAccessGroupIdsForOwner added in v3.2.0

func DBGetAccessGroupIdsForOwner(db *badger.DB, snap *Snapshot, accessGroupOwnerPublicKey PublicKey) ([]*AccessGroupId, error)

func DBGetAccessGroupIdsForOwnerWithTxn added in v3.2.0

func DBGetAccessGroupIdsForOwnerWithTxn(txn *badger.Txn, snap *Snapshot, accessGroupOwnerPublicKey PublicKey) ([]*AccessGroupId, error)

func NewAccessGroupId added in v3.2.0

func NewAccessGroupId(ownerPublicKey *PublicKey, groupKeyName []byte) *AccessGroupId

func (*AccessGroupId) FromBytes added in v3.2.0

func (key *AccessGroupId) FromBytes(rr *bytes.Reader) error

func (*AccessGroupId) String added in v3.2.0

func (key *AccessGroupId) String() string

func (*AccessGroupId) ToBytes added in v3.2.0

func (key *AccessGroupId) ToBytes() []byte

type AccessGroupLimitKey added in v3.2.0

type AccessGroupLimitKey struct {
	// AccessGroupOwnerPublicKey is the public key of the owner of the access group.
	AccessGroupOwnerPublicKey PublicKey

	// AccessGroupScopeType is the scope of the access group.
	AccessGroupScopeType AccessGroupScopeType

	// AccessGroupKeyName is the name of the access group.
	AccessGroupKeyName GroupKeyName

	// OperationType is the type of operation for which the spending limit count will apply
	OperationType AccessGroupOperationType
}

func MakeAccessGroupLimitKey added in v3.2.0

func MakeAccessGroupLimitKey(
	accessGroupOwnerPublicKey PublicKey,
	accessGroupScopeType AccessGroupScopeType,
	accessGroupKeyName GroupKeyName,
	operationType AccessGroupOperationType,
) AccessGroupLimitKey

func (*AccessGroupLimitKey) Decode added in v3.2.0

func (accessGroupLimitKey *AccessGroupLimitKey) Decode(rr *bytes.Reader) error

func (*AccessGroupLimitKey) Encode added in v3.2.0

func (accessGroupLimitKey *AccessGroupLimitKey) Encode() []byte

type AccessGroupMember added in v3.2.0

type AccessGroupMember struct {
	// AccessGroupMemberPublicKey is the public key of the user in the access group
	AccessGroupMemberPublicKey []byte

	// AccessGroupMemberKeyName is the name of the user in the access group
	AccessGroupMemberKeyName []byte

	EncryptedKey []byte

	ExtraData map[string][]byte
}

func (*AccessGroupMember) FromBytes added in v3.2.0

func (member *AccessGroupMember) FromBytes(rr *bytes.Reader) error

func (*AccessGroupMember) ToBytes added in v3.2.0

func (member *AccessGroupMember) ToBytes() []byte

type AccessGroupMemberEntry added in v3.2.0

type AccessGroupMemberEntry struct {
	// AccessGroupMemberPublicKey is the *owner* public key of the user in the access group
	AccessGroupMemberPublicKey *PublicKey

	// AccessGroupMemberKeyName is the key name of the user in the access group
	// Most of the time, we will be using a user's "default-key" key name
	AccessGroupMemberKeyName *GroupKeyName

	// EncryptedKey is the encrypted private key of the access group public key
	// If the access group's private key were GroupPriv, and the member's public
	// key were MemberPub, then we would have EncrypetdKey would be GroupPriv
	// encrypted with MemberPub.
	EncryptedKey []byte

	// ExtraData is an arbitrary key value map
	ExtraData map[string][]byte
	// contains filtered or unexported fields
}

func DBGetAccessGroupMemberEntry added in v3.2.0

func DBGetAccessGroupMemberEntry(db *badger.DB, snap *Snapshot,
	accessGroupMemberPublicKey PublicKey, accessGroupOwnerPublicKey PublicKey, accessGroupKeyName GroupKeyName) (*AccessGroupMemberEntry, error)

func DBGetAccessGroupMemberEntryWithTxn added in v3.2.0

func DBGetAccessGroupMemberEntryWithTxn(txn *badger.Txn, snap *Snapshot,
	accessGroupMemberPublicKey PublicKey, accessGroupOwnerPublicKey PublicKey, accessGroupKeyName GroupKeyName) (*AccessGroupMemberEntry, error)

func (*AccessGroupMemberEntry) GetEncoderType added in v3.2.0

func (entry *AccessGroupMemberEntry) GetEncoderType() EncoderType

func (*AccessGroupMemberEntry) GetVersionByte added in v3.2.0

func (entry *AccessGroupMemberEntry) GetVersionByte(blockHeight uint64) byte

func (*AccessGroupMemberEntry) IsDeleted added in v3.2.0

func (entry *AccessGroupMemberEntry) IsDeleted() bool

func (*AccessGroupMemberEntry) RawDecodeWithoutMetadata added in v3.2.0

func (entry *AccessGroupMemberEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*AccessGroupMemberEntry) RawEncodeWithoutMetadata added in v3.2.0

func (entry *AccessGroupMemberEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

func (*AccessGroupMemberEntry) String added in v3.2.0

func (entry *AccessGroupMemberEntry) String() string

type AccessGroupMemberEnumerationEntry added in v3.2.0

type AccessGroupMemberEnumerationEntry struct {
	// contains filtered or unexported fields
}

AccessGroupMemberEnumerationEntry

func MakeAccessGroupMemberEnumerationEntry added in v3.2.0

func MakeAccessGroupMemberEnumerationEntry() AccessGroupMemberEnumerationEntry

func (*AccessGroupMemberEnumerationEntry) GetEncoderType added in v3.2.0

func (entry *AccessGroupMemberEnumerationEntry) GetEncoderType() EncoderType

func (*AccessGroupMemberEnumerationEntry) GetVersionByte added in v3.2.0

func (entry *AccessGroupMemberEnumerationEntry) GetVersionByte(blockHeight uint64) byte

func (*AccessGroupMemberEnumerationEntry) RawDecodeWithoutMetadata added in v3.2.0

func (entry *AccessGroupMemberEnumerationEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*AccessGroupMemberEnumerationEntry) RawEncodeWithoutMetadata added in v3.2.0

func (entry *AccessGroupMemberEnumerationEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type AccessGroupMemberLimitKey added in v3.2.0

type AccessGroupMemberLimitKey struct {
	// AccessGroupOwnerPublicKey is the public key of the owner of the access group.
	AccessGroupOwnerPublicKey PublicKey

	// AccessGroupScopeType is the scope of the access group member.
	AccessGroupScopeType AccessGroupScopeType

	// AccessGroupKeyName is the name of the access group.
	AccessGroupKeyName GroupKeyName

	// OperationType is the type of operation for which the spending limit count will apply to.
	OperationType AccessGroupMemberOperationType
}

func MakeAccessGroupMemberLimitKey added in v3.2.0

func MakeAccessGroupMemberLimitKey(
	accessGroupOwnerPublicKey PublicKey,
	accessGroupScopeType AccessGroupScopeType,
	accessGroupKeyName GroupKeyName,
	operationType AccessGroupMemberOperationType,
) AccessGroupMemberLimitKey

func (*AccessGroupMemberLimitKey) Decode added in v3.2.0

func (accessGroupMemberLimitKey *AccessGroupMemberLimitKey) Decode(rr *bytes.Reader) error

func (*AccessGroupMemberLimitKey) Encode added in v3.2.0

func (accessGroupMemberLimitKey *AccessGroupMemberLimitKey) Encode() []byte

type AccessGroupMemberOperationString added in v3.2.0

type AccessGroupMemberOperationString string
const (
	AccessGroupMemberOperationStringUnknown AccessGroupMemberOperationString = "Unknown"
	AccessGroupMemberOperationStringAny     AccessGroupMemberOperationString = "Any"
	AccessGroupMemberOperationStringAdd     AccessGroupMemberOperationString = "Add"
	AccessGroupMemberOperationStringRemove  AccessGroupMemberOperationString = "Remove"
	AccessGroupMemberOperationStringUpdate  AccessGroupMemberOperationString = "Update"
)

func (AccessGroupMemberOperationString) ToAccessGroupMemberOperation added in v3.2.0

func (opString AccessGroupMemberOperationString) ToAccessGroupMemberOperation() AccessGroupMemberOperationType

type AccessGroupMemberOperationType added in v3.2.0

type AccessGroupMemberOperationType uint8
const (
	AccessGroupMemberOperationTypeUnknown AccessGroupMemberOperationType = 0
	AccessGroupMemberOperationTypeAny     AccessGroupMemberOperationType = 1
	AccessGroupMemberOperationTypeAdd     AccessGroupMemberOperationType = 2
	AccessGroupMemberOperationTypeRemove  AccessGroupMemberOperationType = 3
	AccessGroupMemberOperationTypeUpdate  AccessGroupMemberOperationType = 4
)

func (AccessGroupMemberOperationType) ToAccessGroupMemberOperationString added in v3.2.0

func (groupOp AccessGroupMemberOperationType) ToAccessGroupMemberOperationString() AccessGroupMemberOperationString

func (AccessGroupMemberOperationType) ToString added in v3.2.0

func (groupOp AccessGroupMemberOperationType) ToString() string

type AccessGroupMembersMetadata added in v3.2.0

type AccessGroupMembersMetadata struct {
	AccessGroupOwnerPublicKey []byte
	AccessGroupKeyName        []byte
	// The list of members to add/remove from the access group.
	AccessGroupMembersList []*AccessGroupMember
	// The operation to perform on the members.
	AccessGroupMemberOperationType
}

AccessGroupMembersMetadata is the metadata for a transaction to update the members of an access group.

func (*AccessGroupMembersMetadata) FromBytes added in v3.2.0

func (txnData *AccessGroupMembersMetadata) FromBytes(data []byte) error

func (*AccessGroupMembersMetadata) GetTxnType added in v3.2.0

func (txnData *AccessGroupMembersMetadata) GetTxnType() TxnType

func (*AccessGroupMembersMetadata) New added in v3.2.0

func (*AccessGroupMembersMetadata) ToBytes added in v3.2.0

func (txnData *AccessGroupMembersMetadata) ToBytes(preSignature bool) ([]byte, error)

type AccessGroupMembersTxindexMetadata added in v3.2.0

type AccessGroupMembersTxindexMetadata struct {
	AccessGroupOwnerPublicKey PublicKey
	AccessGroupKeyName        GroupKeyName
	AccessGroupMembersList    []*AccessGroupMember
	AccessGroupMemberOperationType
}

func (*AccessGroupMembersTxindexMetadata) GetEncoderType added in v3.2.0

func (accessGroupMembersTxindexMetadata *AccessGroupMembersTxindexMetadata) GetEncoderType() EncoderType

func (*AccessGroupMembersTxindexMetadata) GetVersionByte added in v3.2.0

func (accessGroupMembersTxindexMetadata *AccessGroupMembersTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*AccessGroupMembersTxindexMetadata) RawDecodeWithoutMetadata added in v3.2.0

func (accessGroupMembersTxindexMetadata *AccessGroupMembersTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*AccessGroupMembersTxindexMetadata) RawEncodeWithoutMetadata added in v3.2.0

func (accessGroupMembersTxindexMetadata *AccessGroupMembersTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type AccessGroupMembershipKey added in v3.2.0

type AccessGroupMembershipKey struct {
	AccessGroupMemberPublicKey PublicKey
	AccessGroupOwnerPublicKey  PublicKey
	AccessGroupKeyName         GroupKeyName
}

AccessGroupMembershipKey is used to index group memberships for a user.

func NewGroupMembershipKey added in v3.2.0

func NewGroupMembershipKey(groupMemberPublicKey PublicKey, groupOwnerPublicKey PublicKey, groupKeyName GroupKeyName) *AccessGroupMembershipKey

func (*AccessGroupMembershipKey) GetEncoderType added in v3.2.0

func (key *AccessGroupMembershipKey) GetEncoderType() EncoderType

func (*AccessGroupMembershipKey) GetVersionByte added in v3.2.0

func (key *AccessGroupMembershipKey) GetVersionByte(blockHeight uint64) byte

func (*AccessGroupMembershipKey) RawDecodeWithoutMetadata added in v3.2.0

func (key *AccessGroupMembershipKey) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*AccessGroupMembershipKey) RawEncodeWithoutMetadata added in v3.2.0

func (key *AccessGroupMembershipKey) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

func (*AccessGroupMembershipKey) String added in v3.2.0

func (key *AccessGroupMembershipKey) String() string

type AccessGroupMetadata added in v3.2.0

type AccessGroupMetadata struct {
	AccessGroupOwnerPublicKey []byte
	AccessGroupPublicKey      []byte
	AccessGroupKeyName        []byte
	AccessGroupOperationType  AccessGroupOperationType
}

func (*AccessGroupMetadata) FromBytes added in v3.2.0

func (txnData *AccessGroupMetadata) FromBytes(data []byte) error

func (*AccessGroupMetadata) GetTxnType added in v3.2.0

func (txnData *AccessGroupMetadata) GetTxnType() TxnType

func (*AccessGroupMetadata) New added in v3.2.0

func (txnData *AccessGroupMetadata) New() DeSoTxnMetadata

func (*AccessGroupMetadata) ToBytes added in v3.2.0

func (txnData *AccessGroupMetadata) ToBytes(preSignature bool) ([]byte, error)

type AccessGroupOperationString added in v3.2.0

type AccessGroupOperationString string
const (
	AccessGroupOperationStringUnknown AccessGroupOperationString = "Unknown"
	AccessGroupOperationStringAny     AccessGroupOperationString = "Any"
	AccessGroupOperationStringCreate  AccessGroupOperationString = "Create"
	AccessGroupOperationStringUpdate  AccessGroupOperationString = "Update"
)

func (AccessGroupOperationString) ToAccessGroupOperationType added in v3.2.0

func (opString AccessGroupOperationString) ToAccessGroupOperationType() AccessGroupOperationType

type AccessGroupOperationType added in v3.2.0

type AccessGroupOperationType uint8
const (
	AccessGroupOperationTypeUnknown AccessGroupOperationType = 0
	AccessGroupOperationTypeAny     AccessGroupOperationType = 1
	AccessGroupOperationTypeCreate  AccessGroupOperationType = 2
	AccessGroupOperationTypeUpdate  AccessGroupOperationType = 3
)

func (AccessGroupOperationType) ToAccessGroupOperationString added in v3.2.0

func (groupOp AccessGroupOperationType) ToAccessGroupOperationString() AccessGroupOperationString

func (AccessGroupOperationType) ToString added in v3.2.0

func (groupOp AccessGroupOperationType) ToString() string

type AccessGroupScopeString added in v3.2.0

type AccessGroupScopeString string
const (
	AccessGroupScopeStringAny     AccessGroupScopeString = "Any"
	AccessGroupScopeStringScoped  AccessGroupScopeString = "Scoped"
	AccessGroupScopeStringUnknown AccessGroupScopeString = "Unknown"
)

func (AccessGroupScopeString) ToAccessGroupScopeType added in v3.2.0

func (scopeString AccessGroupScopeString) ToAccessGroupScopeType() AccessGroupScopeType

type AccessGroupScopeType added in v3.2.0

type AccessGroupScopeType uint8
const (
	AccessGroupScopeTypeAny     AccessGroupScopeType = 0
	AccessGroupScopeTypeScoped  AccessGroupScopeType = 1
	AccessGroupScopeTypeUnknown AccessGroupScopeType = 2
)

func (AccessGroupScopeType) ToAccessGroupScopeString added in v3.2.0

func (scopeType AccessGroupScopeType) ToAccessGroupScopeString() AccessGroupScopeString

func (AccessGroupScopeType) ToString added in v3.2.0

func (scopeType AccessGroupScopeType) ToString() string

type AccessGroupTxindexMetadata added in v3.2.0

type AccessGroupTxindexMetadata struct {
	AccessGroupOwnerPublicKey PublicKey
	AccessGroupPublicKey      PublicKey
	AccessGroupKeyName        GroupKeyName
	AccessGroupOperationType
}

func (*AccessGroupTxindexMetadata) GetEncoderType added in v3.2.0

func (accessGroupTxindexMetadata *AccessGroupTxindexMetadata) GetEncoderType() EncoderType

func (*AccessGroupTxindexMetadata) GetVersionByte added in v3.2.0

func (accessGroupTxindexMetadata *AccessGroupTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*AccessGroupTxindexMetadata) RawDecodeWithoutMetadata added in v3.2.0

func (accessGroupTxindexMetadata *AccessGroupTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*AccessGroupTxindexMetadata) RawEncodeWithoutMetadata added in v3.2.0

func (accessGroupTxindexMetadata *AccessGroupTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type AffectedPublicKey

type AffectedPublicKey struct {
	PublicKeyBase58Check string
	// Metadata about how this public key was affected by the transaction.
	Metadata string
}

func (*AffectedPublicKey) GetEncoderType

func (pk *AffectedPublicKey) GetEncoderType() EncoderType

func (*AffectedPublicKey) GetVersionByte

func (pk *AffectedPublicKey) GetVersionByte(blockHeight uint64) byte

func (*AffectedPublicKey) RawDecodeWithoutMetadata

func (pk *AffectedPublicKey) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*AffectedPublicKey) RawEncodeWithoutMetadata

func (pk *AffectedPublicKey) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type AncestralCache

type AncestralCache struct {

	// ExistingRecordsMap keeps track of original main db of records that we modified during
	// UtxoView flush, which is where we're modifying state data. A record for a particular
	// key was either already existing in our state, or not already existing in our state.
	//
	// We store keys as strings because they're easier to store and sort this way.
	AncestralRecordsMap map[string]*AncestralRecordValue
	// contains filtered or unexported fields
}

AncestralCache is an in-memory structure that helps manage concurrency between node's main db flushes and ancestral records flushes. For each main db flush transaction, we will build an ancestral cache that contains maps of historical values that were in the main db before we flushed. In particular, we distinguish between existing and non-existent records. Existing records are those records that had already been present in the main db prior to the flush. Non-existent records were not present in the main db, and the flush added them for the first time.

The AncestralCache is stored in the Snapshot struct in a concurrency-safe deque (bi-directional queue). This deque follows a pub-sub pattern where the main db thread pushes ancestral caches onto the deque. The snapshot thread then consumes these objects and writes to the ancestral records. We decided to use this pattern because it doesn't slow down the main block processing thread. However, to make this fully work, we also need some bookkeeping to ensure the ancestral record flushes are up-to-date with the main db flushes. We solve this with non-blocking counters (MainDBSemaphore, AncestralDBSemaphore) that count the total number of flushes to main db and ancestral records.

func NewAncestralCache

func NewAncestralCache(id uint64, blockHeight uint64) *AncestralCache

type AncestralRecordValue

type AncestralRecordValue struct {
	// The value we're setting for an ancestral record.
	Value []byte

	// This is true if the key we're modifying had a pre-existing
	// value in our state. For example, we if we are updating a profile
	// then we might have a pre-existing entry for the pubkey->profile
	// mapping that we're updating. When this value is false, it means
	// we're setting a key that didn't have an associated value in our
	// state previously.
	Existed bool
}

type AssociationAppScopeType added in v3.2.0

type AssociationAppScopeType uint8

func (AssociationAppScopeType) ToAssociationAppScopeTypeString added in v3.2.0

func (associationAppScopeType AssociationAppScopeType) ToAssociationAppScopeTypeString() AssociationAppScopeTypeString

func (AssociationAppScopeType) ToString added in v3.2.0

func (associationAppScopeType AssociationAppScopeType) ToString() string

type AssociationAppScopeTypeString added in v3.2.0

type AssociationAppScopeTypeString string
const (
	UndefinedAssociationAppScopeTypeString AssociationAppScopeTypeString = "Undefined"
	AnyAssociationAppScopeTypeString       AssociationAppScopeTypeString = "Any"
	ScopedAssociationAppScopeTypeString    AssociationAppScopeTypeString = "Scoped"
)

func (AssociationAppScopeTypeString) ToAssociationAppScopeType added in v3.2.0

func (associationAppScopeTypeString AssociationAppScopeTypeString) ToAssociationAppScopeType() AssociationAppScopeType

type AssociationClass added in v3.2.0

type AssociationClass uint8

func (AssociationClass) ToAssociationClassString added in v3.2.0

func (associationClass AssociationClass) ToAssociationClassString() AssociationClassString

func (AssociationClass) ToString added in v3.2.0

func (associationClass AssociationClass) ToString() string

type AssociationClassString added in v3.2.0

type AssociationClassString string
const (
	UndefinedAssociationClassString AssociationClassString = "Undefined"
	UserAssociationClassString      AssociationClassString = "User"
	PostAssociationClassString      AssociationClassString = "Post"
)

func (AssociationClassString) ToAssociationClass added in v3.2.0

func (associationClassString AssociationClassString) ToAssociationClass() AssociationClass

type AssociationLimitKey added in v3.2.0

type AssociationLimitKey struct {
	AssociationClass AssociationClass // User || Post
	AssociationType  string
	AppPKID          PKID
	AppScopeType     AssociationAppScopeType // Any || Scoped
	Operation        AssociationOperation    // Any || Create || Delete
}

func MakeAssociationLimitKey added in v3.2.0

func MakeAssociationLimitKey(
	associationClass AssociationClass,
	associationType []byte,
	appPKID PKID,
	appScopeType AssociationAppScopeType,
	operation AssociationOperation,
) AssociationLimitKey

func (*AssociationLimitKey) Decode added in v3.2.0

func (associationLimitKey *AssociationLimitKey) Decode(rr *bytes.Reader) error

func (AssociationLimitKey) Encode added in v3.2.0

func (associationLimitKey AssociationLimitKey) Encode() []byte

type AssociationMapKey added in v3.2.0

type AssociationMapKey struct {
	AssociationID BlockHash
}

type AssociationOperation added in v3.2.0

type AssociationOperation uint8

func (AssociationOperation) ToAssociationOperationString added in v3.2.0

func (associationOperation AssociationOperation) ToAssociationOperationString() AssociationOperationString

func (AssociationOperation) ToString added in v3.2.0

func (associationOperation AssociationOperation) ToString() string

type AssociationOperationString added in v3.2.0

type AssociationOperationString string
const (
	UndefinedAssociationOperation AssociationOperationString = "Undefined"
	AnyAssociationOperation       AssociationOperationString = "Any"
	CreateAssociationOperation    AssociationOperationString = "Create"
	DeleteAssociationOperation    AssociationOperationString = "Delete"
)

func (AssociationOperationString) ToAssociationOperation added in v3.2.0

func (associationOperationString AssociationOperationString) ToAssociationOperation() AssociationOperation

type AuthorizeDerivedKeyMetadata

type AuthorizeDerivedKeyMetadata struct {
	// DerivedPublicKey is the key that is authorized to sign transactions
	// on behalf of the public key owner.
	DerivedPublicKey []byte

	// ExpirationBlock is the block at which this authorization becomes invalid.
	ExpirationBlock uint64

	// OperationType determines if transaction validates or invalidates derived key.
	OperationType AuthorizeDerivedKeyOperationType

	// AccessSignature is the signed hash of (derivedPublicKey + expirationBlock)
	// made with the ownerPublicKey. Signature is in the DER format.
	AccessSignature []byte
}

func (*AuthorizeDerivedKeyMetadata) FromBytes

func (txnData *AuthorizeDerivedKeyMetadata) FromBytes(data []byte) error

func (*AuthorizeDerivedKeyMetadata) GetTxnType

func (txnData *AuthorizeDerivedKeyMetadata) GetTxnType() TxnType

func (*AuthorizeDerivedKeyMetadata) New

func (*AuthorizeDerivedKeyMetadata) ToBytes

func (txnData *AuthorizeDerivedKeyMetadata) ToBytes(preSignature bool) ([]byte, error)

type AuthorizeDerivedKeyOperationType

type AuthorizeDerivedKeyOperationType uint8
const (
	AuthorizeDerivedKeyOperationNotValid AuthorizeDerivedKeyOperationType = 0
	AuthorizeDerivedKeyOperationValid    AuthorizeDerivedKeyOperationType = 1
)

type BalanceEntry

type BalanceEntry struct {
	// The PKID of the HODLer. This should never change after it's set initially.
	HODLerPKID *PKID
	// The PKID of the creator. This should never change after it's set initially.
	CreatorPKID *PKID

	// How much this HODLer owns of a particular creator coin.
	BalanceNanos uint256.Int

	// Has the hodler purchased any amount of this user's coin
	HasPurchased bool
	// contains filtered or unexported fields
}

This struct is mainly used to track a user's balance of a particular creator coin. In the database, we store it as the value in a mapping that looks as follows: <HodlerPKID, CreatorPKID> -> HODLerEntry

func DBGetBalanceEntryForCreatorPKIDAndHODLerPubKeyWithTxn

func DBGetBalanceEntryForCreatorPKIDAndHODLerPubKeyWithTxn(txn *badger.Txn, snap *Snapshot,
	creatorPKID *PKID, hodlerPKID *PKID, isDAOCoin bool) *BalanceEntry

func DBGetBalanceEntryForHODLerAndCreatorPKIDs

func DBGetBalanceEntryForHODLerAndCreatorPKIDs(handle *badger.DB, snap *Snapshot,
	hodlerPKID *PKID, creatorPKID *PKID, isDAOCoin bool) *BalanceEntry

func DBGetBalanceEntryForHODLerAndCreatorPKIDsWithTxn

func DBGetBalanceEntryForHODLerAndCreatorPKIDsWithTxn(txn *badger.Txn, snap *Snapshot,
	hodlerPKID *PKID, creatorPKID *PKID, isDAOCoin bool) *BalanceEntry

func DbGetBalanceEntriesHodlingYou

func DbGetBalanceEntriesHodlingYou(db *badger.DB, snap *Snapshot, pkid *PKID, filterOutZeroBalances bool, isDAOCoin bool) ([]*BalanceEntry, error)

DbGetBalanceEntriesHodlingYou fetches the BalanceEntries that hold the pkid passed in.

func DbGetBalanceEntriesYouHold

func DbGetBalanceEntriesYouHold(db *badger.DB, snap *Snapshot, pkid *PKID, filterOutZeroBalances bool, isDAOCoin bool) ([]*BalanceEntry, error)

DbGetBalanceEntriesYouHold fetches the BalanceEntries that the passed in pkid holds.

func DbGetBalanceEntry

func DbGetBalanceEntry(db *badger.DB, snap *Snapshot,
	holder *PKID, creator *PKID, isDAOCoin bool) *BalanceEntry

DbGetBalanceEntry returns a balance entry from the database

func DbGetHolderPKIDCreatorPKIDToBalanceEntryWithTxn

func DbGetHolderPKIDCreatorPKIDToBalanceEntryWithTxn(txn *badger.Txn, snap *Snapshot,
	holder *PKID, creator *PKID, isDAOCoin bool) *BalanceEntry

func GetSingleBalanceEntryFromPublicKeys

func GetSingleBalanceEntryFromPublicKeys(holder []byte, creator []byte, utxoView *UtxoView, isDAOCoin bool) (*BalanceEntry, error)

GetSingleBalanceEntryFromPublicKeys fetches a single balance entry of a holder's creator or DAO coin. Returns nil if the balance entry never existed. TODO: This is suboptimal, shouldn't be passing UtxoView

func (*BalanceEntry) Copy

func (be *BalanceEntry) Copy() *BalanceEntry

func (*BalanceEntry) GetEncoderType

func (be *BalanceEntry) GetEncoderType() EncoderType

func (*BalanceEntry) GetVersionByte

func (be *BalanceEntry) GetVersionByte(blockHeight uint64) byte

func (*BalanceEntry) IsDeleted added in v3.2.0

func (be *BalanceEntry) IsDeleted() bool

func (*BalanceEntry) RawDecodeWithoutMetadata

func (be *BalanceEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*BalanceEntry) RawEncodeWithoutMetadata

func (be *BalanceEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type BalanceEntryMapKey

type BalanceEntryMapKey struct {
	HODLerPKID  PKID
	CreatorPKID PKID
}

func MakeBalanceEntryKey

func MakeBalanceEntryKey(hodlerPKID *PKID, creatorPKID *PKID) BalanceEntryMapKey

func (BalanceEntryMapKey) String

func (mm BalanceEntryMapKey) String() string

type BasicTransferMetadata

type BasicTransferMetadata struct {
}

func (*BasicTransferMetadata) FromBytes

func (txnData *BasicTransferMetadata) FromBytes(data []byte) error

func (*BasicTransferMetadata) GetTxnType

func (txnData *BasicTransferMetadata) GetTxnType() TxnType

func (*BasicTransferMetadata) New

func (txnData *BasicTransferMetadata) New() DeSoTxnMetadata

func (*BasicTransferMetadata) ToBytes

func (txnData *BasicTransferMetadata) ToBytes(preSignature bool) ([]byte, error)

type BasicTransferTxindexMetadata

type BasicTransferTxindexMetadata struct {
	TotalInputNanos  uint64
	TotalOutputNanos uint64
	FeeNanos         uint64
	UtxoOpsDump      string
	UtxoOps          []*UtxoOperation
	DiamondLevel     int64
	PostHashHex      string
}

func (*BasicTransferTxindexMetadata) GetEncoderType

func (txnMeta *BasicTransferTxindexMetadata) GetEncoderType() EncoderType

func (*BasicTransferTxindexMetadata) GetVersionByte

func (txnMeta *BasicTransferTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*BasicTransferTxindexMetadata) RawDecodeWithoutMetadata

func (txnMeta *BasicTransferTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*BasicTransferTxindexMetadata) RawEncodeWithoutMetadata

func (txnMeta *BasicTransferTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type BitcoinExchangeMetadata

type BitcoinExchangeMetadata struct {
	// The Bitcoin transaction that sends Bitcoin to the designated burn address.
	BitcoinTransaction *wire.MsgTx
	// The hash of the Bitcoin block in which the Bitcoin transaction was mined.
	BitcoinBlockHash *BlockHash
	// The Bitcoin mekle root corresponding to the block in which the BitcoinTransaction
	// above was mined. Note that it is not strictly necessary to include this field
	// since we can look it up from the Bitcoin header if we know the BitcoinBlockHash.
	// However, having it here is convenient and allows us to do more validation prior
	// to looking up the header in the Bitcoin header chain.
	BitcoinMerkleRoot *BlockHash
	// This is a merkle proof that shows that the BitcoinTransaction above, with
	// hash equal to BitcoinTransactionHash, exists in the block with hash equal
	// to BitcoinBlockHash. This is effectively a path through a Merkle tree starting
	// from BitcoinTransactionHash as a leaf node and finishing with BitcoinMerkleRoot
	// as the root.
	BitcoinMerkleProof []*merkletree.ProofPart
}

func (*BitcoinExchangeMetadata) FromBytes

func (txnData *BitcoinExchangeMetadata) FromBytes(data []byte) error

func (*BitcoinExchangeMetadata) GetTxnType

func (txnData *BitcoinExchangeMetadata) GetTxnType() TxnType

func (*BitcoinExchangeMetadata) New

func (*BitcoinExchangeMetadata) ToBytes

func (txnData *BitcoinExchangeMetadata) ToBytes(preSignature bool) ([]byte, error)

type BitcoinExchangeTxindexMetadata

type BitcoinExchangeTxindexMetadata struct {
	BitcoinSpendAddress string
	// DeSoOutputPubKeyBase58Check = TransactorPublicKeyBase58Check
	SatoshisBurned uint64
	// NanosCreated = 0 OR TotalOutputNanos+FeeNanos
	NanosCreated uint64
	// TotalNanosPurchasedBefore = TotalNanosPurchasedAfter - NanosCreated
	TotalNanosPurchasedBefore uint64
	TotalNanosPurchasedAfter  uint64
	BitcoinTxnHash            string
}

func (*BitcoinExchangeTxindexMetadata) GetEncoderType

func (txnMeta *BitcoinExchangeTxindexMetadata) GetEncoderType() EncoderType

func (*BitcoinExchangeTxindexMetadata) GetVersionByte

func (txnMeta *BitcoinExchangeTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*BitcoinExchangeTxindexMetadata) RawDecodeWithoutMetadata

func (txnMeta *BitcoinExchangeTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*BitcoinExchangeTxindexMetadata) RawEncodeWithoutMetadata

func (txnMeta *BitcoinExchangeTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type BitcoinUtxo

type BitcoinUtxo struct {
	TxID           *chainhash.Hash
	Index          int64
	AmountSatoshis int64
}

func BlockCypherExtractBitcoinUtxosFromResponse

func BlockCypherExtractBitcoinUtxosFromResponse(
	apiData *BlockCypherAPIFullAddressResponse, addrString string, params *DeSoParams) (
	[]*BitcoinUtxo, error)

func BlockCypherUtxoSource

func BlockCypherUtxoSource(addrString string, params *DeSoParams) (
	[]*BitcoinUtxo, error)

func FrontendBlockCypherUtxoSource

func FrontendBlockCypherUtxoSource(
	apiData *BlockCypherAPIFullAddressResponse, addrString string,
	params *DeSoParams) (
	[]*BitcoinUtxo, error)

The frontend passes in the apiData. We do this so that our server doesn't get rate-limited by the free tier.

type BlockCypherAPIFullAddressResponse

type BlockCypherAPIFullAddressResponse struct {
	Address string `json:"address"`
	// Balance data
	ConfirmedBalance   int64 `json:"balance"`
	UnconfirmedBalance int64 `json:"unconfirmed_balance"`
	FinalBalance       int64 `json:"final_balance"`

	// Transaction data
	Txns []*BlockCypherAPITxnResponse `json:"txs"`

	HasMore bool `json:"hasMore"`

	Error string `json:"error"`
}

func GetBlockCypherAPIFullAddressResponse

func GetBlockCypherAPIFullAddressResponse(addrString string, params *DeSoParams) (
	_apiData *BlockCypherAPIFullAddressResponse, _err error)

type BlockCypherAPIInputResponse

type BlockCypherAPIInputResponse struct {
	PrevTxIDHex    string   `json:"prev_hash"`
	Index          int64    `json:"output_index"`
	ScriptHex      string   `json:"script"`
	AmountSatoshis int64    `json:"output_value"`
	Sequence       int64    `json:"sequence"`
	Addresses      []string `json:"addresses"`
	ScriptType     string   `json:"script_type"`
	Age            int64    `json:"age"`
}

type BlockCypherAPIOutputResponse

type BlockCypherAPIOutputResponse struct {
	AmountSatoshis int64    `json:"value"`
	ScriptHex      string   `json:"script"`
	Addresses      []string `json:"addresses"`
	ScriptType     string   `json:"script_type"`
	SpentBy        string   `json:"spent_by"`
}

type BlockCypherAPITxnResponse

type BlockCypherAPITxnResponse struct {
	BlockHashHex  string                          `json:"block_hash"`
	BlockHeight   int64                           `json:"block_height"`
	LockTime      int64                           `json:"lock_time"`
	TxIDHex       string                          `json:"hash"`
	Inputs        []*BlockCypherAPIInputResponse  `json:"inputs"`
	Outputs       []*BlockCypherAPIOutputResponse `json:"outputs"`
	Confirmations int64                           `json:"confirmations"`
	DoubleSpend   bool                            `json:"double_spend"`
	TxnHex        string                          `json:"hex"`
}

func GetBlockCypherTxnResponse

func GetBlockCypherTxnResponse(txnHash *chainhash.Hash, blockCypherAPIKey string, params *DeSoParams) (*BlockCypherAPITxnResponse, error)

type BlockEvent

type BlockEvent struct {
	Block *MsgDeSoBlock

	// Optional
	UtxoView *UtxoView
	UtxoOps  [][]*UtxoOperation
}

type BlockEventFunc

type BlockEventFunc func(event *BlockEvent)

type BlockHash

type BlockHash [HashSizeBytes]byte

BlockHash is a convenient alias for a block hash.

func BigintToHash

func BigintToHash(bigint *big.Int) *BlockHash

func CalcNextDifficultyTarget

func CalcNextDifficultyTarget(
	lastNode *BlockNode, version uint32, params *DeSoParams) (*BlockHash, error)

CalcNextDifficultyTarget computes the difficulty target expected of the next block.

func ComputeTransactionHashes

func ComputeTransactionHashes(txns []*MsgDeSoTxn) ([]*BlockHash, error)

func CopyBytesIntoBlockHash

func CopyBytesIntoBlockHash(data []byte) *BlockHash

func DbGetAllBitcoinBurnTxIDs

func DbGetAllBitcoinBurnTxIDs(handle *badger.DB) (_bitcoinBurnTxIDs []*BlockHash)

func DbGetBestHash

func DbGetBestHash(handle *badger.DB, snap *Snapshot, chainType ChainType) *BlockHash

func DbGetPostHashesYouLike

func DbGetPostHashesYouLike(handle *badger.DB, yourPublicKey []byte) (
	_postHashes []*BlockHash, _err error)

func DbGetPostHashesYouRepost

func DbGetPostHashesYouRepost(handle *badger.DB, yourPublicKey []byte) (
	_postHashes []*BlockHash, _err error)

func DbGetTxindexTip

func DbGetTxindexTip(handle *badger.DB, snap *Snapshot) *BlockHash

func DbGetTxindexTxnsForPublicKey

func DbGetTxindexTxnsForPublicKey(handle *badger.DB, publicKey []byte) []*BlockHash

func DbGetTxindexTxnsForPublicKeyWithTxn

func DbGetTxindexTxnsForPublicKeyWithTxn(txn *badger.Txn, publicKey []byte) []*BlockHash

func ExpectedWorkForBlockHash

func ExpectedWorkForBlockHash(hash *BlockHash) *BlockHash

The number of hashing attempts in expectation it would take to produce the hash passed in. This is computed as:

E(min(X_i, ..., X_n)) where:
- n = (number of attempted hashes) and
- the X_i are all U(0, MAX_HASH)

-> E(min(X_i, ..., X_n)) = MAX_HASH / (n + 1) -> E(n) ~= MAX_HASH / min_hash - 1

  • where min_hash is the block hash

We approximate this as MAX_HASH / (min_hash + 1), adding 1 to min_hash in order to mitigate the possibility of a divide-by-zero error.

The value returned is the expected number of hashes performed to produce the input hash formatted as a big-endian big integer that uses the BlockHash type for convenience (though it is likely to be much lower in terms of magnitude than a typical BlockHash object).

func FindLowestHash

func FindLowestHash(
	blockHeaderr *MsgDeSoHeader, iterations uint64) (
	lowestHash *BlockHash, lowestNonce uint64, ee error)

FindLowestHash Mine for a given number of iterations and return the lowest hash value found and its associated nonce. Hashing starts at the value of the Nonce set on the blockHeader field when it is passed and increments the value of the passed blockHeader field as it iterates. This makes it easy to continue a subsequent batch of iterations after we return.

func MustDecodeHexBlockHash

func MustDecodeHexBlockHash(ss string) *BlockHash

func NewBlockHash

func NewBlockHash(input []byte) *BlockHash

func ProofOfWorkHash

func ProofOfWorkHash(inputBytes []byte, version uint32) *BlockHash

ProofOfWorkHash is a hash function designed for computing DeSo block hashes. It seems the optimal hash function is one that satisfies two properties:

  1. It is not computable by any existing ASICs. If this property isn't satisfied then miners with pre-existing investments in ASICs for other coins can very cheaply mine on our chain for a short period of time to pull off a 51% attack. This has actually happened with "merge-mined" coins like Namecoin.
  2. If implemented on an ASIC, there is an "orders of magnitude" speed-up over using a CPU or GPU. This is because ASICs require some amount of capital expenditure up-front in order to mine, which then aligns the owner of the ASIC to care about the health of the network over a longer period of time. In contrast, a hash function that is CPU or GPU-mineable can be attacked with an AWS fleet early on. This also may result in a more eco-friendly chain, since the hash power will be more bottlenecked by up-front CapEx rather than ongoing electricity cost, as is the case with GPU-mined coins.

Note that our pursuit of (2) above runs counter to existing dogma which seeks to prioritize "ASIC-resistance" in hash functions.

Given the above, the hash function chosen is a simple twist on sha3 that we don't think any ASIC exists for currently. Note that creating an ASIC for this should be relatively straightforward, however, which allows us to satisfy property (2) above.

func ReadBlockHash

func ReadBlockHash(rr io.Reader) (*BlockHash, error)

func ReadOptionalBlockHash

func ReadOptionalBlockHash(rr *bytes.Reader) (*BlockHash, error)

func Sha256DoubleHash

func Sha256DoubleHash(input []byte) *BlockHash

func (*BlockHash) GetEncoderType

func (bh *BlockHash) GetEncoderType() EncoderType

func (*BlockHash) GetVersionByte

func (bh *BlockHash) GetVersionByte(blockHeight uint64) byte

func (*BlockHash) IsEqual

func (bh *BlockHash) IsEqual(target *BlockHash) bool

IsEqual returns true if target is the same as hash.

func (*BlockHash) NewBlockHash

func (bh *BlockHash) NewBlockHash() *BlockHash

func (*BlockHash) RawDecodeWithoutMetadata

func (bh *BlockHash) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*BlockHash) RawEncodeWithoutMetadata

func (bh *BlockHash) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

func (*BlockHash) String

func (bh *BlockHash) String() string

func (*BlockHash) ToBytes

func (bh *BlockHash) ToBytes() []byte

type BlockNode

type BlockNode struct {
	// Pointer to a node representing the block's parent.
	Parent *BlockNode

	// The hash computed on this block.
	Hash *BlockHash

	// Height is the position in the block chain.
	Height uint32

	// The difficulty target for this block. Used to compute the next
	// block's difficulty target so it can be validated.
	DifficultyTarget *BlockHash

	// A computation of the total amount of work that has been performed
	// on this chain, including the current node.
	CumWork *big.Int

	// The block header.
	Header *MsgDeSoHeader

	// Status holds the validation state for the block and whether or not
	// it's stored in the database.
	Status BlockStatus
}

Add some fields in addition to the header to aid in the selection of the best chain.

func DeserializeBlockNode

func DeserializeBlockNode(data []byte) (*BlockNode, error)

func GetBestChain

func GetBestChain(tipNode *BlockNode, blockIndex map[BlockHash]*BlockNode) ([]*BlockNode, error)

func GetHeightHashToNodeInfo

func GetHeightHashToNodeInfo(handle *badger.DB, snap *Snapshot,
	height uint32, hash *BlockHash, bitcoinNodes bool) *BlockNode

func GetHeightHashToNodeInfoWithTxn

func GetHeightHashToNodeInfoWithTxn(txn *badger.Txn, snap *Snapshot,
	height uint32, hash *BlockHash, bitcoinNodes bool) *BlockNode

func NewBlockNode

func NewBlockNode(
	parent *BlockNode,
	hash *BlockHash,
	height uint32,
	difficultyTarget *BlockHash,
	cumWork *big.Int,
	header *MsgDeSoHeader,
	status BlockStatus) *BlockNode

TODO: Height not needed in this since it's in the header.

func (*BlockNode) Ancestor

func (nn *BlockNode) Ancestor(height uint32) *BlockNode

func (*BlockNode) RelativeAncestor

func (nn *BlockNode) RelativeAncestor(distance uint32) *BlockNode

RelativeAncestor returns the ancestor block node a relative 'distance' blocks before this node. This is equivalent to calling Ancestor with the node's height minus provided distance.

This function is safe for concurrent access.

func (*BlockNode) String

func (nn *BlockNode) String() string

type BlockProducerInfo

type BlockProducerInfo struct {
	PublicKey []byte
	Signature *btcec.Signature
}

func (*BlockProducerInfo) Deserialize

func (bpi *BlockProducerInfo) Deserialize(data []byte) error

func (*BlockProducerInfo) Serialize

func (bpi *BlockProducerInfo) Serialize() []byte

func (*BlockProducerInfo) String

func (bpi *BlockProducerInfo) String() string

type BlockRewardMetadataa

type BlockRewardMetadataa struct {
	// A block reward txn has an ExtraData field that can be between
	// zero and 100 bytes long. It can theoretically contain anything
	// but in practice it's likely that miners will use this field to
	// update the merkle root of the block, which may make the block
	// easier to mine (namely by allowing the Nonce in the header to
	// be shorter).
	ExtraData []byte
}

func (*BlockRewardMetadataa) FromBytes

func (txnData *BlockRewardMetadataa) FromBytes(dataa []byte) error

func (*BlockRewardMetadataa) GetTxnType

func (txnData *BlockRewardMetadataa) GetTxnType() TxnType

func (*BlockRewardMetadataa) New

func (txnData *BlockRewardMetadataa) New() DeSoTxnMetadata

func (*BlockRewardMetadataa) ToBytes

func (txnData *BlockRewardMetadataa) ToBytes(preSignature bool) ([]byte, error)

type BlockStatus

type BlockStatus uint32

func (BlockStatus) IsFullyProcessed

func (blockStatus BlockStatus) IsFullyProcessed() bool

IsFullyProcessed determines if the BlockStatus corresponds to a fully processed and stored block.

func (BlockStatus) String

func (blockStatus BlockStatus) String() string

type BlockTemplateStats

type BlockTemplateStats struct {
	// The number of txns in the block template.
	TxnCount uint32
	// The final txn we attempted to put in the block.
	FailingTxnHash string
	// The reason why the final txn failed to add.
	FailingTxnError string
	// The "Added" time on a transaction changes every time a block is mined so we record
	// the first time added val we are aware of for a specific txn hash here.
	FailingTxnOriginalTimeAdded time.Time
	// The time since the failing txn was added to the mempool.
	FailingTxnMinutesSinceAdded float64
}

type Blockchain

type Blockchain struct {
	MaxSyncBlockHeight uint32

	// Protects most of the fields below this point.
	ChainLock deadlock.RWMutex
	// contains filtered or unexported fields
}

func NewBlockchain

func NewBlockchain(
	trustedBlockProducerPublicKeyStrs []string,
	trustedBlockProducerStartHeight uint64,
	maxSyncBlockHeight uint32,
	params *DeSoParams,
	timeSource chainlib.MedianTimeSource,
	db *badger.DB,
	postgres *Postgres,
	eventManager *EventManager,
	snapshot *Snapshot,
	archivalMode bool,
) (*Blockchain, error)

NewBlockchain returns a new blockchain object. It initializes some in-memory data structures by reading from the db. It also initializes the db if it hasn't been initialized in the past. This function should only be called once per db, and one should never run two blockchain objects over the same db at the same time as they will likely step on each other and become inconsistent.

func (*Blockchain) AddInputsAndChangeToTransaction

func (bc *Blockchain) AddInputsAndChangeToTransaction(
	txArg *MsgDeSoTxn, minFeeRateNanosPerKB uint64, mempool *DeSoMempool) (
	_totalInputAdded uint64, _spendAmount uint64, _totalChangeAdded uint64, _fee uint64, _err error)

AddInputsAndChangeToTransaction fetches and adds utxos to the transaction passed in to meet the desired spend amount while also satisfying the desired minimum fee rate. Additionally, if it's worth it, this function will add a change output sending excess DeSo back to the spend public key. Note that the final feerate of the transaction after calling this function may exceed the minimum feerate requested. This can happen if the signature occupies fewer bytes than the expected maximum number of bytes or if the change output occupies fewer bytes than the expected maximum (though there could be other ways for this to happen).

The transaction passed in should not have any inputs on it before calling this function (an error is returned if it does). Additionally, the output of the transaction passed in is assumed to be the amount the caller wishes us to find inputs for.

An error is returned if there is not enough input associated with this public key to satisfy the transaction's output (subject to the minimum feerate).

func (*Blockchain) AddInputsAndChangeToTransactionWithSubsidy

func (bc *Blockchain) AddInputsAndChangeToTransactionWithSubsidy(
	txArg *MsgDeSoTxn, minFeeRateNanosPerKB uint64, inputSubsidy uint64, mempool *DeSoMempool, additionalFees uint64) (
	_totalInputAdded uint64, _spendAmount uint64, _totalChangeAdded uint64, _fee uint64, _err error)

func (*Blockchain) BestChain

func (bc *Blockchain) BestChain() []*BlockNode

func (*Blockchain) BlockTip

func (bc *Blockchain) BlockTip() *BlockNode

func (*Blockchain) ChainState

func (bc *Blockchain) ChainState() SyncState

func (*Blockchain) CopyBestChain

func (bc *Blockchain) CopyBestChain() ([]*BlockNode, map[BlockHash]*BlockNode)

func (*Blockchain) CopyBestHeaderChain

func (bc *Blockchain) CopyBestHeaderChain() ([]*BlockNode, map[BlockHash]*BlockNode)

func (*Blockchain) CopyBlockIndex

func (bc *Blockchain) CopyBlockIndex() map[BlockHash]*BlockNode

func (*Blockchain) CreateAcceptNFTBidTxn

func (bc *Blockchain) CreateAcceptNFTBidTxn(
	UpdaterPublicKey []byte,
	NFTPostHash *BlockHash,
	SerialNumber uint64,
	BidderPKID *PKID,
	BidAmountNanos uint64,
	EncryptedUnlockableTextBytes []byte,

	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateAcceptNFTTransferTxn

func (bc *Blockchain) CreateAcceptNFTTransferTxn(
	UpdaterPublicKey []byte,
	NFTPostHash *BlockHash,
	SerialNumber uint64,

	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateAccessGroupMembersTxn added in v3.2.0

func (bc *Blockchain) CreateAccessGroupMembersTxn(
	userPublicKey []byte,
	accessGroupKeyName []byte,
	accessGroupMemberList []*AccessGroupMember,
	operationType AccessGroupMemberOperationType,
	extraData map[string][]byte,
	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateAccessGroupTxn added in v3.2.0

func (bc *Blockchain) CreateAccessGroupTxn(
	userPublicKey []byte,
	accessGroupPublicKey []byte,
	accessGroupKeyName []byte,
	operationType AccessGroupOperationType,
	extraData map[string][]byte,
	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateAuthorizeDerivedKeyTxn

func (bc *Blockchain) CreateAuthorizeDerivedKeyTxn(
	ownerPublicKey []byte,
	derivedPublicKey []byte,
	expirationBlock uint64,
	accessSignature []byte,
	deleteKey bool,
	derivedKeySignature bool,
	extraData map[string][]byte,
	memo []byte,
	transactionSpendingLimitHex string,

	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateBasicTransferTxnWithDiamonds

func (bc *Blockchain) CreateBasicTransferTxnWithDiamonds(
	SenderPublicKey []byte,
	DiamondPostHash *BlockHash,
	DiamondLevel int64,

	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _spendAmount uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateBurnNFTTxn

func (bc *Blockchain) CreateBurnNFTTxn(
	UpdaterPublicKey []byte,
	NFTPostHash *BlockHash,
	SerialNumber uint64,

	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateCreateNFTTxn

func (bc *Blockchain) CreateCreateNFTTxn(
	UpdaterPublicKey []byte,
	NFTPostHash *BlockHash,
	NumCopies uint64,
	HasUnlockable bool,
	IsForSale bool,
	MinBidAmountNanos uint64,
	NFTFee uint64,
	NFTRoyaltyToCreatorBasisPoints uint64,
	NFTRoyaltyToCoinBasisPoints uint64,
	IsBuyNow bool,
	BuyNowPriceNanos uint64,
	AdditionalDESORoyalties map[PublicKey]uint64,
	AdditionalCoinRoyalties map[PublicKey]uint64,
	ExtraData map[string][]byte,

	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateCreatePostAssociationTxn added in v3.2.0

func (bc *Blockchain) CreateCreatePostAssociationTxn(
	transactorPublicKey []byte,
	metadata *CreatePostAssociationMetadata,
	extraData map[string][]byte,
	minFeeRateNanosPerKB uint64,
	mempool *DeSoMempool,
	additionalOutputs []*DeSoOutput,
) (
	_txn *MsgDeSoTxn,
	_totalInput uint64,
	_changeAmount uint64,
	_fees uint64,
	_err error,
)

func (*Blockchain) CreateCreateUserAssociationTxn added in v3.2.0

func (bc *Blockchain) CreateCreateUserAssociationTxn(
	transactorPublicKey []byte,
	metadata *CreateUserAssociationMetadata,
	extraData map[string][]byte,
	minFeeRateNanosPerKB uint64,
	mempool *DeSoMempool,
	additionalOutputs []*DeSoOutput,
) (
	_txn *MsgDeSoTxn,
	_totalInput uint64,
	_changeAmount uint64,
	_fees uint64,
	_err error,
)

func (*Blockchain) CreateCreatorCoinTransferTxn

func (bc *Blockchain) CreateCreatorCoinTransferTxn(
	UpdaterPublicKey []byte,
	ProfilePublicKey []byte,
	CreatorCoinToTransferNanos uint64,
	RecipientPublicKey []byte,

	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateCreatorCoinTransferTxnWithDiamonds

func (bc *Blockchain) CreateCreatorCoinTransferTxnWithDiamonds(
	SenderPublicKey []byte,
	ReceiverPublicKey []byte,
	DiamondPostHash *BlockHash,
	DiamondLevel int64,

	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateCreatorCoinTxn

func (bc *Blockchain) CreateCreatorCoinTxn(
	UpdaterPublicKey []byte,

	ProfilePublicKey []byte,
	OperationType CreatorCoinOperationType,
	DeSoToSellNanos uint64,
	CreatorCoinToSellNanos uint64,
	DeSoToAddNanos uint64,
	MinDeSoExpectedNanos uint64,
	MinCreatorCoinExpectedNanos uint64,

	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateDAOCoinLimitOrderTxn

func (bc *Blockchain) CreateDAOCoinLimitOrderTxn(
	UpdaterPublicKey []byte,

	metadata *DAOCoinLimitOrderMetadata,

	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateDAOCoinTransferTxn

func (bc *Blockchain) CreateDAOCoinTransferTxn(
	UpdaterPublicKey []byte,
	metadata *DAOCoinTransferMetadata,

	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateDAOCoinTxn

func (bc *Blockchain) CreateDAOCoinTxn(
	UpdaterPublicKey []byte,

	metadata *DAOCoinMetadata,

	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateDeletePostAssociationTxn added in v3.2.0

func (bc *Blockchain) CreateDeletePostAssociationTxn(
	transactorPublicKey []byte,
	metadata *DeletePostAssociationMetadata,
	extraData map[string][]byte,
	minFeeRateNanosPerKB uint64,
	mempool *DeSoMempool,
	additionalOutputs []*DeSoOutput,
) (
	_txn *MsgDeSoTxn,
	_totalInput uint64,
	_changeAmount uint64,
	_fees uint64,
	_err error,
)

func (*Blockchain) CreateDeleteUserAssociationTxn added in v3.2.0

func (bc *Blockchain) CreateDeleteUserAssociationTxn(
	transactorPublicKey []byte,
	metadata *DeleteUserAssociationMetadata,
	extraData map[string][]byte,
	minFeeRateNanosPerKB uint64,
	mempool *DeSoMempool,
	additionalOutputs []*DeSoOutput,
) (
	_txn *MsgDeSoTxn,
	_totalInput uint64,
	_changeAmount uint64,
	_fees uint64,
	_err error,
)

func (*Blockchain) CreateFollowTxn

func (bc *Blockchain) CreateFollowTxn(
	senderPublicKey []byte, followedPublicKey []byte, isUnfollow bool,
	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64,
	_err error)

func (*Blockchain) CreateLikeTxn

func (bc *Blockchain) CreateLikeTxn(
	userPublicKey []byte, likedPostHash BlockHash, isUnlike bool,
	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64,
	_err error)

func (*Blockchain) CreateMaxSpend

func (bc *Blockchain) CreateMaxSpend(
	senderPkBytes []byte, recipientPkBytes []byte, minFeeRateNanosPerKB uint64,
	mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInputAdded uint64, _spendAmount uint64, _fee uint64, _err error)

func (*Blockchain) CreateMessagingKeyTxn

func (bc *Blockchain) CreateMessagingKeyTxn(
	senderPublicKey []byte,
	messagingPublicKey []byte,
	messagingGroupKeyName []byte,
	messagingOwnerKeySignature []byte,
	members []*MessagingGroupMember,
	extraData map[string][]byte,
	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateNFTBidTxn

func (bc *Blockchain) CreateNFTBidTxn(
	UpdaterPublicKey []byte,
	NFTPostHash *BlockHash,
	SerialNumber uint64,
	BidAmountNanos uint64,

	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateNFTTransferTxn

func (bc *Blockchain) CreateNFTTransferTxn(
	SenderPublicKey []byte,
	ReceiverPublicKey []byte,
	NFTPostHash *BlockHash,
	SerialNumber uint64,
	EncryptedUnlockableTextBytes []byte,

	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateNewMessageTxn added in v3.2.0

func (bc *Blockchain) CreateNewMessageTxn(
	userPublicKey []byte,
	senderAccessGroupOwnerPublicKey PublicKey, senderAccessGroupKeyName GroupKeyName, senderAccessPublicKey PublicKey,
	recipientAccessGroupOwnerPublicKey PublicKey, recipientAccessGroupKeyName GroupKeyName, recipientAccessPublicKey PublicKey,
	encryptedText []byte,
	timestampNanos uint64,
	messageType NewMessageType,
	messageOperation NewMessageOperation,
	extraData map[string][]byte,
	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreatePrivateMessageTxn

func (bc *Blockchain) CreatePrivateMessageTxn(
	senderPublicKey []byte, recipientPublicKey []byte,
	unencryptedMessageText string, encryptedMessageText string,
	senderMessagingPublicKey []byte, senderMessagingKeyName []byte,
	recipientMessagingPublicKey []byte, recipientMessagingKeyName []byte,
	tstampNanos uint64, extraData map[string][]byte,
	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateSubmitPostTxn

func (bc *Blockchain) CreateSubmitPostTxn(

	updaterPublicKey []byte,
	postHashToModify []byte,
	parentStakeID []byte,
	body []byte,
	repostPostHashBytes []byte,
	isQuotedRepost bool,
	tstampNanos uint64,
	postExtraData map[string][]byte,
	isHidden bool,

	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateSwapIdentityTxn

func (bc *Blockchain) CreateSwapIdentityTxn(
	UpdaterPublicKeyBytes []byte,
	FromPublicKeyBytes []byte,
	ToPublicKeyBytes []byte,

	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateUpdateBitcoinUSDExchangeRateTxn

func (bc *Blockchain) CreateUpdateBitcoinUSDExchangeRateTxn(

	updaterPublicKey []byte,
	usdCentsPerbitcoin uint64,

	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateUpdateGlobalParamsTxn

func (bc *Blockchain) CreateUpdateGlobalParamsTxn(updaterPublicKey []byte,
	usdCentsPerBitcoin int64,
	createProfileFeesNanos int64,
	createNFTFeesNanos int64,
	maxCopiesPerNFT int64,
	minimumNetworkFeeNanosPerKb int64,
	forbiddenPubKey []byte,

	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateUpdateNFTTxn

func (bc *Blockchain) CreateUpdateNFTTxn(
	UpdaterPublicKey []byte,
	NFTPostHash *BlockHash,
	SerialNumber uint64,
	IsForSale bool,
	MinBidAmountNanos uint64,
	IsBuyNow bool,
	BuyNowPriceNanos uint64,

	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) CreateUpdateProfileTxn

func (bc *Blockchain) CreateUpdateProfileTxn(
	UpdaterPublicKeyBytes []byte,

	OptionalProfilePublicKeyBytes []byte,
	NewUsername string,
	NewDescription string,
	NewProfilePic string,
	NewCreatorBasisPoints uint64,
	NewStakeMultipleBasisPoints uint64,
	IsHidden bool,
	AdditionalFees uint64,
	ExtraData map[string][]byte,

	minFeeRateNanosPerKB uint64, mempool *DeSoMempool, additionalOutputs []*DeSoOutput) (
	_txn *MsgDeSoTxn, _totalInput uint64, _changeAmount uint64, _fees uint64, _err error)

func (*Blockchain) DB

func (bc *Blockchain) DB() *badger.DB

TODO: This breaks law of demeter and we should fix it

func (*Blockchain) DisconnectBlocksToHeight

func (bc *Blockchain) DisconnectBlocksToHeight(blockHeight uint64, snap *Snapshot) error

DisconnectBlocksToHeight will rollback blocks from the db and blockchain structs until block tip reaches the provided blockHeight parameter.

func (*Blockchain) EstimateDefaultFeeRateNanosPerKB

func (bc *Blockchain) EstimateDefaultFeeRateNanosPerKB(
	medianThreshold float64, minFeeRateNanosPerKB uint64) uint64

func (*Blockchain) GetBlock

func (bc *Blockchain) GetBlock(blockHash *BlockHash) *MsgDeSoBlock

Don't need a lock because blocks don't get removed from the db after they're added

func (*Blockchain) GetBlockAtHeight

func (bc *Blockchain) GetBlockAtHeight(height uint32) *MsgDeSoBlock

func (*Blockchain) GetBlockNodeWithHash

func (bc *Blockchain) GetBlockNodeWithHash(hash *BlockHash) *BlockNode

GetBlockNodeWithHash looks for a block node in the bestChain list that matches the hash.

func (*Blockchain) GetBlockNodesToFetch

func (bc *Blockchain) GetBlockNodesToFetch(
	numBlocks int, _maxHeight int, blocksToIgnore map[BlockHash]bool) []*BlockNode

func (*Blockchain) GetInputsToCoverAmount

func (bc *Blockchain) GetInputsToCoverAmount(spenderPublicKey []byte, utxoView *UtxoView, amountToCover uint64) (
	_inputs []*DeSoInput, _err error)

func (*Blockchain) GetSpendableUtxosForPublicKey

func (bc *Blockchain) GetSpendableUtxosForPublicKey(spendPublicKeyBytes []byte, mempool *DeSoMempool, referenceUtxoView *UtxoView) ([]*UtxoEntry, error)

func (*Blockchain) HasBlock

func (bc *Blockchain) HasBlock(blockHash *BlockHash) bool

func (*Blockchain) HasHeader

func (bc *Blockchain) HasHeader(headerHash *BlockHash) bool

func (*Blockchain) HeaderAtHeight

func (bc *Blockchain) HeaderAtHeight(blockHeight uint32) *BlockNode

func (*Blockchain) HeaderLocatorWithNodeHash

func (bc *Blockchain) HeaderLocatorWithNodeHash(blockHash *BlockHash) ([]*BlockHash, error)

func (*Blockchain) HeaderTip

func (bc *Blockchain) HeaderTip() *BlockNode

func (*Blockchain) IsFullyStored

func (bc *Blockchain) IsFullyStored() bool

IsFullyStored determines if there are block nodes that haven't been fully stored or processed in the best block chain.

func (*Blockchain) LatestHeaderLocator

func (bc *Blockchain) LatestHeaderLocator() []*BlockHash

LatestHeaderLocator calls LatestLocator in order to fetch a locator for the best header chain.

func (*Blockchain) LatestLocator

func (bc *Blockchain) LatestLocator(tip *BlockNode) []*BlockHash

LatestLocator returns a block locator for the passed block node. The passed node can be nil in which case the block locator for the current tip associated with the view will be returned.

BlockLocator is used to help locate a specific block. The algorithm for building the block locator is to add the hashes in reverse order until the genesis block is reached. In order to keep the list of locator hashes to a reasonable number of entries, first the most recent previous 12 block hashes are added, then the step is doubled each loop iteration to exponentially decrease the number of hashes as a function of the distance from the block being located.

For example, assume a block chain with a side chain as depicted below:

genesis -> 1 -> 2 -> ... -> 15 -> 16  -> 17  -> 18
                              \-> 16a -> 17a

The block locator for block 17a would be the hashes of blocks: [17a 16a 15 14 13 12 11 10 9 8 7 6 4 genesis]

Caller is responsible for acquiring the ChainLock before calling this function.

func (*Blockchain) LocateBestBlockChainHeaders

func (bc *Blockchain) LocateBestBlockChainHeaders(locator []*BlockHash, stopHash *BlockHash) []*MsgDeSoHeader

LocateBestBlockChainHeaders returns the headers of the blocks after the first known block in the locator until the provided stop hash is reached, or up to a max of wire.MaxBlockHeadersPerMsg headers. Note that it returns the best headers considering only headers for which we have blocks (that is, it considers the best *block* chain we have rather than the best *header* chain). This is the correct thing to do because in general this function is called in order to serve a response to a peer's GetHeaders request.

In addition, there are two special cases:

  • When no locators are provided, the stop hash is treated as a request for that header, so it will either return the header for the stop hash itself if it is known, or nil if it is unknown
  • When locators are provided, but none of them are known, headers starting after the genesis block will be returned

This function is safe for concurrent access.

func (*Blockchain) MarkBlockInvalid

func (bc *Blockchain) MarkBlockInvalid(node *BlockNode, errOccurred RuleError)

func (*Blockchain) NewDbAdapter

func (bc *Blockchain) NewDbAdapter() *DbAdapter

func (*Blockchain) Postgres

func (bc *Blockchain) Postgres() *Postgres

TODO: This breaks law of demeter and we should fix it

func (*Blockchain) ProcessBlock

func (bc *Blockchain) ProcessBlock(desoBlock *MsgDeSoBlock, verifySignatures bool) (_isMainChain bool, _isOrphan bool, _err error)

func (*Blockchain) ProcessHeader

func (bc *Blockchain) ProcessHeader(blockHeader *MsgDeSoHeader, headerHash *BlockHash) (_isMainChain bool, _isOrphan bool, _err error)

ProcessHeader is a wrapper around processHeader, which does the leg-work, that acquires the ChainLock first.

func (*Blockchain) ProcessOrphanBlock

func (bc *Blockchain) ProcessOrphanBlock(desoBlock *MsgDeSoBlock, blockHash *BlockHash) error

ProcessOrphanBlock runs some very basic validation on the orphan block and adds it to our orphan data structure if it passes. If there are too many orphan blocks in our data structure, it also evicts the oldest block to make room for this one.

TODO: Currently we only remove orphan blocks if we have too many. This means in a steady state we are potentially keeping MaxOrphansInMemory at all times, which is wasteful of resources. Better would be to clean up orphan blocks once they're too old or something like that.

func (*Blockchain) SetBestChain

func (bc *Blockchain) SetBestChain(bestChain []*BlockNode)

func (*Blockchain) SetBestChainMap

func (bc *Blockchain) SetBestChainMap(bestChain []*BlockNode, bestChainMap map[BlockHash]*BlockNode, blockIndex map[BlockHash]*BlockNode)

func (*Blockchain) Snapshot

func (bc *Blockchain) Snapshot() *Snapshot

func (*Blockchain) ValidateTransaction

func (bc *Blockchain) ValidateTransaction(
	txnMsg *MsgDeSoTxn, blockHeight uint32, verifySignatures bool, mempool *DeSoMempool) error

ValidateTransaction creates a UtxoView and sees if the transaction can be connected to it. If a mempool is provided, this function tries to find dependencies of the passed-in transaction in the pool and connect them before trying to connect the passed-in transaction.

type BlockchainInfoAPIResponse

type BlockchainInfoAPIResponse struct {
	DoubleSpend bool `json:"double_spend"`
}

type BlockonomicsRBFResponse

type BlockonomicsRBFResponse struct {
	RBF    int64  `json:"rbf"`
	Status string `json:"status"`
}

type BurnNFTMetadata

type BurnNFTMetadata struct {
	NFTPostHash  *BlockHash
	SerialNumber uint64
}

func (*BurnNFTMetadata) FromBytes

func (txnData *BurnNFTMetadata) FromBytes(dataa []byte) error

func (*BurnNFTMetadata) GetTxnType

func (txnData *BurnNFTMetadata) GetTxnType() TxnType

func (*BurnNFTMetadata) New

func (txnData *BurnNFTMetadata) New() DeSoTxnMetadata

func (*BurnNFTMetadata) ToBytes

func (txnData *BurnNFTMetadata) ToBytes(preSignature bool) ([]byte, error)

type BurnNFTTxindexMetadata

type BurnNFTTxindexMetadata struct {
	NFTPostHashHex string
	SerialNumber   uint64
}

func (*BurnNFTTxindexMetadata) GetEncoderType

func (txnMeta *BurnNFTTxindexMetadata) GetEncoderType() EncoderType

func (*BurnNFTTxindexMetadata) GetVersionByte

func (txnMeta *BurnNFTTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*BurnNFTTxindexMetadata) RawDecodeWithoutMetadata

func (txnMeta *BurnNFTTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*BurnNFTTxindexMetadata) RawEncodeWithoutMetadata

func (txnMeta *BurnNFTTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type ChainType

type ChainType uint8

type CoinEntry

type CoinEntry struct {
	// The amount the owner of this profile receives when there is a
	// "net new" purchase of their coin.
	CreatorBasisPoints uint64

	// The amount of DeSo backing the coin. Whenever a user buys a coin
	// from the protocol this amount increases, and whenever a user sells a
	// coin to the protocol this decreases.
	DeSoLockedNanos uint64

	// The number of public keys who have holdings in this creator coin.
	// Due to floating point truncation, it can be difficult to simultaneously
	// reset CoinsInCirculationNanos and DeSoLockedNanos to zero after
	// everyone has sold all their creator coins. Initially NumberOfHolders
	// is set to zero. Once it returns to zero after a series of buys & sells
	// we reset the DeSoLockedNanos and CoinsInCirculationNanos to prevent
	// abnormal bancor curve behavior.
	NumberOfHolders uint64

	// The number of coins currently in circulation. Whenever a user buys a
	// coin from the protocol this increases, and whenever a user sells a
	// coin to the protocol this decreases.
	//
	// It's OK to have a pointer here as long as we *NEVER* manipulate the
	// bigint in place. Instead, we must always do computations of the form:
	//
	// CoinsInCirculationNanos = uint256.NewInt(0).Add(CoinsInCirculationNanos, <other uint256>)
	//
	// This will guarantee that modifying a copy of this struct will not break
	// the original, which is needed for disconnects to work.
	CoinsInCirculationNanos uint256.Int

	// This field keeps track of the highest number of coins that has ever
	// been in circulation. It is used to determine when a creator should
	// receive a "founder reward." In particular, whenever the number of
	// coins being minted would push the number of coins in circulation
	// beyond the watermark, we allocate a percentage of the coins being
	// minted to the creator as a "founder reward."
	//
	// Note that this field doesn't need to be uint256 because it's only
	// relevant for CreatorCoins, which can't exceed math.MaxUint64 in total
	// supply.
	CoinWatermarkNanos uint64

	// If true, DAO coins can no longer be minted.
	MintingDisabled bool

	TransferRestrictionStatus TransferRestrictionStatus
}

This struct contains all the information required to support coin buy/sell transactions on profiles.

func (*CoinEntry) GetEncoderType

func (ce *CoinEntry) GetEncoderType() EncoderType

func (*CoinEntry) GetVersionByte

func (ce *CoinEntry) GetVersionByte(blockHeight uint64) byte

func (*CoinEntry) RawDecodeWithoutMetadata

func (ce *CoinEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*CoinEntry) RawEncodeWithoutMetadata

func (ce *CoinEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type ConnectionManager

type ConnectionManager struct {

	// The address manager keeps track of peer addresses we're aware of. When
	// we need to connect to a new outbound peer, it chooses one of the addresses
	// it's aware of at random and provides it to us.
	AddrMgr *addrmgr.AddrManager

	// When --hypersync is set to true we will attempt fast block synchronization
	HyperSync bool
	// We have the following options for SyncType:
	// - any: Will sync with a node no matter what kind of syncing it supports.
	// - blocksync: Will sync by connecting blocks from the beginning of time.
	// - hypersync-archival: Will sync by hypersyncing state, but then it will
	//   still download historical blocks at the end. Can only be set if HyperSync
	//   is true.
	// - hypersync: Will sync by downloading historical state, and will NOT
	//   download historical blocks. Can only be set if HyperSync is true.
	SyncType NodeSyncType
	// contains filtered or unexported fields
}

func NewConnectionManager

func NewConnectionManager(
	_params *DeSoParams, _addrMgr *addrmgr.AddrManager, _listeners []net.Listener,
	_connectIps []string, _timeSource chainlib.MedianTimeSource,
	_targetOutboundPeers uint32, _maxInboundPeers uint32,
	_limitOneInboundConnectionPerIP bool,
	_hyperSync bool,
	_syncType NodeSyncType,
	_stallTimeoutSeconds uint64,
	_minFeeRateNanosPerKB uint64,
	_serverMessageQueue chan *ServerMessage,
	_srv *Server) *ConnectionManager

func (*ConnectionManager) ConnectPeer

func (cmgr *ConnectionManager) ConnectPeer(conn net.Conn, persistentAddr *wire.NetAddress)

ConnectPeer connects either an INBOUND or OUTBOUND peer. If Conn == nil, then we will set up an OUTBOUND peer. Otherwise we will use the Conn to create an INBOUND peer. If the connection is OUTBOUND and the persistentAddr is set, then we will connect only to that addr. Otherwise, we will use the addrmgr to randomly select addrs and create OUTBOUND connections with them until we find a worthy peer.

func (*ConnectionManager) GetAddrManager

func (cmgr *ConnectionManager) GetAddrManager() *addrmgr.AddrManager

func (*ConnectionManager) GetAllPeers

func (cmgr *ConnectionManager) GetAllPeers() []*Peer

GetAllPeers holds the mtxPeerMaps lock for reading and returns a list containing pointers to all the active peers.

func (*ConnectionManager) RandomPeer

func (cmgr *ConnectionManager) RandomPeer() *Peer

func (*ConnectionManager) RemovePeer

func (cmgr *ConnectionManager) RemovePeer(pp *Peer)

Update our data structures to remove this peer.

func (*ConnectionManager) Start

func (cmgr *ConnectionManager) Start()

func (*ConnectionManager) Stop

func (cmgr *ConnectionManager) Stop()

type CreateNFTMetadata

type CreateNFTMetadata struct {
	NFTPostHash                    *BlockHash
	NumCopies                      uint64
	HasUnlockable                  bool
	IsForSale                      bool
	MinBidAmountNanos              uint64
	NFTRoyaltyToCreatorBasisPoints uint64
	NFTRoyaltyToCoinBasisPoints    uint64
}

func (*CreateNFTMetadata) FromBytes

func (txnData *CreateNFTMetadata) FromBytes(dataa []byte) error

func (*CreateNFTMetadata) GetTxnType

func (txnData *CreateNFTMetadata) GetTxnType() TxnType

func (*CreateNFTMetadata) New

func (txnData *CreateNFTMetadata) New() DeSoTxnMetadata

func (*CreateNFTMetadata) ToBytes

func (txnData *CreateNFTMetadata) ToBytes(preSignature bool) ([]byte, error)

type CreateNFTTxindexMetadata

type CreateNFTTxindexMetadata struct {
	NFTPostHashHex             string
	AdditionalCoinRoyaltiesMap map[string]uint64 `json:",omitempty"`
	AdditionalDESORoyaltiesMap map[string]uint64 `json:",omitempty"`
}

func (*CreateNFTTxindexMetadata) GetEncoderType

func (txnMeta *CreateNFTTxindexMetadata) GetEncoderType() EncoderType

func (*CreateNFTTxindexMetadata) GetVersionByte

func (txnMeta *CreateNFTTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*CreateNFTTxindexMetadata) RawDecodeWithoutMetadata

func (txnMeta *CreateNFTTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*CreateNFTTxindexMetadata) RawEncodeWithoutMetadata

func (txnMeta *CreateNFTTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type CreatePostAssociationMetadata added in v3.2.0

type CreatePostAssociationMetadata struct {
	PostHash         *BlockHash
	AppPublicKey     *PublicKey
	AssociationType  []byte
	AssociationValue []byte
}

func (*CreatePostAssociationMetadata) FromBytes added in v3.2.0

func (txnData *CreatePostAssociationMetadata) FromBytes(data []byte) error

func (*CreatePostAssociationMetadata) GetTxnType added in v3.2.0

func (txnData *CreatePostAssociationMetadata) GetTxnType() TxnType

func (*CreatePostAssociationMetadata) New added in v3.2.0

func (*CreatePostAssociationMetadata) ToBytes added in v3.2.0

func (txnData *CreatePostAssociationMetadata) ToBytes(preSignature bool) ([]byte, error)

type CreatePostAssociationTxindexMetadata added in v3.2.0

type CreatePostAssociationTxindexMetadata struct {
	PostHashHex             string
	AppPublicKeyBase58Check string
	AssociationType         string
	AssociationValue        string
}

func (*CreatePostAssociationTxindexMetadata) GetEncoderType added in v3.2.0

func (associationTxindexMeta *CreatePostAssociationTxindexMetadata) GetEncoderType() EncoderType

func (*CreatePostAssociationTxindexMetadata) GetVersionByte added in v3.2.0

func (associationTxindexMeta *CreatePostAssociationTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*CreatePostAssociationTxindexMetadata) RawDecodeWithoutMetadata added in v3.2.0

func (associationTxindexMeta *CreatePostAssociationTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*CreatePostAssociationTxindexMetadata) RawEncodeWithoutMetadata added in v3.2.0

func (associationTxindexMeta *CreatePostAssociationTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type CreateUserAssociationMetadata added in v3.2.0

type CreateUserAssociationMetadata struct {
	TargetUserPublicKey *PublicKey
	AppPublicKey        *PublicKey
	AssociationType     []byte
	AssociationValue    []byte
}

func (*CreateUserAssociationMetadata) FromBytes added in v3.2.0

func (txnData *CreateUserAssociationMetadata) FromBytes(data []byte) error

func (*CreateUserAssociationMetadata) GetTxnType added in v3.2.0

func (txnData *CreateUserAssociationMetadata) GetTxnType() TxnType

func (*CreateUserAssociationMetadata) New added in v3.2.0

func (*CreateUserAssociationMetadata) ToBytes added in v3.2.0

func (txnData *CreateUserAssociationMetadata) ToBytes(preSignature bool) ([]byte, error)

type CreateUserAssociationTxindexMetadata added in v3.2.0

type CreateUserAssociationTxindexMetadata struct {
	TargetUserPublicKeyBase58Check string
	AppPublicKeyBase58Check        string
	AssociationType                string
	AssociationValue               string
}

func (*CreateUserAssociationTxindexMetadata) GetEncoderType added in v3.2.0

func (associationTxindexMeta *CreateUserAssociationTxindexMetadata) GetEncoderType() EncoderType

func (*CreateUserAssociationTxindexMetadata) GetVersionByte added in v3.2.0

func (associationTxindexMeta *CreateUserAssociationTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*CreateUserAssociationTxindexMetadata) RawDecodeWithoutMetadata added in v3.2.0

func (associationTxindexMeta *CreateUserAssociationTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*CreateUserAssociationTxindexMetadata) RawEncodeWithoutMetadata added in v3.2.0

func (associationTxindexMeta *CreateUserAssociationTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type CreatorCoinLimitOperation

type CreatorCoinLimitOperation uint8

The operations that are permitted to be performed by a derived key.

const (
	AnyCreatorCoinOperation       CreatorCoinLimitOperation = 0
	BuyCreatorCoinOperation       CreatorCoinLimitOperation = 1
	SellCreatorCoinOperation      CreatorCoinLimitOperation = 2
	TransferCreatorCoinOperation  CreatorCoinLimitOperation = 3
	UndefinedCreatorCoinOperation CreatorCoinLimitOperation = 4
)

func (CreatorCoinLimitOperation) IsUndefined

func (creatorCoinLimitOperation CreatorCoinLimitOperation) IsUndefined() bool

func (CreatorCoinLimitOperation) ToCreatorCoinLimitOperationString

func (creatorCoinLimitOperation CreatorCoinLimitOperation) ToCreatorCoinLimitOperationString() CreatorCoinLimitOperationString

func (CreatorCoinLimitOperation) ToString

func (creatorCoinLimitOperation CreatorCoinLimitOperation) ToString() string

type CreatorCoinLimitOperationString

type CreatorCoinLimitOperationString string
const (
	AnyCreatorCoinOperationString       CreatorCoinLimitOperationString = "any"
	BuyCreatorCoinOperationString       CreatorCoinLimitOperationString = "buy"
	SellCreatorCoinOperationString      CreatorCoinLimitOperationString = "sell"
	TransferCreatorCoinOperationString  CreatorCoinLimitOperationString = "transfer"
	UndefinedCreatorCoinOperationString CreatorCoinLimitOperationString = "undefined"
)

func (CreatorCoinLimitOperationString) ToCreatorCoinLimitOperation

func (creatorCoinLimitOperationString CreatorCoinLimitOperationString) ToCreatorCoinLimitOperation() CreatorCoinLimitOperation

type CreatorCoinMetadataa

type CreatorCoinMetadataa struct {
	// ProfilePublicKey is the public key of the profile that owns the
	// coin the person wants to operate on. Creator coins can only be
	// bought and sold if a valid profile exists.
	ProfilePublicKey []byte

	// OperationType specifies what the user wants to do with this
	// creator coin.
	OperationType CreatorCoinOperationType

	// Generally, only one of these will be used depending on the OperationType
	// set. In a Buy transaction, DeSoToSellNanos will be converted into
	// creator coin on behalf of the user. In a Sell transaction,
	// CreatorCoinToSellNanos will be converted into DeSo. In an AddDeSo
	// operation, DeSoToAddNanos will be aded for the user. This allows us to
	// support multiple transaction types with same meta field.
	DeSoToSellNanos        uint64
	CreatorCoinToSellNanos uint64
	DeSoToAddNanos         uint64

	// When a user converts DeSo into CreatorCoin, MinCreatorCoinExpectedNanos
	// specifies the minimum amount of creator coin that the user expects from their
	// transaction. And vice versa when a user is converting CreatorCoin for DeSo.
	// Specifying these fields prevents the front-running of users' buy/sell. Setting
	// them to zero turns off the check. Give it your best shot, Ivan.
	MinDeSoExpectedNanos        uint64
	MinCreatorCoinExpectedNanos uint64
}

func (*CreatorCoinMetadataa) FromBytes

func (txnData *CreatorCoinMetadataa) FromBytes(dataa []byte) error

func (*CreatorCoinMetadataa) GetTxnType

func (txnData *CreatorCoinMetadataa) GetTxnType() TxnType

func (*CreatorCoinMetadataa) New

func (txnData *CreatorCoinMetadataa) New() DeSoTxnMetadata

func (*CreatorCoinMetadataa) ToBytes

func (txnData *CreatorCoinMetadataa) ToBytes(preSignature bool) ([]byte, error)

type CreatorCoinOperationLimitKey

type CreatorCoinOperationLimitKey struct {
	CreatorPKID PKID
	Operation   CreatorCoinLimitOperation
}

func MakeCreatorCoinOperationLimitKey

func MakeCreatorCoinOperationLimitKey(creatorPKID PKID, operation CreatorCoinLimitOperation) CreatorCoinOperationLimitKey

func (*CreatorCoinOperationLimitKey) Decode

func (creatorCoinOperationLimitKey *CreatorCoinOperationLimitKey) Decode(rr *bytes.Reader) error

func (CreatorCoinOperationLimitKey) Encode

func (creatorCoinOperationLimitKey CreatorCoinOperationLimitKey) Encode() []byte

type CreatorCoinOperationType

type CreatorCoinOperationType uint8
const (
	CreatorCoinOperationTypeBuy     CreatorCoinOperationType = 0
	CreatorCoinOperationTypeSell    CreatorCoinOperationType = 1
	CreatorCoinOperationTypeAddDeSo CreatorCoinOperationType = 2
)

type CreatorCoinTransferMetadataa

type CreatorCoinTransferMetadataa struct {
	// ProfilePublicKey is the public key of the profile that owns the
	// coin the person wants to transer. Creator coins can only be
	// transferred if a valid profile exists.
	ProfilePublicKey []byte

	CreatorCoinToTransferNanos uint64
	ReceiverPublicKey          []byte
}

func (*CreatorCoinTransferMetadataa) FromBytes

func (txnData *CreatorCoinTransferMetadataa) FromBytes(dataa []byte) error

func (*CreatorCoinTransferMetadataa) GetTxnType

func (txnData *CreatorCoinTransferMetadataa) GetTxnType() TxnType

func (*CreatorCoinTransferMetadataa) New

func (*CreatorCoinTransferMetadataa) ToBytes

func (txnData *CreatorCoinTransferMetadataa) ToBytes(preSignature bool) ([]byte, error)

type CreatorCoinTransferTxindexMetadata

type CreatorCoinTransferTxindexMetadata struct {
	CreatorUsername            string
	CreatorCoinToTransferNanos uint64
	DiamondLevel               int64
	PostHashHex                string
}

func (*CreatorCoinTransferTxindexMetadata) GetEncoderType

func (txnMeta *CreatorCoinTransferTxindexMetadata) GetEncoderType() EncoderType

func (*CreatorCoinTransferTxindexMetadata) GetVersionByte

func (txnMeta *CreatorCoinTransferTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*CreatorCoinTransferTxindexMetadata) RawDecodeWithoutMetadata

func (txnMeta *CreatorCoinTransferTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*CreatorCoinTransferTxindexMetadata) RawEncodeWithoutMetadata

func (txnMeta *CreatorCoinTransferTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type CreatorCoinTxindexMetadata

type CreatorCoinTxindexMetadata struct {
	OperationType string

	// Differs depending on OperationType.
	DeSoToSellNanos        uint64
	CreatorCoinToSellNanos uint64
	DeSoToAddNanos         uint64

	// Rosetta needs to know how much DESO was added or removed so it can
	// model the change to the total deso locked in the creator coin
	DESOLockedNanosDiff int64
}

func (*CreatorCoinTxindexMetadata) GetEncoderType

func (txnMeta *CreatorCoinTxindexMetadata) GetEncoderType() EncoderType

func (*CreatorCoinTxindexMetadata) GetVersionByte

func (txnMeta *CreatorCoinTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*CreatorCoinTxindexMetadata) RawDecodeWithoutMetadata

func (txnMeta *CreatorCoinTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*CreatorCoinTxindexMetadata) RawEncodeWithoutMetadata

func (txnMeta *CreatorCoinTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type DAOCoinLimitOperation

type DAOCoinLimitOperation uint8
const (
	AnyDAOCoinOperation                             DAOCoinLimitOperation = 0
	MintDAOCoinOperation                            DAOCoinLimitOperation = 1
	BurnDAOCoinOperation                            DAOCoinLimitOperation = 2
	DisableMintingDAOCoinOperation                  DAOCoinLimitOperation = 3
	UpdateTransferRestrictionStatusDAOCoinOperation DAOCoinLimitOperation = 4
	TransferDAOCoinOperation                        DAOCoinLimitOperation = 5
	UndefinedDAOCoinOperation                       DAOCoinLimitOperation = 6
)

func (DAOCoinLimitOperation) IsUndefined

func (daoCoinLimitOperation DAOCoinLimitOperation) IsUndefined() bool

func (DAOCoinLimitOperation) ToDAOCoinLimitOperationString

func (daoCoinLimitOperation DAOCoinLimitOperation) ToDAOCoinLimitOperationString() DAOCoinLimitOperationString

func (DAOCoinLimitOperation) ToString

func (daoCoinLimitOperation DAOCoinLimitOperation) ToString() string

type DAOCoinLimitOperationString

type DAOCoinLimitOperationString string
const (
	AnyDAOCoinOperationString                             DAOCoinLimitOperationString = "any"
	MintDAOCoinOperationString                            DAOCoinLimitOperationString = "mint"
	BurnDAOCoinOperationString                            DAOCoinLimitOperationString = "burn"
	DisableMintingDAOCoinOperationString                  DAOCoinLimitOperationString = "disable_minting"
	UpdateTransferRestrictionStatusDAOCoinOperationString DAOCoinLimitOperationString = "update_transfer_restriction_status"
	TransferDAOCoinOperationString                        DAOCoinLimitOperationString = "transfer"
	UndefinedDAOCoinOperationString                       DAOCoinLimitOperationString = "undefined"
)

func (DAOCoinLimitOperationString) ToDAOCoinLimitOperation

func (daoCoinLimitOperationString DAOCoinLimitOperationString) ToDAOCoinLimitOperation() DAOCoinLimitOperation

type DAOCoinLimitOrderEntry

type DAOCoinLimitOrderEntry struct {
	// OrderID is the txn hash (unique identifier) for this order.
	OrderID *BlockHash
	// TransactorPKID is the PKID of the user who created this order.
	TransactorPKID *PKID
	// The PKID of the coin that we're going to buy
	BuyingDAOCoinCreatorPKID *PKID
	// The PKID of the coin that we're going to sell
	SellingDAOCoinCreatorPKID *PKID
	// ScaledExchangeRateCoinsToSellPerCoinToBuy specifies how many of the coins
	// associated with SellingDAOCoinCreatorPKID we need to convert in order
	// to get one BuyingDAOCoinCreatorPKID. For example, if this value was
	// 2, then we would need to convert 2 SellingDAOCoinCreatorPKID
	// coins to get 1 BuyingDAOCoinCreatorPKID. Note, however, that to represent
	// 2, we would actually have to set ScaledExchangeRateCoinsToSellPerCoinToBuy to
	// be equal to 2*1e38 because of the representation format we describe
	// below.
	//
	// The exchange rate is represented as a fixed-point value, which works
	// as follows:
	// - Whenever we reference an exchange rate, call it Y, we pass it
	//   around as a uint256 BUT we consider it to be implicitly divided
	//   by 1e38.
	// - For example, to represent a decimal number like 123456789.987654321,
	//   call it X, we would pass around Y = X*1e38 = 1234567899876543210000000000000000000000000000
	//   as a uint256.
	//   Then, to do operations with Y, we would make sure to always divide by
	//   1e38 before returning a final quantity.
	// - We will refer to Y as "scaled." The value of ScaledExchangeRateCoinsToSellPerCoinToBuy
	//   will always be scaled, meaning it is a uint256 that we implicitly
	//   assume represents a number that is divided by 1e38.
	//
	// This scheme is also referred to as "fixed point," and a similar scheme
	// is utilized by Uniswap. You can learn more about how this works here:
	// - https://en.wikipedia.org/wiki/Q_(number_format)
	// - https://ethereum.org/de/developers/tutorials/uniswap-v2-annotated-code/#FixedPoint
	// - https://uniswap.org/whitepaper.pdf
	ScaledExchangeRateCoinsToSellPerCoinToBuy *uint256.Int
	// QuantityBaseUnits expresses how many "base units" of the coin this order is
	// buying. Note that we could have called this QuantityToBuyNanos, and in the
	// case where we're buying DESO, the base unit is a "nano." However, we call it
	// "base unit" rather than nano because other DAO coins might decide to use a
	// different scheme than nanos for their base unit. In particular, we expect 1e18
	// base units to equal 1 DAO coin, rather than using nanos.
	QuantityToFillInBaseUnits *uint256.Int
	// This is one of ASK or BID. If the operation type is an ASK, then the quantity
	// column applies to the selling coin. I.e. the order is considered fulfilled
	// once the selling coin quantity to fill is zero. If the operation type is a BID,
	// then quantity column applies to the buying coin. I.e. the order is considered
	// fulfilled once the buying coin quantity to fill is zero.
	OperationType DAOCoinLimitOrderOperationType
	// This is one of GoodTillCancelled, ImmediateOrCancel, or FillOrKill.
	// See the DAOCoinLimitOrderFillType struct for more details.
	FillType DAOCoinLimitOrderFillType
	// This is the block height at which the order was placed. We use the block height
	// to break ties between orders. If there are two orders that could be filled, we
	// pick the one that was submitted earlier.
	BlockHeight uint32
	// contains filtered or unexported fields
}

func DBGetAllDAOCoinLimitOrders

func DBGetAllDAOCoinLimitOrders(handle *badger.DB) ([]*DAOCoinLimitOrderEntry, error)

func DBGetAllDAOCoinLimitOrdersForThisDAOCoinPair

func DBGetAllDAOCoinLimitOrdersForThisDAOCoinPair(
	handle *badger.DB,
	buyingDAOCoinCreatorPKID *PKID,
	sellingDAOCoinCreatorPKID *PKID) ([]*DAOCoinLimitOrderEntry, error)

func DBGetAllDAOCoinLimitOrdersForThisTransactor

func DBGetAllDAOCoinLimitOrdersForThisTransactor(handle *badger.DB, transactorPKID *PKID) ([]*DAOCoinLimitOrderEntry, error)

func DBGetDAOCoinLimitOrder

func DBGetDAOCoinLimitOrder(handle *badger.DB, snap *Snapshot, orderID *BlockHash) (
	*DAOCoinLimitOrderEntry, error)

func DBGetDAOCoinLimitOrderWithTxn

func DBGetDAOCoinLimitOrderWithTxn(txn *badger.Txn, snap *Snapshot, orderID *BlockHash) (
	_order *DAOCoinLimitOrderEntry, _err error)

func DBGetMatchingDAOCoinLimitOrders

func DBGetMatchingDAOCoinLimitOrders(
	txn *badger.Txn, inputOrder *DAOCoinLimitOrderEntry, lastSeenOrder *DAOCoinLimitOrderEntry,
	orderEntriesInView map[DAOCoinLimitOrderMapKey]bool) ([]*DAOCoinLimitOrderEntry, error)

func (*DAOCoinLimitOrderEntry) BaseUnitsToBuyUint256

func (order *DAOCoinLimitOrderEntry) BaseUnitsToBuyUint256() (*uint256.Int, error)

func (*DAOCoinLimitOrderEntry) BaseUnitsToSellUint256

func (order *DAOCoinLimitOrderEntry) BaseUnitsToSellUint256() (*uint256.Int, error)

func (*DAOCoinLimitOrderEntry) Copy

func (*DAOCoinLimitOrderEntry) GetEncoderType

func (order *DAOCoinLimitOrderEntry) GetEncoderType() EncoderType

func (*DAOCoinLimitOrderEntry) GetVersionByte

func (order *DAOCoinLimitOrderEntry) GetVersionByte(blockHeight uint64) byte

func (*DAOCoinLimitOrderEntry) IsBetterMatchingOrderThan

func (order *DAOCoinLimitOrderEntry) IsBetterMatchingOrderThan(other *DAOCoinLimitOrderEntry) bool

func (*DAOCoinLimitOrderEntry) IsMarketOrder

func (order *DAOCoinLimitOrderEntry) IsMarketOrder() bool

func (*DAOCoinLimitOrderEntry) IsValidMatchingOrderPrice

func (order *DAOCoinLimitOrderEntry) IsValidMatchingOrderPrice(matchingOrder *DAOCoinLimitOrderEntry) bool

func (*DAOCoinLimitOrderEntry) RawDecodeWithoutMetadata

func (order *DAOCoinLimitOrderEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*DAOCoinLimitOrderEntry) RawEncodeWithoutMetadata

func (order *DAOCoinLimitOrderEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

func (*DAOCoinLimitOrderEntry) ToMapKey

type DAOCoinLimitOrderFillType

type DAOCoinLimitOrderFillType uint8
const (
	// GoodTillCancelled: fulfill whatever you can immediately then
	// store whatever is remaining of this order in the database.
	DAOCoinLimitOrderFillTypeGoodTillCancelled DAOCoinLimitOrderFillType = 1
	// ImmediateOrCancel: fulfill whatever you can immediately then
	// cancel whatever is remaining of this order.
	DAOCoinLimitOrderFillTypeImmediateOrCancel DAOCoinLimitOrderFillType = 2
	// FillOrKill: fulfill whatever you can immediately then cancel
	// the entire order if it is unable to be completely fulfilled.
	DAOCoinLimitOrderFillTypeFillOrKill DAOCoinLimitOrderFillType = 3
)

type DAOCoinLimitOrderLimitKey

type DAOCoinLimitOrderLimitKey struct {
	// The PKID of the coin that we're going to buy
	BuyingDAOCoinCreatorPKID PKID
	// The PKID of the coin that we're going to sell
	SellingDAOCoinCreatorPKID PKID
}

func MakeDAOCoinLimitOrderLimitKey

func MakeDAOCoinLimitOrderLimitKey(buyingDAOCoinCreatorPKID PKID, sellingDAOCoinCreatorPKID PKID) DAOCoinLimitOrderLimitKey

func (*DAOCoinLimitOrderLimitKey) Decode

func (daoCoinLimitOrderLimitKey *DAOCoinLimitOrderLimitKey) Decode(rr *bytes.Reader) error

func (DAOCoinLimitOrderLimitKey) Encode

func (daoCoinLimitOrderLimitKey DAOCoinLimitOrderLimitKey) Encode() []byte

type DAOCoinLimitOrderMapKey

type DAOCoinLimitOrderMapKey struct {
	// An OrderID uniquely identifies an order
	OrderID BlockHash
}

type DAOCoinLimitOrderMetadata

type DAOCoinLimitOrderMetadata struct {
	BuyingDAOCoinCreatorPublicKey             *PublicKey
	SellingDAOCoinCreatorPublicKey            *PublicKey
	ScaledExchangeRateCoinsToSellPerCoinToBuy *uint256.Int
	QuantityToFillInBaseUnits                 *uint256.Int
	OperationType                             DAOCoinLimitOrderOperationType
	FillType                                  DAOCoinLimitOrderFillType

	// If set, we will find and delete the
	// order with the given OrderID.
	CancelOrderID *BlockHash

	// This is only populated when this order is selling a DAO coin for
	// $DESO, and is immediately matched with an existing bid-side order
	// at time of creation. This field contains the transactor and their
	// utxo inputs that can be used to immediately execute this trade.
	BidderInputs []*DeSoInputsByTransactor

	// Since a DAO Coin Limit Order may spend DESO or yield DESO to the
	// transactor, we specify FeeNanos in the transaction metadata in
	// order to ensure the transactor pays the standard fee rate for the size
	// of the transaction AND ensures the internal balance model of the
	// DAO Coin Limit Order transaction connection logic remains valid.
	FeeNanos uint64
}

func (*DAOCoinLimitOrderMetadata) FromBytes

func (txnData *DAOCoinLimitOrderMetadata) FromBytes(data []byte) error

func (*DAOCoinLimitOrderMetadata) GetTxnType

func (txnData *DAOCoinLimitOrderMetadata) GetTxnType() TxnType

func (*DAOCoinLimitOrderMetadata) New

func (*DAOCoinLimitOrderMetadata) ToBytes

func (txnData *DAOCoinLimitOrderMetadata) ToBytes(preSignature bool) ([]byte, error)

type DAOCoinLimitOrderOperationType

type DAOCoinLimitOrderOperationType uint8
const (
	// We intentionally skip zero as otherwise that would be the default value.
	DAOCoinLimitOrderOperationTypeASK DAOCoinLimitOrderOperationType = 1
	DAOCoinLimitOrderOperationTypeBID DAOCoinLimitOrderOperationType = 2
)

func (DAOCoinLimitOrderOperationType) String

type DAOCoinLimitOrderTxindexMetadata

type DAOCoinLimitOrderTxindexMetadata struct {
	BuyingDAOCoinCreatorPublicKey             string
	SellingDAOCoinCreatorPublicKey            string
	ScaledExchangeRateCoinsToSellPerCoinToBuy *uint256.Int
	QuantityToFillInBaseUnits                 *uint256.Int
	FilledDAOCoinLimitOrdersMetadata          []*FilledDAOCoinLimitOrderMetadata
}

func (*DAOCoinLimitOrderTxindexMetadata) GetEncoderType

func (daoMeta *DAOCoinLimitOrderTxindexMetadata) GetEncoderType() EncoderType

func (*DAOCoinLimitOrderTxindexMetadata) GetVersionByte

func (daoMeta *DAOCoinLimitOrderTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*DAOCoinLimitOrderTxindexMetadata) RawDecodeWithoutMetadata

func (daoMeta *DAOCoinLimitOrderTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*DAOCoinLimitOrderTxindexMetadata) RawEncodeWithoutMetadata

func (daoMeta *DAOCoinLimitOrderTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type DAOCoinMetadata

type DAOCoinMetadata struct {
	// ProfilePublicKey is the public key of the profile that owns the
	// coin the person wants to operate on.
	ProfilePublicKey []byte

	// OperationType specifies what the user wants to do with this
	// DAO coin.
	OperationType DAOCoinOperationType

	// TODO: Should we only have one field that tracks number of coins in operation to keep this struct small?
	// We will only ever need 1 of these fields.
	// Mint field
	CoinsToMintNanos uint256.Int

	// Burn Fields
	CoinsToBurnNanos uint256.Int

	// TransferRestrictionStatus to set if OperationType == DAOCoinOperationTypeUpdateTransferRestrictionStatus
	TransferRestrictionStatus
}

func (*DAOCoinMetadata) FromBytes

func (txnData *DAOCoinMetadata) FromBytes(data []byte) error

func (*DAOCoinMetadata) GetTxnType

func (txnData *DAOCoinMetadata) GetTxnType() TxnType

func (*DAOCoinMetadata) New

func (txnData *DAOCoinMetadata) New() DeSoTxnMetadata

func (*DAOCoinMetadata) ToBytes

func (txnData *DAOCoinMetadata) ToBytes(preSignature bool) ([]byte, error)

type DAOCoinOperationLimitKey

type DAOCoinOperationLimitKey struct {
	CreatorPKID PKID
	Operation   DAOCoinLimitOperation
}

func MakeDAOCoinOperationLimitKey

func MakeDAOCoinOperationLimitKey(creatorPKID PKID, operation DAOCoinLimitOperation) DAOCoinOperationLimitKey

func (*DAOCoinOperationLimitKey) Decode

func (daoCoinOperationLimitKey *DAOCoinOperationLimitKey) Decode(rr *bytes.Reader) error

func (DAOCoinOperationLimitKey) Encode

func (daoCoinOperationLimitKey DAOCoinOperationLimitKey) Encode() []byte

type DAOCoinOperationType

type DAOCoinOperationType uint8
const (
	DAOCoinOperationTypeMint                            DAOCoinOperationType = 0
	DAOCoinOperationTypeBurn                            DAOCoinOperationType = 1
	DAOCoinOperationTypeDisableMinting                  DAOCoinOperationType = 2
	DAOCoinOperationTypeUpdateTransferRestrictionStatus DAOCoinOperationType = 3
)

type DAOCoinTransferMetadata

type DAOCoinTransferMetadata struct {
	// ProfilePublicKey is the public key of the profile that owns the
	// coin the person wants to transfer. DAO coins can only be
	// transferred if a valid profile exists.
	ProfilePublicKey []byte

	DAOCoinToTransferNanos uint256.Int
	ReceiverPublicKey      []byte
}

func (*DAOCoinTransferMetadata) FromBytes

func (txnData *DAOCoinTransferMetadata) FromBytes(data []byte) error

func (*DAOCoinTransferMetadata) GetTxnType

func (txnData *DAOCoinTransferMetadata) GetTxnType() TxnType

func (*DAOCoinTransferMetadata) New

func (*DAOCoinTransferMetadata) ToBytes

func (txnData *DAOCoinTransferMetadata) ToBytes(preSignature bool) ([]byte, error)

type DAOCoinTransferTxindexMetadata

type DAOCoinTransferTxindexMetadata struct {
	CreatorUsername        string
	DAOCoinToTransferNanos uint256.Int
}

func (*DAOCoinTransferTxindexMetadata) GetEncoderType

func (txnMeta *DAOCoinTransferTxindexMetadata) GetEncoderType() EncoderType

func (*DAOCoinTransferTxindexMetadata) GetVersionByte

func (txnMeta *DAOCoinTransferTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*DAOCoinTransferTxindexMetadata) RawDecodeWithoutMetadata

func (txnMeta *DAOCoinTransferTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*DAOCoinTransferTxindexMetadata) RawEncodeWithoutMetadata

func (txnMeta *DAOCoinTransferTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type DAOCoinTxindexMetadata

type DAOCoinTxindexMetadata struct {
	CreatorUsername           string
	OperationType             string
	CoinsToMintNanos          *uint256.Int
	CoinsToBurnNanos          *uint256.Int
	TransferRestrictionStatus string
}

func (*DAOCoinTxindexMetadata) GetEncoderType

func (txnMeta *DAOCoinTxindexMetadata) GetEncoderType() EncoderType

func (*DAOCoinTxindexMetadata) GetVersionByte

func (txnMeta *DAOCoinTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*DAOCoinTxindexMetadata) RawDecodeWithoutMetadata

func (txnMeta *DAOCoinTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*DAOCoinTxindexMetadata) RawEncodeWithoutMetadata

func (txnMeta *DAOCoinTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type DBEntry

type DBEntry struct {
	Key   []byte
	Value []byte
}

DBEntry is used to represent a database record. It's more convenient than passing <key, value> everywhere.

func DBIteratePrefixKeys

func DBIteratePrefixKeys(db *badger.DB, prefix []byte, startKey []byte, targetBytes uint32) (
	_dbEntries []*DBEntry, _isChunkFull bool, _err error)

DBIteratePrefixKeys fetches a chunk of records from the provided db at a provided prefix, and beginning with the provided startKey. The chunk will have a total size of at least targetBytes. If the startKey is a valid key in the db, it will be the first entry in the returned dbEntries. If we have exhausted all entries for a prefix then _isChunkFull will be set as false, and true otherwise, when there are more entries in the db at the prefix.

func EmptyDBEntry

func EmptyDBEntry() *DBEntry

EmptyDBEntry indicates an empty DB entry. It's used for convenience.

func KeyValueToDBEntry

func KeyValueToDBEntry(key []byte, value []byte) *DBEntry

KeyValueToDBEntry is used to instantiate db entry from a <key, value> pair.

func (*DBEntry) FromBytes

func (entry *DBEntry) FromBytes(rr *bytes.Reader) error

func (*DBEntry) IsEmpty

func (entry *DBEntry) IsEmpty() bool

IsEmpty return true if the DBEntry is empty, false otherwise.

func (*DBEntry) ToBytes

func (entry *DBEntry) ToBytes() []byte

type DBPrefixes

type DBPrefixes struct {

	// The prefix for the block index:
	// Key format: <prefix_id, hash BlockHash>
	// Value format: serialized MsgDeSoBlock
	PrefixBlockHashToBlock []byte `prefix_id:"[0]"`

	// The prefix for the node index that we use to reconstruct the block tree.
	// Storing the height in big-endian byte order allows us to read in all the
	// blocks in height-sorted order from the db and construct the block tree by connecting
	// nodes to their parents as we go.
	//
	// Key format: <prefix_id, height uint32 (big-endian), hash BlockHash>
	// Value format: serialized BlockNode
	PrefixHeightHashToNodeInfo        []byte `prefix_id:"[1]"`
	PrefixBitcoinHeightHashToNodeInfo []byte `prefix_id:"[2]"`

	// We store the hash of the node that is the current tip of the main chain.
	// This key is used to look it up.
	// Value format: BlockHash
	PrefixBestDeSoBlockHash []byte `prefix_id:"[3]"`

	PrefixBestBitcoinHeaderHash []byte `prefix_id:"[4]"`

	// Utxo table.
	// <prefix_id, txid BlockHash, output_index uint64> -> UtxoEntry
	PrefixUtxoKeyToUtxoEntry []byte `prefix_id:"[5]" is_state:"true"`
	// <prefix_id, pubKey [33]byte, utxoKey< txid BlockHash, index uint32 >> -> <>
	PrefixPubKeyUtxoKey []byte `prefix_id:"[7]" is_state:"true"`
	// The number of utxo entries in the database.
	PrefixUtxoNumEntries []byte `prefix_id:"[8]" is_state:"true"`
	// Utxo operations table.
	// This table contains, for each blockhash on the main chain, the UtxoOperations
	// that were applied by this block. To roll back the block, one must loop through
	// the UtxoOperations for a particular block backwards and invert them.
	//
	// <prefix_id, hash *BlockHash > -> < serialized []UtxoOperation using custom encoding >
	PrefixBlockHashToUtxoOperations []byte `prefix_id:"[9]"`
	// The below are mappings related to the validation of BitcoinExchange transactions.
	//
	// The number of nanos that has been purchased thus far.
	PrefixNanosPurchased []byte `prefix_id:"[10]" is_state:"true"`
	// How much Bitcoin is work in USD cents.
	PrefixUSDCentsPerBitcoinExchangeRate []byte `prefix_id:"[27]" is_state:"true"`
	// <prefix_id, key> -> <GlobalParamsEntry encoded>
	PrefixGlobalParams []byte `prefix_id:"[40]" is_state:"true"`

	// The prefix for the Bitcoin TxID map. If a key is set for a TxID that means this
	// particular TxID has been processed as part of a BitcoinExchange transaction. If
	// no key is set for a TxID that means it has not been processed (and thus it can be
	// used to create new nanos).
	// <prefix_id, BitcoinTxID BlockHash> -> <nothing>
	PrefixBitcoinBurnTxIDs []byte `prefix_id:"[11]" is_state:"true"`
	// Messages are indexed by the public key of their senders and receivers. If
	// a message sends from pkFrom to pkTo then there will be two separate entries,
	// one for pkFrom and one for pkTo. The exact format is as follows:
	// <public key (33 bytes) || uint64 big-endian> -> <MessageEntry>
	PrefixPublicKeyTimestampToPrivateMessage []byte `prefix_id:"[12]" is_state:"true"`

	// Tracks the tip of the transaction index. This is used to determine
	// which blocks need to be processed in order to update the index.
	PrefixTransactionIndexTip []byte `prefix_id:"[14]" is_txindex:"true"`
	// <prefix_id, transactionID BlockHash> -> <TransactionMetadata struct>
	PrefixTransactionIDToMetadata []byte `prefix_id:"[15]" is_txindex:"true"`
	// <prefix_id, publicKey []byte, index uint32> -> <txid BlockHash>
	PrefixPublicKeyIndexToTransactionIDs []byte `prefix_id:"[16]" is_txindex:"true"`
	// <prefix_id, publicKey []byte> -> <index uint32>
	PrefixPublicKeyToNextIndex []byte `prefix_id:"[42]" is_txindex:"true"`

	// Main post index.
	// <prefix_id, PostHash BlockHash> -> PostEntry
	PrefixPostHashToPostEntry []byte `prefix_id:"[17]" is_state:"true"`
	// Post sorts
	// <prefix_id, publicKey [33]byte, PostHash> -> <>
	PrefixPosterPublicKeyPostHash []byte `prefix_id:"[18]" is_state:"true"`

	// <prefix_id, tstampNanos uint64, PostHash> -> <>
	PrefixTstampNanosPostHash []byte `prefix_id:"[19]" is_state:"true"`
	// <prefix_id, creatorbps uint64, PostHash> -> <>
	PrefixCreatorBpsPostHash []byte `prefix_id:"[20]" is_state:"true"`
	// <prefix_id, multiplebps uint64, PostHash> -> <>
	PrefixMultipleBpsPostHash []byte `prefix_id:"[21]" is_state:"true"`
	// Comments are just posts that have their ParentStakeID set, and
	// so we have a separate index that allows us to return all the
	// comments for a given StakeID
	// <prefix_id, parent stakeID [33]byte, tstampnanos uint64, post hash> -> <>
	PrefixCommentParentStakeIDToPostHash []byte `prefix_id:"[22]" is_state:"true"`

	// Main profile index
	// <prefix_id, PKID [33]byte> -> ProfileEntry
	PrefixPKIDToProfileEntry []byte `prefix_id:"[23]" is_state:"true"`
	// Profile sorts
	// For username, we set the PKID as a value since the username is not fixed width.
	// We always lowercase usernames when using them as map keys in order to make
	// all uniqueness checks case-insensitive
	// <prefix_id, username> -> <PKID>
	PrefixProfileUsernameToPKID []byte `prefix_id:"[25]" is_state:"true"`
	// This allows us to sort the profiles by the value of their coin (since
	// the amount of DeSo locked in a profile is proportional to coin price).
	PrefixCreatorDeSoLockedNanosCreatorPKID []byte `prefix_id:"[32]" is_state:"true"`
	// The StakeID is a post hash for posts and a public key for users.
	// <prefix_id, StakeIDType, AmountNanos uint64, StakeID [var]byte> -> <>
	PrefixStakeIDTypeAmountStakeIDIndex []byte `prefix_id:"[26]" is_state:"true"`

	// Prefixes for follows:
	// <prefix_id, follower PKID [33]byte, followed PKID [33]byte> -> <>
	// <prefix_id, followed PKID [33]byte, follower PKID [33]byte> -> <>
	PrefixFollowerPKIDToFollowedPKID []byte `prefix_id:"[28]" is_state:"true"`
	PrefixFollowedPKIDToFollowerPKID []byte `prefix_id:"[29]" is_state:"true"`

	// Prefixes for likes:
	// <prefix_id, user pub key [33]byte, liked post hash [32]byte> -> <>
	// <prefix_id, post hash [32]byte, user pub key [33]byte> -> <>
	PrefixLikerPubKeyToLikedPostHash []byte `prefix_id:"[30]" is_state:"true"`
	PrefixLikedPostHashToLikerPubKey []byte `prefix_id:"[31]" is_state:"true"`

	// Prefixes for creator coin fields:
	// <prefix_id, HODLer PKID [33]byte, creator PKID [33]byte> -> <BalanceEntry>
	// <prefix_id, creator PKID [33]byte, HODLer PKID [33]byte> -> <BalanceEntry>
	PrefixHODLerPKIDCreatorPKIDToBalanceEntry []byte `prefix_id:"[33]" is_state:"true"`
	PrefixCreatorPKIDHODLerPKIDToBalanceEntry []byte `prefix_id:"[34]" is_state:"true"`

	PrefixPosterPublicKeyTimestampPostHash []byte `prefix_id:"[35]" is_state:"true"`
	// If no mapping exists for a particular public key, then the PKID is simply
	// the public key itself.
	// <prefix_id, [33]byte> -> <PKID [33]byte>
	PrefixPublicKeyToPKID []byte `prefix_id:"[36]" is_state:"true"`
	// <prefix_id, PKID [33]byte> -> <PublicKey [33]byte>
	PrefixPKIDToPublicKey []byte `prefix_id:"[37]" is_state:"true"`
	// Prefix for storing mempool transactions in badger. These stored transactions are
	// used to restore the state of a node after it is shutdown.
	// <prefix_id, tx hash BlockHash> -> <*MsgDeSoTxn>
	PrefixMempoolTxnHashToMsgDeSoTxn []byte `prefix_id:"[38]"`

	// Prefixes for Reposts:
	// <prefix_id, user pub key [39]byte, reposted post hash [39]byte> -> RepostEntry
	PrefixReposterPubKeyRepostedPostHashToRepostPostHash []byte `prefix_id:"[39]" is_state:"true"`
	// Prefixes for diamonds:
	//  <prefix_id, DiamondReceiverPKID [33]byte, DiamondSenderPKID [33]byte, posthash> -> <DiamondEntry>
	//  <prefix_id, DiamondSenderPKID [33]byte, DiamondReceiverPKID [33]byte, posthash> -> <DiamondEntry>
	PrefixDiamondReceiverPKIDDiamondSenderPKIDPostHash []byte `prefix_id:"[41]" is_state:"true"`
	PrefixDiamondSenderPKIDDiamondReceiverPKIDPostHash []byte `prefix_id:"[43]" is_state:"true"`
	// Public keys that have been restricted from signing blocks.
	// <prefix_id, ForbiddenPublicKey [33]byte> -> <>
	PrefixForbiddenBlockSignaturePubKeys []byte `prefix_id:"[44]" is_state:"true"`

	// These indexes are used in order to fetch the pub keys of users that liked or diamonded a post.
	// 		Reposts: <prefix_id, RepostedPostHash, ReposterPubKey> -> <>
	// 		Quote Reposts: <prefix_id, RepostedPostHash, ReposterPubKey, RepostPostHash> -> <>
	// 		Diamonds: <prefix_id, DiamondedPostHash, DiamonderPubKey [33]byte, DiamondLevel (uint64)> -> <>
	PrefixRepostedPostHashReposterPubKey               []byte `prefix_id:"[45]" is_state:"true"`
	PrefixRepostedPostHashReposterPubKeyRepostPostHash []byte `prefix_id:"[46]" is_state:"true"`
	PrefixDiamondedPostHashDiamonderPKIDDiamondLevel   []byte `prefix_id:"[47]" is_state:"true"`
	// Prefixes for NFT ownership:
	// 	<prefix_id, NFTPostHash [32]byte, SerialNumber uint64> -> NFTEntry
	PrefixPostHashSerialNumberToNFTEntry []byte `prefix_id:"[48]" is_state:"true"`
	//  <prefix_id, PKID [33]byte, IsForSale bool, BidAmountNanos uint64, NFTPostHash[32]byte, SerialNumber uint64> -> NFTEntry
	PrefixPKIDIsForSaleBidAmountNanosPostHashSerialNumberToNFTEntry []byte `prefix_id:"[49]" is_state:"true"`
	// Prefixes for NFT bids:
	//  <prefix_id, NFTPostHash [32]byte, SerialNumber uint64, BidNanos uint64, PKID [33]byte> -> <>
	PrefixPostHashSerialNumberBidNanosBidderPKID []byte `prefix_id:"[50]" is_state:"true"`
	//  <prefix_id, BidderPKID [33]byte, NFTPostHash [32]byte, SerialNumber uint64> -> <BidNanos uint64>
	PrefixBidderPKIDPostHashSerialNumberToBidNanos []byte `prefix_id:"[51]" is_state:"true"`

	// <prefix_id, PublicKey [33]byte> -> uint64
	PrefixPublicKeyToDeSoBalanceNanos []byte `prefix_id:"[52]" is_state:"true"`

	// Block reward prefix:
	//   - This index is needed because block rewards take N blocks to mature, which means we need
	//     a way to deduct them from balance calculations until that point. Without this index, it
	//     would be impossible to figure out which of a user's UTXOs have yet to mature.
	//   - Schema: <prefix_id, hash BlockHash> -> <pubKey [33]byte, uint64 blockRewardNanos>
	PrefixPublicKeyBlockHashToBlockReward []byte `prefix_id:"[53]" is_state:"true"`

	// Prefix for NFT accepted bid entries:
	//   - Note: this index uses a slice to track the history of winning bids for an NFT. It is
	//     not core to consensus and should not be relied upon as it could get inefficient.
	//   - Schema: <prefix_id>, NFTPostHash [32]byte, SerialNumber uint64 -> []NFTBidEntry
	PrefixPostHashSerialNumberToAcceptedBidEntries []byte `prefix_id:"[54]" is_state:"true"`

	// Prefixes for DAO coin fields:
	// <prefix, HODLer PKID [33]byte, creator PKID [33]byte> -> <BalanceEntry>
	// <prefix, creator PKID [33]byte, HODLer PKID [33]byte> -> <BalanceEntry>
	PrefixHODLerPKIDCreatorPKIDToDAOCoinBalanceEntry []byte `prefix_id:"[55]" is_state:"true"`
	PrefixCreatorPKIDHODLerPKIDToDAOCoinBalanceEntry []byte `prefix_id:"[56]" is_state:"true"`

	// Prefix for MessagingGroupEntries indexed by OwnerPublicKey and GroupKeyName:
	//
	// * This index is used to store information about messaging groups. A group is indexed
	//   by the "owner" public key of the user who created the group and the key
	//   name the owner selected when creating the group (can be anything, user-defined).
	//
	// * Groups can have members that all use a shared key to communicate. In this case,
	//   the MessagingGroupEntry will contain the metadata required for each participant to
	//   compute the shared key.
	//
	// * Groups can also consist of a single person, and this is useful for "registering"
	//   a key so that other people can message you. Generally, every user has a mapping of
	//   the form:
	//   - <OwnerPublicKey, "default-key"> -> MessagingGroupEntry
	//   This "singleton" group is used to register a default key so that people can
	//   message this user. Allowing users to register default keys on-chain in this way is required
	//   to make it so that messages can be decrypted on mobile devices, where apps do not have
	//   easy access to the owner key for decrypting messages.
	//
	// <prefix, AccessGroupOwnerPublicKey [33]byte, GroupKeyName [32]byte> -> <MessagingGroupEntry>
	PrefixMessagingGroupEntriesByOwnerPubKeyAndGroupKeyName []byte `prefix_id:"[57]" is_state:"true"`

	// Prefix for Message MessagingGroupMembers:
	//
	// * For each group that a user is a member of, we store a value in this index of
	//   the form:
	//   - <OwnerPublicKey for user, GroupMessagingPublicKey> -> <HackedMessagingGroupEntry>
	//   The value needs to contain enough information to allow us to look up the
	//   group's metatdata in the _PrefixMessagingGroupEntriesByOwnerPubKeyAndGroupKeyName index. It's also convenient for
	//   the value to contain the encrypted messaging key for the user so that we can
	//   decrypt messages for this user *without* looking up the group.
	//
	// * HackedMessagingGroupEntry is a MessagingGroupEntry that we overload to store
	// 	 information on a member of a group. We couldn't use the MessagingGroupMember
	//   because we wanted to store additional information that "back-references" the
	//   MessagingGroupEntry for this group.
	//
	// * Note that GroupMessagingPublicKey != AccessGroupOwnerPublicKey. For this index
	//   it was convenient for various reasons to put the messaging public key into
	//   the index rather than the group owner's public key. This becomes clear if
	//   you read all the fetching code around this index.
	//
	// <prefix, OwnerPublicKey [33]byte, GroupMessagingPublicKey [33]byte> -> <HackedMessagingKeyEntry>
	PrefixMessagingGroupMetadataByMemberPubKeyAndGroupMessagingPubKey []byte `prefix_id:"[58]" is_state:"true"`

	// Prefix for Authorize Derived Key transactions:
	// 		<prefix_id, OwnerPublicKey [33]byte, DerivedPublicKey [33]byte> -> <DerivedKeyEntry>
	PrefixAuthorizeDerivedKey []byte `prefix_id:"[59]" is_state:"true"`

	// Prefixes for DAO coin limit orders
	// This index powers the order book.
	// <
	//   _PrefixDAOCoinLimitOrder
	//   BuyingDAOCoinCreatorPKID [33]byte
	//   SellingDAOCoinCreatorPKID [33]byte
	//   ScaledExchangeRateCoinsToSellPerCoinToBuy [32]byte
	//   BlockHeight [32]byte
	//   OrderID [32]byte
	// > -> <DAOCoinLimitOrderEntry>
	//
	// This index allows users to query for their open orders.
	// <
	//   _PrefixDAOCoinLimitOrderByTransactorPKID
	//   TransactorPKID [33]byte
	//   BuyingDAOCoinCreatorPKID [33]byte
	//   SellingDAOCoinCreatorPKID [33]byte
	//   OrderID [32]byte
	// > -> <DAOCoinLimitOrderEntry>
	//
	// This index allows users to query for a single order by ID.
	// This is useful in e.g. cancelling an order.
	// <
	//   _PrefixDAOCoinLimitOrderByOrderID
	//   OrderID [32]byte
	// > -> <DAOCoinLimitOrderEntry>
	PrefixDAOCoinLimitOrder                 []byte `prefix_id:"[60]" is_state:"true"`
	PrefixDAOCoinLimitOrderByTransactorPKID []byte `prefix_id:"[61]" is_state:"true"`
	PrefixDAOCoinLimitOrderByOrderID        []byte `prefix_id:"[62]" is_state:"true"`

	// User Association prefixes
	// PrefixUserAssociationByID:
	//  <
	//   PrefixUserAssociationByID
	//   AssociationID [32]byte
	//  > -> < UserAssociationEntry >
	PrefixUserAssociationByID []byte `prefix_id:"[63]" is_state:"true"`
	// PrefixUserAssociationByTransactor:
	//  <
	//   PrefixUserAssociationByTransactor
	//   TransactorPKID [33]byte
	//   AssociationType + NULL TERMINATOR byte
	//   AssociationValue + NULL TERMINATOR byte
	//   TargetUserPKID [33]byte
	//   AppPKID [33]byte
	//  > -> < AssociationID > # note: AssociationID is a BlockHash type
	PrefixUserAssociationByTransactor []byte `prefix_id:"[64]" is_state:"true"`
	// PrefixUserAssociationByUsers:
	//  <
	//   PrefixUserAssociationByUsers
	//   TransactorPKID [33]byte
	//   TargetUserPKID [33]byte
	//   AssociationType + NULL TERMINATOR byte
	//   AssociationValue + NULL TERMINATOR byte
	//   AppPKID [33]byte
	//  > -> < AssociationID > # note: AssociationID is a BlockHash type
	PrefixUserAssociationByTargetUser []byte `prefix_id:"[65]" is_state:"true"`
	// PrefixUserAssociationByTargetUser
	//  <
	//   PrefixUserAssociationByTargerUser
	//   TargetUserPKID [33]byte
	//   AssociationType + NULL TERMINATOR byte
	//   AssociationValue + NULL TERMINATOR byte
	//   TransactorPKID [33]byte
	//   AppPKID [33]byte
	//  > -> < AssociationID > # note: Association is a BlockHash type
	PrefixUserAssociationByUsers []byte `prefix_id:"[66]" is_state:"true"`

	// Post Association prefixes
	// PrefixPostAssociationByID
	//  <
	//   PrefixPostAssociationByID
	//   AssociationID [32]byte
	//  > -> < PostAssociationEntry >
	PrefixPostAssociationByID []byte `prefix_id:"[67]" is_state:"true"`
	// PrefixPostAssociationByTransactor
	//  <
	//   PrefixPostAssociationByTransactor
	//   TransactorPKID [33]byte
	//   AssociationType + NULL TERMINATOR byte
	//   AssociationValue + NULL TERMINATOR byte
	//   PostHash [32]byte
	//   AppPKID [33]byte
	// > -> < AssociationID > # note: AssociationID is a BlockHash type
	PrefixPostAssociationByTransactor []byte `prefix_id:"[68]" is_state:"true"`
	// PrefixPostAssociationByPost
	//  <
	//   PostHash [32]byte
	//   AssociationType + NULL TERMINATOR byte
	//   AssociationValue + NULL TERMINATOR byte
	//   TransactorPKID [33]byte
	//   AppPKID [33]byte
	//  > -> < AssociationID > # note: AssociationID is a BlockHash type
	PrefixPostAssociationByPost []byte `prefix_id:"[69]" is_state:"true"`
	// PrefixPostAssociationByType
	//  <
	//   AssociationType + NULL TERMINATOR byte
	//   AssociationValue + NULL TERMINATOR byte
	//   PostHash [32]byte
	//   TransactorPKID [33]byte
	//   AppPKID [33]byte
	//  > -> < AssociationID > # note: AssociationID is a BlockHash type
	PrefixPostAssociationByType []byte `prefix_id:"[70]" is_state:"true"`

	// Prefix for MessagingGroupEntries indexed by AccessGroupOwnerPublicKey and GroupKeyName:
	//
	// * This index is used to store information about messaging groups. A group is indexed
	//   by the "owner" public key of the user who created the group and the key
	//   name the owner selected when creating the group (can be anything, user-defined).
	//
	// * Groups can have members that all use a shared key to communicate. In this case,
	//   the MessagingGroupEntry will contain the metadata required for each participant to
	//   compute the shared key.
	//
	// * Groups can also consist of a single person, and this is useful for "registering"
	//   a key so that other people can message you. Generally, every user has a default mapping of
	//   the form:
	//   - <AccessGroupOwnerPublicKey, "default-key"> -> AccessGroupEntry
	//   This "singleton" group is used to register a default key so that people can
	//   message this user in the form of traditional DMs. Allowing users to register default keys on-chain in this
	//   way is required to make it so that messages can be decrypted on mobile devices, where apps do not have
	//   easy access to the owner key for decrypting messages.
	//
	// <prefix, AccessGroupOwnerPublicKey [33]byte, GroupKeyName [32]byte> -> <AccessGroupEntry>
	PrefixAccessGroupEntriesByAccessGroupId []byte `prefix_id:"[71]" is_state:"true"`

	// This prefix is used to store all mappings for access group members. The group owner has a
	// special-case mapping with <groupOwnerPk, groupOwnerPk, groupName> and then everybody else has
	// <memberPk, groupOwnerPk, groupName>. We don't need to store members in a group entry anymore since
	// we can just iterate over the members in the group membership index here. This saves us a lot of space
	// and makes it easier to add and remove members from groups.
	//
	// * Note that as mentioned above, there is a special case where AccessGroupMemberPublicKey == AccessGroupOwnerPublicKey.
	//   For this index it was convenient for various reasons to automatically save an entry
	//   with such a key in the db whenever a user registers a group. This becomes clear if
	//   you read all the fetching code around this index. Particularly functions containing
	//   the 'owner' keyword. This is not a bug, it's a feature because we might want an owner to be a member
	//   of their own group for various reasons:
	//   - To be able to read messages sent to the group if the group was created with a derived key.
	//   - To be able to fetch all groups that a user is a member of (including groups that
	//     they own). This is especially useful for allowing the Backend API to fetch all groups for a user.
	//
	// New <GroupMembershipIndex> :
	// <prefix, AccessGroupMemberPublicKey [33]byte, AccessGroupOwnerPublicKey [33]byte, GroupKeyName [32]byte> -> <AccessGroupMemberEntry>
	PrefixAccessGroupMembershipIndex []byte `prefix_id:"[72]" is_state:"true"`

	// Prefix for enumerating all the members of a group. Note that the previous index allows us to
	// answer the question, "what groups is this person a member of?" while this index allows us to
	// answer "who are the members of this particular group?"
	// <prefix, AccessGroupOwnerPublicKey [33]byte, GroupKeyName [32]byte, AccessGroupMemberPublicKey [33]byte>
	//		-> <AccessGroupMemberEnumerationEntry>
	PrefixAccessGroupMemberEnumerationIndex []byte `prefix_id:"[73]" is_state:"true"`

	// PrefixGroupChatMessagesIndex is modified by the NewMessage transaction and is used to store group chat
	// NewMessageEntry objects for each message sent to a group chat. The index has the following structure:
	// 	<prefix, AccessGroupOwnerPublicKey, AccessGroupKeyName, TimestampNanos> -> <NewMessageEntry>
	PrefixGroupChatMessagesIndex []byte `prefix_id:"[74]" is_state:"true"`

	// PrefixDmMessagesIndex is modified by the NewMessage transaction and is used to store NewMessageEntry objects for
	// each message sent to a Dm thread. It answers the question: "Give me all the messages between these two users."
	// The index has the following structure:
	// 	<prefix, MinorAccessGroupOwnerPublicKey, MinorAccessGroupKeyName,
	//		MajorAccessGroupOwnerPublicKey, MajorAccessGroupKeyName, TimestampNanos> -> <NewMessageEntry>
	// The Minor/Major distinction is used to deterministically map the two accessGroupIds of message's sender/recipient
	// into a single pair based on the lexicographical ordering of the two accessGroupIds. This is done to ensure that
	// both sides of the conversation have the same key for the same conversation, and we can store just a single message.
	PrefixDmMessagesIndex []byte `prefix_id:"[75]" is_state:"true"`

	// PrefixDmThreadIndex is modified by the NewMessage transaction and is used to store a DmThreadEntry
	// for each existing dm thread. It answers the question: "Give me all the threads for a particular user."
	// The index has the following structure:
	// 	<prefix, UserAccessGroupOwnerPublicKey, UserAccessGroupKeyName,
	//		PartyAccessGroupOwnerPublicKey, PartyAccessGroupKeyName> -> <DmThreadEntry>
	// It's worth noting that two of these entries are stored for each Dm thread, one being the inverse of the other.
	PrefixDmThreadIndex []byte `prefix_id:"[76]" is_state:"true"`
}

func GetPrefixes

func GetPrefixes() *DBPrefixes

GetPrefixes loads all prefix_id byte array values into a DBPrefixes struct, and returns it.

type DBStatePrefixes

type DBStatePrefixes struct {
	Prefixes *DBPrefixes

	// StatePrefixesMap maps prefixes to whether they are state (true) or non-state (false) prefixes.
	StatePrefixesMap map[byte]bool

	// StatePrefixesList is a list of state prefixes.
	StatePrefixesList [][]byte

	// TxIndexPrefixes is a list of TxIndex prefixes
	TxIndexPrefixes [][]byte
}

DBStatePrefixes is a helper struct that stores information about state-related prefixes.

func GetStatePrefixes

func GetStatePrefixes() *DBStatePrefixes

GetStatePrefixes() creates a DBStatePrefixes object from the DBPrefixes struct and returns it. We parse the prefix_id and is_state tags.

type DbAdapter

type DbAdapter struct {
	// contains filtered or unexported fields
}

func (*DbAdapter) CheckDmThreadExistence added in v3.2.0

func (adapter *DbAdapter) CheckDmThreadExistence(dmThreadKey DmThreadKey) (*DmThreadEntry, error)

CheckDmThreadExistence returns a DmThreadEntry entry for the provided DmThreadKey from db.

func (*DbAdapter) GetAccessGroupEntryByAccessGroupId added in v3.2.0

func (adapter *DbAdapter) GetAccessGroupEntryByAccessGroupId(accessGroupId *AccessGroupId) (*AccessGroupEntry, error)

GetAccessGroupEntryByAccessGroupId returns the AccessGroupEntry for the given AccessGroupId from db.

func (*DbAdapter) GetAccessGroupExistenceByAccessGroupId added in v3.2.0

func (adapter *DbAdapter) GetAccessGroupExistenceByAccessGroupId(accessGroupId *AccessGroupId) (bool, error)

GetAccessGroupExistenceByAccessGroupId returns true if the given AccessGroupId exists in db using optimized key-only lookup.

func (*DbAdapter) GetAccessGroupIdsForMember added in v3.2.0

func (adapter *DbAdapter) GetAccessGroupIdsForMember(memberPublicKey *PublicKey) (_accessGroupIdsMember []*AccessGroupId, _err error)

GetAccessGroupIdsForMember returns all the AccessGroupIds that given memberPublicKey is a member of from db.

func (*DbAdapter) GetAccessGroupIdsForOwner added in v3.2.0

func (adapter *DbAdapter) GetAccessGroupIdsForOwner(ownerPublicKey *PublicKey) (_accessGroupIdsOwned []*AccessGroupId, _err error)

GetAccessGroupIdsForOwner returns all the AccessGroupIds registered by given accessGroupOwnerPublicKey from db.

func (*DbAdapter) GetAccessGroupMemberEntry added in v3.2.0

func (adapter *DbAdapter) GetAccessGroupMemberEntry(accessGroupMemberPublicKey PublicKey,
	accessGroupOwnerPublicKey PublicKey, accessGroupKeyName GroupKeyName) (*AccessGroupMemberEntry, error)

GetAccessGroupMemberEntry returns the AccessGroupMemberEntry for the given accessGroupMemberPublicKey and the group identified by <accessGroupOwnerPublicKey, accessGroupKeyName> from db.

func (*DbAdapter) GetAccessGroupMemberEnumerationEntry added in v3.2.0

func (adapter *DbAdapter) GetAccessGroupMemberEnumerationEntry(accessGroupMemberPublicKey PublicKey,
	accessGroupOwnerPublicKey PublicKey, accessGroupKeyName GroupKeyName) (_exists bool, _err error)

GetAccessGroupMemberEnumerationEntry returns a bool indicating whether the given accessGroupMemberPublicKey is a member of the group identified by <accessGroupOwnerPublicKey, accessGroupKeyName> from db, using optimized key-only lookup.

func (*DbAdapter) GetAllDAOCoinLimitOrders

func (adapter *DbAdapter) GetAllDAOCoinLimitOrders() ([]*DAOCoinLimitOrderEntry, error)

func (*DbAdapter) GetAllDAOCoinLimitOrdersForThisDAOCoinPair

func (adapter *DbAdapter) GetAllDAOCoinLimitOrdersForThisDAOCoinPair(buyingDAOCoinCreatorPKID *PKID, sellingDAOCoinCreatorPKID *PKID) ([]*DAOCoinLimitOrderEntry, error)

func (*DbAdapter) GetAllDAOCoinLimitOrdersForThisTransactor

func (adapter *DbAdapter) GetAllDAOCoinLimitOrdersForThisTransactor(transactorPKID *PKID) ([]*DAOCoinLimitOrderEntry, error)

func (*DbAdapter) GetAllUserDmThreads added in v3.2.0

func (adapter *DbAdapter) GetAllUserDmThreads(userAccessGroupOwnerPublicKey PublicKey) (
	_dmThreadKeys []*DmThreadKey, _err error)

GetAllUserDmThreads returns a list of all the DmThreadKey entries associated with the given userAccessGroupOwnerPublicKey from db.

func (*DbAdapter) GetBalanceEntry

func (adapter *DbAdapter) GetBalanceEntry(holder *PKID, creator *PKID, isDAOCoin bool) *BalanceEntry

func (*DbAdapter) GetDAOCoinLimitOrder

func (adapter *DbAdapter) GetDAOCoinLimitOrder(orderID *BlockHash) (*DAOCoinLimitOrderEntry, error)

func (*DbAdapter) GetDmMessageEntry added in v3.2.0

func (adapter *DbAdapter) GetDmMessageEntry(dmMessageKey DmMessageKey) (*NewMessageEntry, error)

GetDmMessageEntry returns the NewMessageEntry for the given DmMessageKey from db.

func (*DbAdapter) GetGroupChatMessageEntry added in v3.2.0

func (adapter *DbAdapter) GetGroupChatMessageEntry(groupChatMessageKey GroupChatMessageKey) (*NewMessageEntry, error)

GetGroupChatMessageEntry returns the NewMessageEntry for the given GroupChatMessageKey from db.

func (*DbAdapter) GetMatchingDAOCoinLimitOrders

func (adapter *DbAdapter) GetMatchingDAOCoinLimitOrders(inputOrder *DAOCoinLimitOrderEntry, lastSeenOrder *DAOCoinLimitOrderEntry, orderEntriesInView map[DAOCoinLimitOrderMapKey]bool) ([]*DAOCoinLimitOrderEntry, error)

func (*DbAdapter) GetOwnerToDerivedKeyMapping

func (adapter *DbAdapter) GetOwnerToDerivedKeyMapping(ownerPublicKey PublicKey, derivedPublicKey PublicKey) *DerivedKeyEntry

func (*DbAdapter) GetPKIDForPublicKey

func (adapter *DbAdapter) GetPKIDForPublicKey(pkBytes []byte) *PKID

func (*DbAdapter) GetPaginatedAccessGroupMembersEnumerationEntries added in v3.2.0

func (adapter *DbAdapter) GetPaginatedAccessGroupMembersEnumerationEntries(
	accessGroupOwnerPublicKey PublicKey, accessGroupKeyName GroupKeyName,
	startingAccessGroupMemberPublicKeyBytes []byte, maxMembersToFetch uint32) (
	_accessGroupMemberPublicKeys []*PublicKey, _err error)

GetPaginatedAccessGroupMembersEnumerationEntries returns a list of accessGroupMemberPublicKeys that are members of the group identified by <accessGroupOwnerPublicKey, accessGroupKeyName> from db. The list is paginated by the given offset startingGroupMemberPublicKeyBytes, so that each return publicKey is lexicographically greater than the offset. The list is also limited to at most the given length of maxMembersToFetch. Returned public keys will be in lexicographically ascending order.

func (*DbAdapter) GetPaginatedMessageEntriesForDmThread added in v3.2.0

func (adapter *DbAdapter) GetPaginatedMessageEntriesForDmThread(dmThreadKey DmThreadKey, maxTimestamp uint64,
	maxMessagesToFetch uint64) (_messageEntries []*NewMessageEntry, _err error)

GetPaginatedMessageEntriesForDmThread returns a list of NewMessageEntry entries for the given DmThreadKey from db. The list is paginated by the given offset maxTimestamp (exclusive), so that each return message's timestamp is less than the offset. The list is also limited to at most the given length of maxMessagesToFetch. Returned messages will be in descending order by timestamp.

func (*DbAdapter) GetPaginatedMessageEntriesForGroupChatThread added in v3.2.0

func (adapter *DbAdapter) GetPaginatedMessageEntriesForGroupChatThread(groupChatThread AccessGroupId, startingTimestamp uint64,
	maxMessagesToFetch uint64) (_messageEntries []*NewMessageEntry, _err error)

GetPaginatedMessageEntriesForGroupChatThread returns a list of NewMessageEntry entries for the given AccessGroupId from db. The list is paginated by the given offset maxTimestamp (exclusive), so that each return message's timestamp is less than the offset. The list is also limited to at most the given length of maxMessagesToFetch. Returned messages will be in descending order by timestamp.

func (*DbAdapter) GetPostAssociationByAttributes added in v3.2.0

func (adapter *DbAdapter) GetPostAssociationByAttributes(associationEntry *PostAssociationEntry) (*PostAssociationEntry, error)

func (*DbAdapter) GetPostAssociationByID added in v3.2.0

func (adapter *DbAdapter) GetPostAssociationByID(associationID *BlockHash) (*PostAssociationEntry, error)

func (*DbAdapter) GetPostAssociationIdsByAttributes added in v3.2.0

func (adapter *DbAdapter) GetPostAssociationIdsByAttributes(
	associationQuery *PostAssociationQuery, utxoViewAssociationIds *Set[BlockHash],
) (*Set[BlockHash], []byte, error)

func (*DbAdapter) GetPostAssociationsByAttributes added in v3.2.0

func (adapter *DbAdapter) GetPostAssociationsByAttributes(
	associationQuery *PostAssociationQuery, utxoViewAssociationIds *Set[BlockHash],
) ([]*PostAssociationEntry, []byte, error)

func (*DbAdapter) GetUserAssociationByAttributes added in v3.2.0

func (adapter *DbAdapter) GetUserAssociationByAttributes(associationEntry *UserAssociationEntry) (*UserAssociationEntry, error)

func (*DbAdapter) GetUserAssociationByID added in v3.2.0

func (adapter *DbAdapter) GetUserAssociationByID(associationID *BlockHash) (*UserAssociationEntry, error)

func (*DbAdapter) GetUserAssociationIdsByAttributes added in v3.2.0

func (adapter *DbAdapter) GetUserAssociationIdsByAttributes(
	associationQuery *UserAssociationQuery, utxoViewAssociationIds *Set[BlockHash],
) (*Set[BlockHash], []byte, error)

func (*DbAdapter) GetUserAssociationsByAttributes added in v3.2.0

func (adapter *DbAdapter) GetUserAssociationsByAttributes(
	associationQuery *UserAssociationQuery, utxoViewAssociationIds *Set[BlockHash],
) ([]*UserAssociationEntry, []byte, error)

func (*DbAdapter) SortPostAssociationEntriesByPrefix added in v3.2.0

func (adapter *DbAdapter) SortPostAssociationEntriesByPrefix(
	associationEntries []*PostAssociationEntry,
	prefixType []byte,
	sortDescending bool,
) ([]*PostAssociationEntry, error)

func (*DbAdapter) SortUserAssociationEntriesByPrefix added in v3.2.0

func (adapter *DbAdapter) SortUserAssociationEntriesByPrefix(
	associationEntries []*UserAssociationEntry,
	prefixType []byte,
	sortDescending bool,
) ([]*UserAssociationEntry, error)

type DeSoBlockProducer

type DeSoBlockProducer struct {
	// contains filtered or unexported fields
}

func NewDeSoBlockProducer

func NewDeSoBlockProducer(
	minBlockUpdateIntervalSeconds uint64,
	maxBlockTemplatesToCache uint64,
	blockProducerSeed string,
	mempool *DeSoMempool,
	chain *Blockchain,
	params *DeSoParams,
	postgres *Postgres,
) (*DeSoBlockProducer, error)

func (*DeSoBlockProducer) AddBlockTemplate

func (desoBlockProducer *DeSoBlockProducer) AddBlockTemplate(block *MsgDeSoBlock, diffTarget *BlockHash)

func (*DeSoBlockProducer) GetCopyOfRecentBlock

func (desoBlockProducer *DeSoBlockProducer) GetCopyOfRecentBlock(blockID string) (*MsgDeSoBlock, error)

func (*DeSoBlockProducer) GetHeadersAndExtraDatas

func (blockProducer *DeSoBlockProducer) GetHeadersAndExtraDatas(
	publicKeyBytes []byte, numHeaders int64, headerVersion uint32) (
	_blockID string, _headers [][]byte, _extraNonces []uint64, _diffTarget *BlockHash, _err error)

func (*DeSoBlockProducer) GetLatestBlockTemplateStats

func (bbp *DeSoBlockProducer) GetLatestBlockTemplateStats() *BlockTemplateStats

func (*DeSoBlockProducer) GetRecentBlock

func (desoBlockProducer *DeSoBlockProducer) GetRecentBlock(blockHash *BlockHash) *MsgDeSoBlock

func (*DeSoBlockProducer) SignBlock

func (desoBlockProducer *DeSoBlockProducer) SignBlock(blockFound *MsgDeSoBlock) error

func (*DeSoBlockProducer) Start

func (desoBlockProducer *DeSoBlockProducer) Start()

func (*DeSoBlockProducer) Stop

func (desoBlockProducer *DeSoBlockProducer) Stop()

func (*DeSoBlockProducer) UpdateLatestBlockTemplate

func (desoBlockProducer *DeSoBlockProducer) UpdateLatestBlockTemplate() error

type DeSoBodySchema

type DeSoBodySchema struct {
	Body      string   `json:",omitempty"`
	ImageURLs []string `json:",omitempty"`
	VideoURLs []string `json:",omitempty"`
}

DeSoBodySchema Within a post, the body typically has a particular schema defined below.

type DeSoEncoder

type DeSoEncoder interface {
	// RawEncodeWithoutMetadata and RawDecodeWithoutMetadata methods should encode/decode a DeSoEncoder struct into a
	// byte array. The encoding must always be deterministic, and readable by the corresponding RawDecodeWithoutMetadata.
	// We decided to call these methods with terms like: "RawEncode" and "WithoutMetadata" so that these functions sound
	// scary enough to not be directly called. They shouldn't be! EncodeToBytes and DecodeFromBytes wrappers should be
	// used instead. In particular, the implementation shouldn't worry about the DeSoEncoder being nil, nor about encoding
	// the blockHeight. All of this is handled by the wrappers. The blockHeights are passed to the encoder methods to support
	// encoder migrations, which allow upgrading existing badgerDB entries without requiring a resync. Lookup EncoderMigrationHeights
	// for more information on how this works. skipMetadata shouldn't be used directly by the methods; however, it must
	// always be passed if we're nesting EncodeToBytes in the method implementation.
	RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte
	RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

	// GetVersionByte should return the version of the DeSoEncoder as a function of EncoderMigrationHeights and blockHeight.
	// For instance, if we added a new migration at height H and version byte V, we should implement the GetVersionByte
	// method so that V is returned whenever blockHeight >= H.
	GetVersionByte(blockHeight uint64) byte

	// GetEncoderType should return the EncoderType corresponding to the DeSoEncoder.
	GetEncoderType() EncoderType
}

DeSoEncoder is an interface handling our custom, deterministic byte encodings.

func StateKeyToDeSoEncoder

func StateKeyToDeSoEncoder(key []byte) (_isEncoder bool, _encoder DeSoEncoder)

func StatePrefixToDeSoEncoder

func StatePrefixToDeSoEncoder(prefix []byte) (_isEncoder bool, _encoder DeSoEncoder)

StatePrefixToDeSoEncoder maps each state prefix to a DeSoEncoder type that is stored under that prefix. In particular, this is used by the EncoderMigration service, and used to determine how to encode/decode db entries.

type DeSoInput

type DeSoInput UtxoKey

DeSoInput represents a single unspent output from a previous txn. For that reason it specifies the previous txn and the index in that txn where the output appears by simply aliasing UtxoKey.

func NewDeSoInput

func NewDeSoInput() *DeSoInput

func (*DeSoInput) String

func (desoInput *DeSoInput) String() string

type DeSoInputsByTransactor

type DeSoInputsByTransactor struct {
	TransactorPublicKey *PublicKey
	Inputs              []*DeSoInput
}

type DeSoMempool

type DeSoMempool struct {
	// contains filtered or unexported fields
}

DeSoMempool is the core mempool object. It's what any outside service should use to aggregate transactions and mine them into blocks.

func NewDeSoMempool

func NewDeSoMempool(_bc *Blockchain, _rateLimitFeerateNanosPerKB uint64,
	_minFeerateNanosPerKB uint64, _blockCypherAPIKey string,
	_runReadOnlyViewUpdater bool, _dataDir string, _mempoolDumpDir string) *DeSoMempool

Create a new pool with no transactions in it.

func (*DeSoMempool) BlockUntilReadOnlyViewRegenerated

func (mp *DeSoMempool) BlockUntilReadOnlyViewRegenerated()

func (*DeSoMempool) CheckSpend

func (mp *DeSoMempool) CheckSpend(op UtxoKey) *MsgDeSoTxn

func (*DeSoMempool) Count

func (mp *DeSoMempool) Count() int

Returns an estimate of the number of txns in the mempool. This is an estimate because it looks up the number from a readOnly view, which updates at regular intervals and *not* every time a txn is added to the pool.

func (*DeSoMempool) DumpTxnsToDB

func (mp *DeSoMempool) DumpTxnsToDB()

func (*DeSoMempool) FetchTransaction

func (mp *DeSoMempool) FetchTransaction(txHash *BlockHash) *MempoolTx

func (*DeSoMempool) GetAugmentedUniversalView

func (mp *DeSoMempool) GetAugmentedUniversalView() (*UtxoView, error)

GetAugmentedUniversalView creates a view that just connects everything in the mempool... TODO(performance): We should make a read-only version of the universal view that you can get from the mempool.

func (*DeSoMempool) GetAugmentedUtxoViewForPublicKey

func (mp *DeSoMempool) GetAugmentedUtxoViewForPublicKey(pkBytes []byte, optionalTxn *MsgDeSoTxn) (*UtxoView, error)

GetAugmentedUtxoViewForPublicKey creates a UtxoView that has connected all of the transactions that could result in utxos for the passed-in public key plus all of the dependencies of those transactions. This is useful for when we want to validate a transaction that builds on a transaction that has not yet been mined into a block. It is also useful for when we want to fetch all the unspent UtxoEntrys factoring in what's been spent by transactions in the mempool.

func (*DeSoMempool) GetMempoolSummaryStats

func (mp *DeSoMempool) GetMempoolSummaryStats() (_summaryStatsMap map[string]*SummaryStats)

func (*DeSoMempool) GetTransaction

func (mp *DeSoMempool) GetTransaction(txId *BlockHash) (txn *MempoolTx)

func (*DeSoMempool) GetTransactionsOrderedByTimeAdded

func (mp *DeSoMempool) GetTransactionsOrderedByTimeAdded() (_poolTxns []*MempoolTx, _unconnectedTxns []*UnconnectedTx, _err error)

Acquires a read lock before returning the transactions.

func (*DeSoMempool) InefficientRemoveTransaction

func (mp *DeSoMempool) InefficientRemoveTransaction(tx *MsgDeSoTxn)

func (*DeSoMempool) IsTransactionInPool

func (mp *DeSoMempool) IsTransactionInPool(hash *BlockHash) bool

Whether or not a txn is in the pool. Safe for concurrent access.

func (*DeSoMempool) LoadTxnsFromDB

func (mp *DeSoMempool) LoadTxnsFromDB()

func (*DeSoMempool) MempoolTxs

func (mp *DeSoMempool) MempoolTxs() []*MempoolTx

Returns all MempoolTxs from the readOnly view.

func (*DeSoMempool) OpenTempDBAndDumpTxns

func (mp *DeSoMempool) OpenTempDBAndDumpTxns() error

func (*DeSoMempool) ProcessTransaction

func (mp *DeSoMempool) ProcessTransaction(tx *MsgDeSoTxn, allowUnconnectedTxn bool, rateLimit bool, peerID uint64, verifySignatures bool) ([]*MempoolTx, error)

ProcessTransaction is the main function called by outside services to potentially add a transaction to the mempool. It will try to add the txn to the main pool, and then try to add it as an unconnected txn if that fails.

func (*DeSoMempool) ProcessUnconnectedTransactions

func (mp *DeSoMempool) ProcessUnconnectedTransactions(acceptedTx *MsgDeSoTxn, rateLimit bool, verifySignatures bool) []*MempoolTx

ProcessUnconnectedTransactions tries to see if any unconnectedTxns can now be added to the pool.

func (*DeSoMempool) PublicKeyTxnMap

func (mp *DeSoMempool) PublicKeyTxnMap(publicKey []byte) (txnMap map[BlockHash]*MempoolTx)

func (*DeSoMempool) RegenerateReadOnlyView

func (mp *DeSoMempool) RegenerateReadOnlyView() error

func (*DeSoMempool) StartMempoolDBDumper

func (mp *DeSoMempool) StartMempoolDBDumper()

func (*DeSoMempool) StartReadOnlyUtxoViewRegenerator

func (mp *DeSoMempool) StartReadOnlyUtxoViewRegenerator()

func (*DeSoMempool) Stop

func (mp *DeSoMempool) Stop()

func (*DeSoMempool) TryAcceptTransaction

func (mp *DeSoMempool) TryAcceptTransaction(tx *MsgDeSoTxn, rateLimit bool, verifySignatures bool) ([]*BlockHash, *MempoolTx, error)

This is the main function used for adding a new txn to the pool. It will run all needed validation on the txn before adding it, and it will only accept the txn if these validations pass.

The ChainLock must be held for reading calling this function.

func (*DeSoMempool) TxHashes

func (mp *DeSoMempool) TxHashes() []*BlockHash

Returns the hashes of all the txns in the pool using the readOnly view, which could be slightly out of date.

func (*DeSoMempool) UpdateAfterConnectBlock

func (mp *DeSoMempool) UpdateAfterConnectBlock(blk *MsgDeSoBlock) (_txnsAddedToMempool []*MempoolTx)

UpdateAfterConnectBlock updates the mempool after a block has been added to the blockchain. It does this by basically removing all known transactions in the block from the mempool as follows:

  • Build a map of all of the transactions in the block indexed by their hash.
  • Create a new mempool object.
  • Iterate through all the transactions in the mempool and add the transactions to the new pool object *only if* they don't appear in the block. Do this for transactions in the pool and in the unconnectedTx pool.
  • Compute which transactions were newly-accepted into the pool by effectively diffing the new pool's transactions with the old pool's transactions.
  • Once the new pool object is up-to-date, the fields of the new pool object replace the fields of the original pool object.
  • Return the newly added transactions computed earlier.

TODO: This is fairly inefficient but the story is the same as for UpdateAfterDisconnectBlock.

func (*DeSoMempool) UpdateAfterDisconnectBlock

func (mp *DeSoMempool) UpdateAfterDisconnectBlock(blk *MsgDeSoBlock)

UpdateAfterDisconnectBlock updates the mempool to reflect that a block has been disconnected from the blockchain. It does this by basically adding all the transactions in the block back to the mempool as follows:

  • A new pool object is created containing no transactions.
  • The block's transactions are added to this new pool object. This is done in order to minimize dependency-related conflicts with transactions already in the mempool.
  • Then the transactions in the original pool are layered on top of the block's transactions in the new pool object. Again this is done to avoid dependency issues since the ordering of <block txns> followed by <original mempool txns> is much less likely to have issues.
  • Then, once the new pool object is up-to-date, the fields of the new pool object replace the fields of the original pool object.

This function is safe for concurrent access. It is assumed the ChainLock is held before this function is a accessed.

TODO: This is fairly inefficient and basically only necessary because computing a transaction's dependencies is a little shaky. If we end up making the dependency detection logic more robust then we could come back here and change this so that we're not effectively reprocessing the entire mempool every time we have a new block. But until then doing it this way significantly reduces complexity and should hold up for a while.

type DeSoMessage

type DeSoMessage interface {
	// The following methods allow one to convert a message struct into
	// a byte slice and back. Example usage:
	//
	//   params := &DeSoTestnetParams
	//   msgType := MsgTypeVersion
	//   byteSlice := []byte{0x00, ...}
	//
	// 	 msg := NewMessage(msgType)
	//   err := msg.FromBytes(byteSlice)
	//   newByteSlice, err := msg.ToBytes(false)
	//
	// The data format is intended to be compact while allowing for efficient
	// transmission over the wire and storage in a database.
	//
	// The preSignature field specifies whether the message should be fully
	// serialized or whether it should be serialized in such a way that it
	// can be signed (which involves, for example, not serializing signature
	// fields).
	ToBytes(preSignature bool) ([]byte, error)
	FromBytes(data []byte) error

	// Each Message has a particular type.
	GetMsgType() MsgType
}

DeSoMessage is the interface that a message we send on the wire must implement.

func NewMessage

func NewMessage(msgType MsgType) DeSoMessage

func ReadMessage

func ReadMessage(rr io.Reader, networkType NetworkType) (DeSoMessage, []byte, error)

ReadMessage takes an io.Reader and de-serializes a single message from it. Returns an error if the message is malformed or invalid for any reason. Otherwise returns a formed message object and the raw byte payload from which it was derived.

type DeSoMessageMeta

type DeSoMessageMeta struct {
	DeSoMessage DeSoMessage
	Inbound     bool
}

type DeSoMiner

type DeSoMiner struct {
	PublicKeys []*btcec.PublicKey

	BlockProducer *DeSoBlockProducer
	// contains filtered or unexported fields
}

func NewDeSoMiner

func NewDeSoMiner(_minerPublicKeys []string, _numThreads uint32,
	_blockProducer *DeSoBlockProducer, _params *DeSoParams) (*DeSoMiner, error)

func (*DeSoMiner) MineAndProcessSingleBlock

func (desoMiner *DeSoMiner) MineAndProcessSingleBlock(threadIndex uint32, mempoolToUpdate *DeSoMempool) (_block *MsgDeSoBlock, _err error)

func (*DeSoMiner) Start

func (desoMiner *DeSoMiner) Start()

func (*DeSoMiner) Stop

func (desoMiner *DeSoMiner) Stop()

type DeSoNode

type DeSoNode struct {
	// Name of the node, displayed to users
	Name string

	// HTTPs URL to the node or app
	URL string

	// DeSo username of the node owner
	Owner string
}

type DeSoOutput

type DeSoOutput struct {
	// Outputs always compensate a specific public key.
	PublicKey []byte
	// The amount of DeSo to send to this public key.
	AmountNanos uint64
}

func (*DeSoOutput) GetEncoderType

func (desoOutput *DeSoOutput) GetEncoderType() EncoderType

func (*DeSoOutput) GetVersionByte

func (desoOutput *DeSoOutput) GetVersionByte(blockHeight uint64) byte

func (*DeSoOutput) RawDecodeWithoutMetadata

func (desoOutput *DeSoOutput) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*DeSoOutput) RawEncodeWithoutMetadata

func (desoOutput *DeSoOutput) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

func (*DeSoOutput) String

func (desoOutput *DeSoOutput) String() string

type DeSoParams

type DeSoParams struct {
	// The network type (mainnet, testnet, etc).
	NetworkType NetworkType
	// Set to true when we're running in regtest mode. This is useful for testing.
	ExtraRegtestParamUpdaterKeys map[PkMapKey]bool
	// The current protocol version we're running.
	ProtocolVersion uint64
	// The minimum protocol version we'll allow a peer we connect to
	// to have.
	MinProtocolVersion uint64
	// Used as a "vanity plate" to identify different DeSo
	// clients. Mainly useful in analyzing the network at
	// a meta level, not in the protocol itself.
	UserAgent string
	// The list of DNS seed hosts to use during bootstrapping.
	DNSSeeds []string

	// A list of DNS seed prefixes and suffixes to use during bootstrapping.
	// These prefixes and suffixes will be scanned and all IPs found will be
	// incorporated into the address manager.
	DNSSeedGenerators [][]string

	// The network parameter for Bitcoin messages as defined by the btcd library.
	// Useful for certain function calls we make to this library.
	BitcoinBtcdParams *chaincfg.Params

	// Because we use the Bitcoin header chain only to process exchanges from
	// BTC to DeSo, we don't need to worry about Bitcoin blocks before a certain
	// point, which is specified by this node. This is basically used to make
	// header download more efficient but it's important to note that if for
	// some reason there becomes a different main chain that is stronger than
	// this one, then we will still switch to that one even with this parameter
	// set such as it is.
	BitcoinStartBlockNode *BlockNode

	// The base58Check-encoded Bitcoin address that users must send Bitcoin to in order
	// to purchase DeSo. Note that, unfortunately, simply using an all-zeros or
	// mostly-all-zeros address or public key doesn't work and, in fact, I found that
	// using almost any address other than this one also doesn't work.
	BitcoinBurnAddress string

	// This is a fee in basis points charged on BitcoinExchange transactions that gets
	// paid to the miners. Basically, if a user burned enough Satoshi to create 100 DeSo,
	// and if the BitcoinExchangeFeeBasisPoints was 1%, then 99 DeSo would be allocated to
	// the user's public key while 1 DeSo would be left as a transaction fee to the miner.
	BitcoinExchangeFeeBasisPoints uint64

	// The amount of time to wait for a Bitcoin txn to broadcast throughout the Bitcoin
	// network before checking for double-spends.
	BitcoinDoubleSpendWaitSeconds float64

	// This field allows us to set the amount purchased at genesis to a non-zero
	// value.
	DeSoNanosPurchasedAtGenesis uint64

	// Port used for network communications among full nodes.
	DefaultSocketPort uint16
	// Port used for the limited JSON API that supports light clients.
	DefaultJSONPort uint16

	// The amount of time we wait when connecting to a peer.
	DialTimeout time.Duration
	// The amount of time we wait to receive a version message from a peer.
	VersionNegotiationTimeout time.Duration

	// The genesis block to use as the base of our chain.
	GenesisBlock *MsgDeSoBlock
	// The expected hash of the genesis block. Should align with what one
	// would get from actually hashing the provided genesis block.
	GenesisBlockHashHex string
	// How often we target a single block to be generated.
	TimeBetweenBlocks time.Duration
	// How many blocks between difficulty retargets.
	TimeBetweenDifficultyRetargets time.Duration
	// Block hashes, when interpreted as big-endian big integers, must be
	// values less than or equal to the difficulty
	// target. The difficulty target is expressed below as a big-endian
	// big integer and is adjusted every TargetTimePerBlock
	// order to keep blocks generating at consistent intervals.
	MinDifficultyTargetHex string
	// We will reject chains that have less than this amount of total work,
	// expressed as a hexadecimal big-endian bigint. Useful for preventing
	// disk-fill attacks, among other things.
	MinChainWorkHex string

	// This is used for determining whether we are still in initial block download.
	// If our tip is older than this, we continue with IBD.
	MaxTipAge time.Duration

	// Do not allow the difficulty to change by more than a factor of this
	// variable during each adjustment period.
	MaxDifficultyRetargetFactor int64
	// Amount of time one must wait before a block reward can be spent.
	BlockRewardMaturity time.Duration
	// When shifting from v0 blocks to v1 blocks, we changed the hash function to
	// DeSoHash, which is technically easier. Thus we needed to apply an adjustment
	// factor in order to phase it in.
	V1DifficultyAdjustmentFactor int64

	// The maximum number of seconds in a future a block timestamp is allowed
	// to be before it is rejected.
	MaxTstampOffsetSeconds uint64

	// The maximum number of bytes that can be allocated to transactions in
	// a block.
	MaxBlockSizeBytes uint64

	// It's useful to set the miner maximum block size to a little lower than the
	// maximum block size in certain cases. For example, on initial launch, setting
	// it significantly lower is a good way to avoid getting hit by spam blocks.
	MinerMaxBlockSizeBytes uint64

	// In order to make public keys more human-readable, we convert
	// them to base58. When we do that, we use a prefix that makes
	// the public keys to become more identifiable. For example, all
	// mainnet public keys start with "X" because we do this.
	Base58PrefixPublicKey  [3]byte
	Base58PrefixPrivateKey [3]byte

	// MaxFetchBlocks is the maximum number of blocks that can be fetched from
	// a peer at one time.
	MaxFetchBlocks uint32

	MiningIterationsPerCycle uint64

	// deso
	MaxUsernameLengthBytes        uint64
	MaxUserDescriptionLengthBytes uint64
	MaxProfilePicLengthBytes      uint64
	MaxProfilePicDimensions       uint64
	MaxPrivateMessageLengthBytes  uint64
	MaxNewMessageLengthBytes      uint64

	StakeFeeBasisPoints         uint64
	MaxPostBodyLengthBytes      uint64
	MaxPostSubLengthBytes       uint64
	MaxStakeMultipleBasisPoints uint64
	MaxCreatorBasisPoints       uint64
	MaxNFTRoyaltyBasisPoints    uint64

	// A list of transactions to apply when initializing the chain. Useful in
	// cases where we want to hard fork or reboot the chain with specific
	// transactions applied.
	SeedTxns []string

	// A list of balances to initialize the blockchain with. This is useful for
	// testing and useful in the event that the devs need to hard fork the chain.
	SeedBalances []*DeSoOutput

	// This is a small fee charged on creator coin transactions. It helps
	// prevent issues related to floating point calculations.
	CreatorCoinTradeFeeBasisPoints uint64
	// These two params define the "curve" that we use when someone buys/sells
	// creator coins. Effectively, this curve amounts to a polynomial of the form:
	// - currentCreatorCoinPrice ~= slope * currentCreatorCoinSupply^(1/reserveRatio-1)
	// Buys and sells effectively take the integral of the curve in opposite directions.
	//
	// To better understand where this curve comes from and how it works, check out
	// the following links. They are all well written so don't be intimidated/afraid to
	// dig in and read them:
	// - Primer on bonding curves: https://medium.com/@simondlr/tokens-2-0-curved-token-bonding-in-curation-markets-1764a2e0bee5
	// - The Uniswap v2 white paper: https://whitepaper.io/document/600/uniswap-whitepaper
	// - The Bancor white paper: https://whitepaper.io/document/52/bancor-whitepaper
	// - Article relating Bancor curves to polynomial curves: https://medium.com/@aventus/token-bonding-curves-547f3a04914
	// - Derivations of the Bancor supply increase/decrease formulas: https://blog.relevant.community/bonding-curves-in-depth-intuition-parametrization-d3905a681e0a
	// - Implementations of Bancor equations in Solidity with code: https://yos.io/2018/11/10/bonding-curves/
	// - Bancor is flawed blog post discussing Bancor edge cases: https://hackingdistributed.com/2017/06/19/bancor-is-flawed/
	// - A mathematica equation sheet with tests that walks through all the
	//   equations. You will need to copy this into a Mathematica notebook to
	//   run it: https://pastebin.com/raw/M4a1femY
	CreatorCoinSlope        *big.Float
	CreatorCoinReserveRatio *big.Float

	// CreatorCoinAutoSellThresholdNanos defines two things. The first is the minimum amount
	// of creator coins a user must purchase in order for a transaction to be valid. Secondly
	// it defines the point at which a sell operation will auto liquidate all remaining holdings.
	// For example if I hold 1000 nanos of creator coins and sell x nanos such that
	// 1000 - x < CreatorCoinAutoSellThresholdNanos, we auto liquidate the remaining holdings.
	// It does this to prevent issues with floating point rounding that can arise.
	// This value should be chosen such that the chain is resistant to "phantom nanos." Phantom nanos
	// are tiny amounts of CreatorCoinsInCirculation/DeSoLocked which can cause
	// the effective reserve ratio to deviate from the expected reserve ratio of the bancor curve.
	// A higher CreatorCoinAutoSellThresholdNanos makes it prohibitively expensive for someone to
	// attack the bancor curve to any meaningful measure.
	CreatorCoinAutoSellThresholdNanos uint64

	ForkHeights ForkHeights

	EncoderMigrationHeights     *EncoderMigrationHeights
	EncoderMigrationHeightsList []*MigrationHeight
}

DeSoParams defines the full list of possible parameters for the DeSo network.

func (*DeSoParams) EnableRegtest

func (params *DeSoParams) EnableRegtest()

EnableRegtest allows for local development and testing with incredibly fast blocks with block rewards that can be spent as soon as they are mined. It also removes the default testnet seeds

type DeSoSignature

type DeSoSignature struct {
	// Sign stores the main ECDSA signature. We use the btcec crypto package for most of the heavy-lifting.
	Sign *btcec.Signature

	// RecoveryId is the public key recovery id. The RecoveryId is taken from the DeSo-DER signature header magic byte and
	// must be in the [0, 3] range.
	RecoveryId byte
	// IsRecoverable indicates if the original signature contained the public key recovery id.
	IsRecoverable bool
}

DeSoSignature is a wrapper around ECDSA signatures used primarily in the MsgDeSoTxn transaction type.

func SignRecoverable

func SignRecoverable(bb []byte, privateKey *btcec.PrivateKey) (*DeSoSignature, error)

SignRecoverable computes a signature that adds a publicKeyRecoveryID to the first byte of a standard DER signature. We call the combination the DeSo-DER signature.

Overall, it first computes a standard DER signature, and then it adds (0x01 + recoveryID) to the first byte. This makes it so that the first byte will be between [0x31, 0x34] inclusive, instead of being 0x30, which is the standard DER signature magic number.

func (*DeSoSignature) FromBytes

func (desoSign *DeSoSignature) FromBytes(signatureBytes []byte) error

FromBytes parses the signature bytes encoded in accordance to the DeSo-DER ECDSA format.

func (*DeSoSignature) HasHighS added in v3.2.0

func (desoSign *DeSoSignature) HasHighS() bool

HasHighS returns true if the signature has a high S value, which is non-standard

func (*DeSoSignature) RecoverPublicKey

func (desoSign *DeSoSignature) RecoverPublicKey(messageHash []byte) (*btcec.PublicKey, error)

RecoverPublicKey attempts to retrieve the signer's public key from the DeSoSignature given the messageHash sha256x2 digest.

func (*DeSoSignature) SetSignature

func (desoSign *DeSoSignature) SetSignature(sign *btcec.Signature)

func (*DeSoSignature) ToBytes

func (desoSign *DeSoSignature) ToBytes() []byte

ToBytes encodes the signature in accordance to the DeSo-DER ECDSA format. <0x30 + optionally (0x01 + recoveryId)> <length of whole message> <0x02> <length of R> <R> 0x2 <length of S> <S>.

func (*DeSoSignature) Verify

func (desoSign *DeSoSignature) Verify(hash []byte, pubKey *btcec.PublicKey) bool

Verify is a wrapper around DeSoSignature.Sign.Verify.

type DeSoTxnMetadata

type DeSoTxnMetadata interface {
	ToBytes(preSignature bool) ([]byte, error)
	FromBytes(data []byte) error
	New() DeSoTxnMetadata
	GetTxnType() TxnType
}

func NewTxnMetadata

func NewTxnMetadata(txType TxnType) (DeSoTxnMetadata, error)

type DeletePostAssociationMetadata added in v3.2.0

type DeletePostAssociationMetadata struct {
	AssociationID *BlockHash
}

func (*DeletePostAssociationMetadata) FromBytes added in v3.2.0

func (txnData *DeletePostAssociationMetadata) FromBytes(data []byte) error

func (*DeletePostAssociationMetadata) GetTxnType added in v3.2.0

func (txnData *DeletePostAssociationMetadata) GetTxnType() TxnType

func (*DeletePostAssociationMetadata) New added in v3.2.0

func (*DeletePostAssociationMetadata) ToBytes added in v3.2.0

func (txnData *DeletePostAssociationMetadata) ToBytes(preSignature bool) ([]byte, error)

type DeletePostAssociationTxindexMetadata added in v3.2.0

type DeletePostAssociationTxindexMetadata struct {
	AssociationIDHex        string
	PostHashHex             string
	AppPublicKeyBase58Check string
	AssociationType         string
	AssociationValue        string
}

func (*DeletePostAssociationTxindexMetadata) GetEncoderType added in v3.2.0

func (associationTxindexMeta *DeletePostAssociationTxindexMetadata) GetEncoderType() EncoderType

func (*DeletePostAssociationTxindexMetadata) GetVersionByte added in v3.2.0

func (associationTxindexMeta *DeletePostAssociationTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*DeletePostAssociationTxindexMetadata) RawDecodeWithoutMetadata added in v3.2.0

func (associationTxindexMeta *DeletePostAssociationTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*DeletePostAssociationTxindexMetadata) RawEncodeWithoutMetadata added in v3.2.0

func (associationTxindexMeta *DeletePostAssociationTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type DeleteUserAssociationMetadata added in v3.2.0

type DeleteUserAssociationMetadata struct {
	AssociationID *BlockHash
}

func (*DeleteUserAssociationMetadata) FromBytes added in v3.2.0

func (txnData *DeleteUserAssociationMetadata) FromBytes(data []byte) error

func (*DeleteUserAssociationMetadata) GetTxnType added in v3.2.0

func (txnData *DeleteUserAssociationMetadata) GetTxnType() TxnType

func (*DeleteUserAssociationMetadata) New added in v3.2.0

func (*DeleteUserAssociationMetadata) ToBytes added in v3.2.0

func (txnData *DeleteUserAssociationMetadata) ToBytes(preSignature bool) ([]byte, error)

type DeleteUserAssociationTxindexMetadata added in v3.2.0

type DeleteUserAssociationTxindexMetadata struct {
	AssociationIDHex               string
	TargetUserPublicKeyBase58Check string
	AppPublicKeyBase58Check        string
	AssociationType                string
	AssociationValue               string
}

func (*DeleteUserAssociationTxindexMetadata) GetEncoderType added in v3.2.0

func (associationTxindexMeta *DeleteUserAssociationTxindexMetadata) GetEncoderType() EncoderType

func (*DeleteUserAssociationTxindexMetadata) GetVersionByte added in v3.2.0

func (associationTxindexMeta *DeleteUserAssociationTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*DeleteUserAssociationTxindexMetadata) RawDecodeWithoutMetadata added in v3.2.0

func (associationTxindexMeta *DeleteUserAssociationTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*DeleteUserAssociationTxindexMetadata) RawEncodeWithoutMetadata added in v3.2.0

func (associationTxindexMeta *DeleteUserAssociationTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type DerivedKeyEntry

type DerivedKeyEntry struct {
	// Owner public key
	OwnerPublicKey PublicKey

	// Derived public key
	DerivedPublicKey PublicKey

	// Expiration Block
	ExpirationBlock uint64

	// Operation type determines if the derived key is
	// authorized or de-authorized.
	OperationType AuthorizeDerivedKeyOperationType

	ExtraData map[string][]byte

	// Transaction Spending limit Tracker
	TransactionSpendingLimitTracker *TransactionSpendingLimit

	// Memo that tells you what this derived key is for. Should
	// include the name or domain of the app that asked for these
	// permissions so the user can manage it from a centralized UI.
	Memo []byte
	// contains filtered or unexported fields
}

func DBGetAllOwnerToDerivedKeyMappings

func DBGetAllOwnerToDerivedKeyMappings(handle *badger.DB, ownerPublicKey PublicKey) (
	_entries []*DerivedKeyEntry, _err error)

func DBGetOwnerToDerivedKeyMapping

func DBGetOwnerToDerivedKeyMapping(db *badger.DB, snap *Snapshot,
	ownerPublicKey PublicKey, derivedPublicKey PublicKey) *DerivedKeyEntry

func DBGetOwnerToDerivedKeyMappingWithTxn

func DBGetOwnerToDerivedKeyMappingWithTxn(txn *badger.Txn, snap *Snapshot,
	ownerPublicKey PublicKey, derivedPublicKey PublicKey) *DerivedKeyEntry

func (*DerivedKeyEntry) Copy

func (dk *DerivedKeyEntry) Copy() *DerivedKeyEntry

func (*DerivedKeyEntry) GetEncoderType

func (key *DerivedKeyEntry) GetEncoderType() EncoderType

func (*DerivedKeyEntry) GetVersionByte

func (key *DerivedKeyEntry) GetVersionByte(blockHeight uint64) byte

func (*DerivedKeyEntry) IsDeleted

func (key *DerivedKeyEntry) IsDeleted() bool

func (*DerivedKeyEntry) RawDecodeWithoutMetadata

func (key *DerivedKeyEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*DerivedKeyEntry) RawEncodeWithoutMetadata

func (key *DerivedKeyEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type DerivedKeyMapKey

type DerivedKeyMapKey struct {
	// Owner public key
	OwnerPublicKey PublicKey

	// Derived public key
	DerivedPublicKey PublicKey
}

func MakeDerivedKeyMapKey

func MakeDerivedKeyMapKey(ownerPublicKey PublicKey, derivedPublicKey PublicKey) DerivedKeyMapKey

type DiamondEntry

type DiamondEntry struct {
	SenderPKID      *PKID
	ReceiverPKID    *PKID
	DiamondPostHash *BlockHash
	DiamondLevel    int64
	// contains filtered or unexported fields
}

DiamondEntry stores the number of diamonds given by a sender to a post.

func DbGetDiamondEntriesForSenderToReceiver

func DbGetDiamondEntriesForSenderToReceiver(handle *badger.DB, receiverPKID *PKID, senderPKID *PKID) (
	_diamondEntries []*DiamondEntry, _err error)

This function returns a list of DiamondEntrys given by giverPKID to receiverPKID that contain post hashes.

func DbGetDiamondMappings

func DbGetDiamondMappings(db *badger.DB, snap *Snapshot, diamondReceiverPKID *PKID,
	diamondSenderPKID *PKID, diamondPostHash *BlockHash) *DiamondEntry

func DbGetDiamondMappingsWithTxn

func DbGetDiamondMappingsWithTxn(txn *badger.Txn, snap *Snapshot, diamondReceiverPKID *PKID,
	diamondSenderPKID *PKID, diamondPostHash *BlockHash) *DiamondEntry

func (*DiamondEntry) GetEncoderType

func (de *DiamondEntry) GetEncoderType() EncoderType

func (*DiamondEntry) GetVersionByte

func (de *DiamondEntry) GetVersionByte(blockHeight uint64) byte

func (*DiamondEntry) RawDecodeWithoutMetadata

func (de *DiamondEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*DiamondEntry) RawEncodeWithoutMetadata

func (de *DiamondEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type DiamondKey

type DiamondKey struct {
	SenderPKID      PKID
	ReceiverPKID    PKID
	DiamondPostHash BlockHash
}

func MakeDiamondKey

func MakeDiamondKey(senderPKID *PKID, receiverPKID *PKID, diamondPostHash *BlockHash) DiamondKey

func (*DiamondKey) String

func (mm *DiamondKey) String() string

type DmMessageKey added in v3.2.0

type DmMessageKey struct {
	MinorAccessGroupOwnerPublicKey PublicKey
	MinorAccessGroupKeyName        GroupKeyName
	MajorAccessGroupOwnerPublicKey PublicKey
	MajorAccessGroupKeyName        GroupKeyName
	TimestampNanos                 uint64
}

func MakeDmMessageKey added in v3.2.0

func MakeDmMessageKey(xGroupOwnerPublicKey PublicKey, xGroupKeyName GroupKeyName,
	yGroupOwnerPublicKey PublicKey, yGroupKeyName GroupKeyName, tstampNanos uint64) DmMessageKey

func MakeDmMessageKeyForSenderRecipient added in v3.2.0

func MakeDmMessageKeyForSenderRecipient(senderAccessGroupOwnerPublicKey PublicKey, senderAccessGroupKeyName GroupKeyName,
	recipientAccessGroupOwnerPublicKey PublicKey, recipientAccessGroupKeyName GroupKeyName, tstampNanos uint64) DmMessageKey

func MakeDmMessageKeyFromDmThreadKey added in v3.2.0

func MakeDmMessageKeyFromDmThreadKey(dmThreadKey DmThreadKey) DmMessageKey

type DmThreadEntry added in v3.2.0

type DmThreadEntry struct {
	// contains filtered or unexported fields
}

DmThreadEntry

func DBCheckDmThreadExistence added in v3.2.0

func DBCheckDmThreadExistence(db *badger.DB, snap *Snapshot, key DmThreadKey) (*DmThreadEntry, error)

func DBCheckDmThreadExistenceWithTxn added in v3.2.0

func DBCheckDmThreadExistenceWithTxn(txn *badger.Txn, snap *Snapshot, key DmThreadKey) (*DmThreadEntry, error)

func MakeDmThreadEntry added in v3.2.0

func MakeDmThreadEntry() DmThreadEntry

func (*DmThreadEntry) GetEncoderType added in v3.2.0

func (entry *DmThreadEntry) GetEncoderType() EncoderType

func (*DmThreadEntry) GetVersionByte added in v3.2.0

func (entry *DmThreadEntry) GetVersionByte(blockHeight uint64) byte

func (*DmThreadEntry) RawDecodeWithoutMetadata added in v3.2.0

func (entry *DmThreadEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*DmThreadEntry) RawEncodeWithoutMetadata added in v3.2.0

func (entry *DmThreadEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type DmThreadKey added in v3.2.0

type DmThreadKey struct {
	UserAccessGroupOwnerPublicKey  PublicKey
	UserAccessGroupKeyName         GroupKeyName
	PartyAccessGroupOwnerPublicKey PublicKey
	PartyAccessGroupKeyName        GroupKeyName
}

func DBGetAllUserDmThreads added in v3.2.0

func DBGetAllUserDmThreads(db *badger.DB, snap *Snapshot, userGroupOwnerPublicKey PublicKey) ([]*DmThreadKey, error)

func DBGetAllUserDmThreadsByAccessGroupId added in v3.2.0

func DBGetAllUserDmThreadsByAccessGroupId(db *badger.DB, snap *Snapshot,
	userGroupOwnerPublicKey PublicKey, userGroupKeyName GroupKeyName) ([]*DmThreadKey, error)

func DBGetAllUserDmThreadsByAccessGroupIdWithTxn added in v3.2.0

func DBGetAllUserDmThreadsByAccessGroupIdWithTxn(txn *badger.Txn, snap *Snapshot,
	userGroupOwnerPublicKey PublicKey, userGroupKeyName GroupKeyName) ([]*DmThreadKey, error)

func DBGetAllUserDmThreadsWithTxn added in v3.2.0

func DBGetAllUserDmThreadsWithTxn(txn *badger.Txn, snap *Snapshot,
	userGroupOwnerPublicKey PublicKey) ([]*DmThreadKey, error)

func MakeDmThreadKey added in v3.2.0

func MakeDmThreadKey(userGroupOwnerPublicKey PublicKey, userGroupKeyName GroupKeyName,
	partyGroupOwnerPublicKey PublicKey, partyGroupKeyName GroupKeyName) DmThreadKey

func MakeDmThreadKeyFromMessageEntry added in v3.2.0

func MakeDmThreadKeyFromMessageEntry(messageEntry *NewMessageEntry, shouldUseRecipientUser bool) (DmThreadKey, error)

type EncoderMigration

type EncoderMigration struct {
	// contains filtered or unexported fields
}

func (*EncoderMigration) CleanupMigrations

func (migration *EncoderMigration) CleanupMigrations(blockHeight uint64)

func (*EncoderMigration) GetMigrationChecksumAtBlockheight

func (migration *EncoderMigration) GetMigrationChecksumAtBlockheight(blockHeight uint64) *StateChecksum

func (*EncoderMigration) Initialize

func (migration *EncoderMigration) Initialize(mainDb *badger.DB, snapshotDb *badger.DB,
	snapshotDbMutex *sync.Mutex, blockHeight uint64, params *DeSoParams, disabled bool) error

func (*EncoderMigration) InitializeSingleHeight

func (migration *EncoderMigration) InitializeSingleHeight(mainDb *badger.DB, snapshotDb *badger.DB,
	snapshotDbMutex *sync.Mutex, blockHeight uint64, params *DeSoParams)

func (*EncoderMigration) ResetChecksums

func (migration *EncoderMigration) ResetChecksums()

func (*EncoderMigration) SaveMigrations

func (migration *EncoderMigration) SaveMigrations() error

func (*EncoderMigration) StartMigrations

func (migration *EncoderMigration) StartMigrations() error

type EncoderMigrationChecksum

type EncoderMigrationChecksum struct {
	Checksum    *StateChecksum
	BlockHeight uint64

	Version   byte
	Completed bool
}

type EncoderMigrationHeights

type EncoderMigrationHeights struct {
	DefaultMigration MigrationHeight

	// DeSoUnlimitedDerivedKeys coincides with the DeSoUnlimitedDerivedKeysBlockHeight block
	DeSoUnlimitedDerivedKeys MigrationHeight

	// This coincides with the AssociationsAndAccessGroups block
	AssociationsAndAccessGroups MigrationHeight
}

func GetEncoderMigrationHeights

func GetEncoderMigrationHeights(forkHeights *ForkHeights) *EncoderMigrationHeights

type EncoderType

type EncoderType uint32
const (
	EncoderTypeUtxoEntry EncoderType = iota
	EncoderTypeUtxoOperation
	EncoderTypeUtxoOperationBundle
	EncoderTypeMessageEntry
	EncoderTypeGroupKeyName
	EncoderTypeMessagingGroupEntry
	EncoderTypeMessagingGroupMember
	EncoderTypeForbiddenPubKeyEntry
	EncoderTypeLikeEntry
	EncoderTypeNFTEntry
	EncoderTypeNFTBidEntry
	EncoderTypeNFTBidEntryBundle
	EncoderTypeDerivedKeyEntry
	EncoderTypeDiamondEntry
	EncoderTypeRepostEntry
	EncoderTypeGlobalParamsEntry
	EncoderTypePostEntry
	EncoderTypeBalanceEntry
	EncoderTypeCoinEntry
	EncoderTypePublicKeyRoyaltyPair
	EncoderTypePKIDEntry
	EncoderTypeProfileEntry
	EncoderTypeAffectedPublicKey
	EncoderTypeUtxoKey
	EncoderTypeDeSoOutput
	EncoderTypePKID
	EncoderTypePublicKey
	EncoderTypeBlockHash
	EncoderTypeDAOCoinLimitOrderEntry
	EncoderTypeFilledDAOCoinLimitOrder
	EncoderTypeUserAssociationEntry
	EncoderTypePostAssociationEntry
	EncoderTypeAccessGroupEntry
	EncoderTypeAccessGroupMemberEntry
	EncoderTypeGroupMembershipKey
	EncoderTypeNewMessageEntry
	EncoderTypeAccessGroupMemberEnumerationEntry
	EncoderTypeDmThreadEntry

	// EncoderTypeEndBlockView encoder type should be at the end and is used for automated tests.
	EncoderTypeEndBlockView
)

Block view encoder types. These types to different structs implementing the DeSoEncoder interface.

const (
	EncoderTypeTransactionMetadata EncoderType = 1000000 + iota
	EncoderTypeBasicTransferTxindexMetadata
	EncoderTypeBitcoinExchangeTxindexMetadata
	EncoderTypeCreatorCoinTxindexMetadata
	EncoderTypeCreatorCoinTransferTxindexMetadata
	EncoderTypeDAOCoinTransferTxindexMetadata
	EncoderTypeFilledDAOCoinLimitOrderMetadata
	EncoderTypeDAOCoinLimitOrderTxindexMetadata
	EncoderTypeUpdateProfileTxindexMetadata
	EncoderTypeSubmitPostTxindexMetadata
	EncoderTypeLikeTxindexMetadata
	EncoderTypeFollowTxindexMetadata
	EncoderTypePrivateMessageTxindexMetadata
	EncoderTypeSwapIdentityTxindexMetadata
	EncoderTypeNFTRoyaltiesMetadata
	EncoderTypeNFTBidTxindexMetadata
	EncoderTypeAcceptNFTBidTxindexMetadata
	EncoderTypeNFTTransferTxindexMetadata
	EncoderTypeAcceptNFTTransferTxindexMetadata
	EncoderTypeBurnNFTTxindexMetadata
	EncoderTypeDAOCoinTxindexMetadata
	EncoderTypeCreateNFTTxindexMetadata
	EncoderTypeUpdateNFTTxindexMetadata
	EncoderTypeCreateUserAssociationTxindexMetadata
	EncoderTypeDeleteUserAssociationTxindexMetadata
	EncoderTypeCreatePostAssociationTxindexMetadata
	EncoderTypeDeletePostAssociationTxindexMetadata
	EncoderTypeAccessGroupTxindexMetadata
	EncoderTypeAccessGroupMembersTxindexMetadata
	EncoderTypeNewMessageTxindexMetadata

	// EncoderTypeEndTxIndex encoder type should be at the end and is used for automated tests.
	EncoderTypeEndTxIndex
)

Txindex encoder types.

func (EncoderType) New

func (encoderType EncoderType) New() DeSoEncoder

This function translates the EncoderType into an empty DeSoEncoder struct.

type EventManager

type EventManager struct {
	// contains filtered or unexported fields
}

func NewEventManager

func NewEventManager() *EventManager

func (*EventManager) OnBlockAccepted

func (em *EventManager) OnBlockAccepted(handler BlockEventFunc)

func (*EventManager) OnBlockConnected

func (em *EventManager) OnBlockConnected(handler BlockEventFunc)

func (*EventManager) OnBlockDisconnected

func (em *EventManager) OnBlockDisconnected(handler BlockEventFunc)

func (*EventManager) OnSnapshotCompleted

func (em *EventManager) OnSnapshotCompleted(handler SnapshotCompletedEventFunc)

func (*EventManager) OnTransactionConnected

func (em *EventManager) OnTransactionConnected(handler TransactionEventFunc)

type ExpectedResponse

type ExpectedResponse struct {
	TimeExpected time.Time
	MessageType  MsgType
}

ExpectedResponse is a struct used to enforce timeouts on peers. For example, if we send a GetBlocks message, we would expect a response within a given window and disconnect from the Peer if we don't get that response.

type FilledDAOCoinLimitOrder

type FilledDAOCoinLimitOrder struct {
	OrderID                       *BlockHash
	TransactorPKID                *PKID
	BuyingDAOCoinCreatorPKID      *PKID
	SellingDAOCoinCreatorPKID     *PKID
	CoinQuantityInBaseUnitsBought *uint256.Int
	CoinQuantityInBaseUnitsSold   *uint256.Int
	IsFulfilled                   bool
}

FilledDAOCoinLimitOrder only exists to support understanding what orders were fulfilled when connecting a DAO Coin Limit Order Txn

func (*FilledDAOCoinLimitOrder) GetEncoderType

func (order *FilledDAOCoinLimitOrder) GetEncoderType() EncoderType

func (*FilledDAOCoinLimitOrder) GetVersionByte

func (order *FilledDAOCoinLimitOrder) GetVersionByte(blockHeight uint64) byte

func (*FilledDAOCoinLimitOrder) RawDecodeWithoutMetadata

func (order *FilledDAOCoinLimitOrder) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*FilledDAOCoinLimitOrder) RawEncodeWithoutMetadata

func (order *FilledDAOCoinLimitOrder) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type FilledDAOCoinLimitOrderMetadata

type FilledDAOCoinLimitOrderMetadata struct {
	TransactorPublicKeyBase58Check string
	BuyingDAOCoinCreatorPublicKey  string
	SellingDAOCoinCreatorPublicKey string
	CoinQuantityInBaseUnitsBought  *uint256.Int
	CoinQuantityInBaseUnitsSold    *uint256.Int
	IsFulfilled                    bool
}

func (*FilledDAOCoinLimitOrderMetadata) GetEncoderType

func (orderMeta *FilledDAOCoinLimitOrderMetadata) GetEncoderType() EncoderType

func (*FilledDAOCoinLimitOrderMetadata) GetVersionByte

func (orderMeta *FilledDAOCoinLimitOrderMetadata) GetVersionByte(blockHeight uint64) byte

func (*FilledDAOCoinLimitOrderMetadata) RawDecodeWithoutMetadata

func (orderMeta *FilledDAOCoinLimitOrderMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*FilledDAOCoinLimitOrderMetadata) RawEncodeWithoutMetadata

func (orderMeta *FilledDAOCoinLimitOrderMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type FollowEntry

type FollowEntry struct {
	// Note: It's a little redundant to have these in the entry because they're
	// already used as the key in the DB but it doesn't hurt for now.
	FollowerPKID *PKID
	FollowedPKID *PKID
	// contains filtered or unexported fields
}

FollowEntry stores the content of a follow transaction.

func (*FollowEntry) IsDeleted added in v3.2.0

func (fe *FollowEntry) IsDeleted() bool

type FollowKey

type FollowKey struct {
	FollowerPKID PKID
	FollowedPKID PKID
}

func MakeFollowKey

func MakeFollowKey(followerPKID *PKID, followedPKID *PKID) FollowKey

type FollowMetadata

type FollowMetadata struct {

	// The public key to follow.
	FollowedPublicKey []byte

	// Set to true when a user is requesting to unfollow.
	IsUnfollow bool
}

func (*FollowMetadata) FromBytes

func (txnData *FollowMetadata) FromBytes(data []byte) error

func (*FollowMetadata) GetTxnType

func (txnData *FollowMetadata) GetTxnType() TxnType

func (*FollowMetadata) New

func (txnData *FollowMetadata) New() DeSoTxnMetadata

func (*FollowMetadata) ToBytes

func (txnData *FollowMetadata) ToBytes(preSignature bool) ([]byte, error)

type FollowTxindexMetadata

type FollowTxindexMetadata struct {
	IsUnfollow bool
}

func (*FollowTxindexMetadata) GetEncoderType

func (txnMeta *FollowTxindexMetadata) GetEncoderType() EncoderType

func (*FollowTxindexMetadata) GetVersionByte

func (txnMeta *FollowTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*FollowTxindexMetadata) RawDecodeWithoutMetadata

func (txnMeta *FollowTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*FollowTxindexMetadata) RawEncodeWithoutMetadata

func (txnMeta *FollowTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type ForbiddenPubKeyEntry

type ForbiddenPubKeyEntry struct {
	PubKey []byte
	// contains filtered or unexported fields
}

Entry for a public key forbidden from signing blocks.

func (*ForbiddenPubKeyEntry) GetEncoderType

func (entry *ForbiddenPubKeyEntry) GetEncoderType() EncoderType

func (*ForbiddenPubKeyEntry) GetVersionByte

func (entry *ForbiddenPubKeyEntry) GetVersionByte(blockHeight uint64) byte

func (*ForbiddenPubKeyEntry) RawDecodeWithoutMetadata

func (entry *ForbiddenPubKeyEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*ForbiddenPubKeyEntry) RawEncodeWithoutMetadata

func (entry *ForbiddenPubKeyEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type ForkHeights

type ForkHeights struct {

	// A dummy height set to zero by default.
	DefaultHeight uint64

	// The most deflationary event in DeSo history has yet to come...
	DeflationBombBlockHeight uint64

	// SalomonFixBlockHeight defines a block height where the protocol implements
	// two changes:
	// 	(1) The protocol now prints founder reward for all buy transactions instead
	//		of just when creators reach a new all time high.
	//		This was decided in order to provide lasting incentive for creators
	//		to utilize the protocol.
	//	(2) A fix was created to deal with a bug accidentally triggered by @salomon.
	//		After a series of buys and sells @salomon was left with a single creator coin
	//		nano in circulation and a single DeSo nano locked. This caused a detach
	//		between @salomon's bonding curve and others on the protocol. As more buys and sells
	//		continued, @salomon's bonding curve continued to detach further and further from its peers.
	// 		At its core, @salomon had too few creator coins in circulation. This fix introduces
	//		this missing supply back into circulation as well as prevented detached Bancor bonding
	//		curves from coming into existence.
	//		^ It was later decided to leave Salomon's coin circulation alone. A fix was introduced
	//		to prevent similar cases from occurring again, but @salomon is left alone.
	SalomonFixBlockHeight uint32

	// DeSoFounderRewardBlockHeight defines a block height where the protocol switches from
	// paying the founder reward in the founder's own creator coin to paying in DeSo instead.
	DeSoFounderRewardBlockHeight uint32

	// BuyCreatorCoinAfterDeletedBalanceEntryFixBlockHeight defines a block height after which the protocol will create
	// a new BalanceEntry when a user purchases a Creator Coin and their current BalanceEntry is deleted.
	// The situation in which a BalanceEntry reaches a deleted state occurs when a user transfers all their holdings
	// of a certain creator to another public key and subsequently purchases that same creator within the same block.
	// This resolves a bug in which users would purchase creator coins after transferring all holdings within the same
	// block and then the creator coins would be added to a deleted balance.  When the Balance Entries are flushed to
	// the database, the user would lose the creator coins they purchased.
	BuyCreatorCoinAfterDeletedBalanceEntryFixBlockHeight uint32

	// ParamUpdaterProfileUpdateFixBlockHeight defines a block height after which the protocol uses the update profile
	// txMeta's ProfilePublicKey when the Param Updater is creating a profile for ProfilePublicKey.
	ParamUpdaterProfileUpdateFixBlockHeight uint32

	// UpdateProfileFixBlockHeight defines the height at which a patch was added to prevent user from
	// updating the profile entry for arbitrary public keys that do not have existing profile entries.
	UpdateProfileFixBlockHeight uint32

	// BrokenNFTBidsFixBlockHeight defines the height at which the deso balance index takes effect
	// for accepting NFT bids.  This is used to fix a fork that was created by nodes running with a corrupted
	// deso balance index, allowing bids to be submitted that were greater than the user's deso balance.
	BrokenNFTBidsFixBlockHeight uint32

	// DeSoDiamondsBlockHeight defines the height at which diamonds will be given in DESO
	// rather than in creator coin.
	// Triggers: 3pm PT on 8/16/2021
	DeSoDiamondsBlockHeight uint32

	// NFTTransfersBlockHeight defines the height at which NFT transfer txns, accept NFT
	// transfer txns, NFT burn txns, and AuthorizeDerivedKey txns will be accepted.
	// Triggers: 12PM PT on 9/15/2021
	NFTTransferOrBurnAndDerivedKeysBlockHeight uint32

	// DeSoV3MessagesBlockHeight defines the height at which messaging key and messsage party
	// entries will be accepted by consensus.
	DeSoV3MessagesBlockHeight uint32

	// BuyNowAndNFTSplitsBlockHeight defines the height at which NFTs can be sold at a fixed price instead of an
	// auction style and allows splitting of NFT royalties to user's other than the post's creator.
	BuyNowAndNFTSplitsBlockHeight uint32

	// DAOCoinBlockHeight defines the height at which DAO Coin and DAO Coin Transfer
	// transactions will be accepted.
	DAOCoinBlockHeight uint32

	ExtraDataOnEntriesBlockHeight uint32

	// DerivedKeySetSpendingLimitsBlockHeight defines the height at which derived key transactions will have their
	// transaction spending limits in the extra data field parsed.
	DerivedKeySetSpendingLimitsBlockHeight uint32

	// DerivedKeyTrackSpendingLimitsBlockHeight defines the height at which derived key's transaction spending limits
	// will come in effect - accounting of DESO spent and transaction counts will begin at this height. These heights
	// are separated to allow developers time to generate new derived keys for their users. NOTE: this must always
	// be greater than or equal to DerivedKeySetSpendingLimitsBlockHeight.
	DerivedKeyTrackSpendingLimitsBlockHeight uint32

	// DAOCoinLimitOrderBlockHeight defines the height at which DAO Coin Limit Order transactions will be accepted.
	DAOCoinLimitOrderBlockHeight uint32

	// DerivedKeyEthSignatureCompatibilityBlockHeight allows authenticating derived keys that were signed with the Ethereum
	// personal_sign signature standard. This in particular allows the usage of MetaMask for issuing derived keys.
	DerivedKeyEthSignatureCompatibilityBlockHeight uint32

	// OrderBookDBFetchOptimizationBlockHeight implements an optimization around fetching orders from the db.
	OrderBookDBFetchOptimizationBlockHeight uint32

	// ParamUpdaterRefactorBlockHeight indicates a point at which we refactored
	// ParamUpdater to use a blockHeight-gated function rather than a constant.
	ParamUpdaterRefactorBlockHeight uint32

	// DeSoUnlimitedDerivedKeysBlockHeight defines the height at which
	// we introduce derived keys without a spending limit.
	DeSoUnlimitedDerivedKeysBlockHeight uint32

	// AssociationsAndAccessGroupsBlockHeight defines the height at which we introduced:
	//   - Access Groups
	//   - User and Post Associations
	//   - Editable NFT posts
	//   - Frozen posts
	AssociationsAndAccessGroupsBlockHeight uint32

	// AssociationsDerivedKeySpendingLimitBlockHeight defines the height at which we
	// introduced a few improvements for associations' derived key spending limits.
	AssociationsDerivedKeySpendingLimitBlockHeight uint32
}

type GetDataRequestInfo

type GetDataRequestInfo struct {
	PeerWhoSentInv *Peer
	TimeRequested  time.Time
}

GetDataRequestInfo is a data structure used to keep track of which transactions we've requested from a Peer.

type GlobalParamsEntry

type GlobalParamsEntry struct {
	// The new exchange rate to set.
	USDCentsPerBitcoin uint64

	// The new create profile fee
	CreateProfileFeeNanos uint64

	// The fee to create a single NFT (NFTs with n copies incur n of these fees).
	CreateNFTFeeNanos uint64

	// The maximum number of NFT copies that are allowed to be minted.
	MaxCopiesPerNFT uint64

	// The new minimum fee the network will accept
	MinimumNetworkFeeNanosPerKB uint64
}

func DbGetGlobalParamsEntry

func DbGetGlobalParamsEntry(handle *badger.DB, snap *Snapshot) *GlobalParamsEntry

func DbGetGlobalParamsEntryWithTxn

func DbGetGlobalParamsEntryWithTxn(txn *badger.Txn, snap *Snapshot) *GlobalParamsEntry

func (*GlobalParamsEntry) GetEncoderType

func (gp *GlobalParamsEntry) GetEncoderType() EncoderType

func (*GlobalParamsEntry) GetVersionByte

func (gp *GlobalParamsEntry) GetVersionByte(blockHeight uint64) byte

func (*GlobalParamsEntry) RawDecodeWithoutMetadata

func (gp *GlobalParamsEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*GlobalParamsEntry) RawEncodeWithoutMetadata

func (gp *GlobalParamsEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type GroupChatMessageKey added in v3.2.0

type GroupChatMessageKey struct {
	AccessGroupOwnerPublicKey PublicKey
	AccessGroupKeyName        GroupKeyName
	TimestampNanos            uint64
}

func MakeGroupChatMessageKey added in v3.2.0

func MakeGroupChatMessageKey(groupOwnerPublicKey PublicKey, groupKeyName GroupKeyName, tstampNanos uint64) GroupChatMessageKey

type GroupKeyName

GroupKeyName helps with handling key names in AccessGroups

func BaseGroupKeyName

func BaseGroupKeyName() *GroupKeyName

func DefaultGroupKeyName

func DefaultGroupKeyName() *GroupKeyName

func NewGroupKeyName

func NewGroupKeyName(groupKeyName []byte) *GroupKeyName

Encode message key from varying length to a MaxAccessKeyNameCharacters. We fill the length of the access key to make sure there are no weird prefix overlaps in DB.

func (*GroupKeyName) GetEncoderType

func (name *GroupKeyName) GetEncoderType() EncoderType

func (*GroupKeyName) GetVersionByte

func (name *GroupKeyName) GetVersionByte(blockHeight uint64) byte

func (*GroupKeyName) RawDecodeWithoutMetadata

func (name *GroupKeyName) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*GroupKeyName) RawEncodeWithoutMetadata

func (name *GroupKeyName) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

func (*GroupKeyName) ToBytes

func (name *GroupKeyName) ToBytes() []byte

type HelpConnectNFTSoldStruct

type HelpConnectNFTSoldStruct struct {
	NFTPostHash     *BlockHash
	SerialNumber    uint64
	BidderPKID      *PKID
	BidAmountNanos  uint64
	UnlockableText  []byte
	PrevNFTBidEntry *NFTBidEntry

	// When an NFT owner accepts a bid, they must specify the bidder's UTXO inputs they will lock up
	// as payment for the purchase. This prevents the transaction from accidentally using UTXOs
	// that are used by future transactions.
	BidderInputs []*DeSoInput

	BlockHeight      uint32
	Txn              *MsgDeSoTxn
	TxHash           *BlockHash
	VerifySignatures bool
}

type InvType

type InvType uint32

InvType represents the allowed types of inventory vectors. See InvVect.

const (
	InvTypeTx    InvType = 0
	InvTypeBlock InvType = 1
)

These constants define the various supported inventory vector types.

func (InvType) String

func (invtype InvType) String() string

String returns the InvType in human-readable form.

type InvVect

type InvVect struct {
	Type InvType   // Type of data
	Hash BlockHash // Hash of the data
}

InvVect defines an inventory vector which is used to describe data, as specified by the Type field, that a peer wants, has, or does not have to another peer.

func (*InvVect) String

func (invVect *InvVect) String() string

type LikeEntry

type LikeEntry struct {
	LikerPubKey   []byte
	LikedPostHash *BlockHash
	// contains filtered or unexported fields
}

LikeEntry stores the content of a like transaction.

func (*LikeEntry) GetEncoderType

func (likeEntry *LikeEntry) GetEncoderType() EncoderType

func (*LikeEntry) GetVersionByte

func (likeEntry *LikeEntry) GetVersionByte(blockHeight uint64) byte

func (*LikeEntry) RawDecodeWithoutMetadata

func (likeEntry *LikeEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*LikeEntry) RawEncodeWithoutMetadata

func (likeEntry *LikeEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type LikeKey

type LikeKey struct {
	LikerPubKey   PkMapKey
	LikedPostHash BlockHash
}

func MakeLikeKey

func MakeLikeKey(userPk []byte, LikedPostHash BlockHash) LikeKey

type LikeMetadata

type LikeMetadata struct {

	// The post hash to like.
	LikedPostHash *BlockHash

	// Set to true when a user is requesting to unlike a post.
	IsUnlike bool
}

func (*LikeMetadata) FromBytes

func (txnData *LikeMetadata) FromBytes(data []byte) error

func (*LikeMetadata) GetTxnType

func (txnData *LikeMetadata) GetTxnType() TxnType

func (*LikeMetadata) New

func (txnData *LikeMetadata) New() DeSoTxnMetadata

func (*LikeMetadata) ToBytes

func (txnData *LikeMetadata) ToBytes(preSignature bool) ([]byte, error)

type LikeTxindexMetadata

type LikeTxindexMetadata struct {
	// LikerPublicKeyBase58Check = TransactorPublicKeyBase58Check
	IsUnlike bool

	PostHashHex string
}

func (*LikeTxindexMetadata) GetEncoderType

func (txnMeta *LikeTxindexMetadata) GetEncoderType() EncoderType

func (*LikeTxindexMetadata) GetVersionByte

func (txnMeta *LikeTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*LikeTxindexMetadata) RawDecodeWithoutMetadata

func (txnMeta *LikeTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*LikeTxindexMetadata) RawEncodeWithoutMetadata

func (txnMeta *LikeTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type MempoolTx

type MempoolTx struct {
	Tx *MsgDeSoTxn

	// TxMeta is the transaction metadata
	TxMeta *TransactionMetadata

	// Hash is a hash of the transaction so we don't have to recompute
	// it all the time.
	Hash *BlockHash

	// TxSizeBytes is the cached size of the transaction.
	TxSizeBytes uint64

	// The time when the txn was added to the pool
	Added time.Time

	// The block height when the txn was added to the pool. It's generally set
	// to tip+1.
	Height uint32

	// The total fee the txn pays. Cached for efficiency reasons.
	Fee uint64

	// The fee rate of the transaction in nanos per KB.
	FeePerKB uint64
	// contains filtered or unexported fields
}

MempoolTx contains a transaction along with additional metadata like the fee and time added.

func (*MempoolTx) String

func (mempoolTx *MempoolTx) String() string

type MempoolTxFeeMinHeap

type MempoolTxFeeMinHeap []*MempoolTx

MempoolTxFeeMinHeap is a priority queue based on transaction fee rate

func (MempoolTxFeeMinHeap) Len

func (pq MempoolTxFeeMinHeap) Len() int

func (MempoolTxFeeMinHeap) Less

func (pq MempoolTxFeeMinHeap) Less(i, j int) bool

func (*MempoolTxFeeMinHeap) Pop

func (pq *MempoolTxFeeMinHeap) Pop() interface{}

func (*MempoolTxFeeMinHeap) Push

func (pq *MempoolTxFeeMinHeap) Push(x interface{})

func (MempoolTxFeeMinHeap) Swap

func (pq MempoolTxFeeMinHeap) Swap(i, j int)

type MessageEntry

type MessageEntry struct {
	SenderPublicKey    *PublicKey
	RecipientPublicKey *PublicKey
	EncryptedText      []byte
	// TODO: Right now a sender can fake the timestamp and make it appear to
	// the recipient that she sent messages much earlier than she actually did.
	// This isn't a big deal because there is generally not much to gain from
	// faking a timestamp, and it's still impossible for a user to impersonate
	// another user, which is the important thing. Moreover, it is easy to fix
	// the timestamp spoofing issue: You just need to make it so that the nodes
	// index messages based on block height in addition to on the tstamp. The
	// reason I didn't do it yet is because it adds some complexity around
	// detecting duplicates, particularly if a transaction is allowed to have
	// zero inputs/outputs, which is advantageous for various reasons.
	TstampNanos uint64

	// Indicates message encryption method
	// Version = 3 : message encrypted using rotating keys and group chats.
	// Version = 2 : message encrypted using shared secrets
	// Version = 1 : message encrypted using public key
	Version uint8

	// SenderMessagingPublicKey is the sender's messaging public key that was used
	// to encrypt the corresponding message.
	SenderMessagingPublicKey *PublicKey

	// SenderMessagingGroupKeyName is the sender's key name of SenderMessagingPublicKey
	SenderMessagingGroupKeyName *GroupKeyName

	// RecipientMessagingPublicKey is the recipient's messaging public key that was
	// used to encrypt the corresponding message.
	RecipientMessagingPublicKey *PublicKey

	// RecipientMessagingGroupKeyName is the recipient's key name of RecipientMessagingPublicKey
	RecipientMessagingGroupKeyName *GroupKeyName

	// Extra data
	ExtraData map[string][]byte
	// contains filtered or unexported fields
}

MessageEntry stores the essential content of a message transaction.

func DBGetLimitedMessageForMessagingKeys

func DBGetLimitedMessageForMessagingKeys(handle *badger.DB, messagingKeys []*MessagingGroupEntry, limit uint64) (
	_privateMessages []*MessageEntry, _err error)

func DBGetMessageEntriesForPublicKey

func DBGetMessageEntriesForPublicKey(handle *badger.DB, publicKey []byte) (
	_privateMessages []*MessageEntry, _err error)

func DBGetMessageEntry

func DBGetMessageEntry(db *badger.DB, snap *Snapshot,
	publicKey []byte, tstampNanos uint64) *MessageEntry

func DBGetMessageEntryWithTxn

func DBGetMessageEntryWithTxn(txn *badger.Txn, snap *Snapshot,
	publicKey []byte, tstampNanos uint64) *MessageEntry

func (*MessageEntry) GetEncoderType

func (message *MessageEntry) GetEncoderType() EncoderType

func (*MessageEntry) GetVersionByte

func (message *MessageEntry) GetVersionByte(blockHeight uint64) byte

func (*MessageEntry) RawDecodeWithoutMetadata

func (message *MessageEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*MessageEntry) RawEncodeWithoutMetadata

func (message *MessageEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type MessageKey

type MessageKey struct {
	PublicKey   PublicKey
	BlockHeight uint32
	TstampNanos uint64
}

func MakeMessageKey

func MakeMessageKey(pk []byte, tstampNanos uint64) MessageKey

func (*MessageKey) String

func (mm *MessageKey) String() string

func (*MessageKey) StringKey

func (mm *MessageKey) StringKey(params *DeSoParams) string

StringKey is useful for creating maps that need to be serialized to JSON.

type MessagingGroupEntry

type MessagingGroupEntry struct {
	// GroupOwnerPublicKey represents the owner public key of the user who created
	// this group. This key is what is used to index the group metadata in the db.
	GroupOwnerPublicKey *PublicKey

	// MessagingPublicKey is the key others will use to encrypt messages. The
	// GroupOwnerPublicKey is used for indexing, but the MessagingPublicKey is the
	// actual key used to encrypt/decrypt messages.
	MessagingPublicKey *PublicKey

	// MessagingGroupKeyName is the name of the messaging key. This is used to identify
	// the message public key. You can pass any 8-32 character string (byte array).
	// The standard Messages V3 key is named "default-key"
	MessagingGroupKeyName *GroupKeyName

	// MessagingGroupMembers is a list of recipients in a group chat. Messaging keys can have
	// multiple recipients, where the encrypted private key of the messaging public key
	// is given to all group members.
	MessagingGroupMembers []*MessagingGroupMember

	// ExtraData is an arbitrary key value map
	ExtraData map[string][]byte
	// contains filtered or unexported fields
}

AccessGroupEntry is used to update access keys for a user, this was added in the DeSo V3 Messages protocol.

func DBGetAllMessagingGroupEntriesForMemberWithTxn

func DBGetAllMessagingGroupEntriesForMemberWithTxn(txn *badger.Txn, ownerPublicKey *PublicKey) (
	[]*MessagingGroupEntry, error)

func DBGetAllUserGroupEntiresWithTxn

func DBGetAllUserGroupEntiresWithTxn(txn *badger.Txn, ownerPublicKey []byte) ([]*MessagingGroupEntry, error)

func DBGetAllUserGroupEntries

func DBGetAllUserGroupEntries(handle *badger.DB, ownerPublicKey []byte) ([]*MessagingGroupEntry, error)

func DBGetMessagingGroupEntriesForOwnerWithTxn

func DBGetMessagingGroupEntriesForOwnerWithTxn(txn *badger.Txn, ownerPublicKey *PublicKey) (
	_messagingKeyEntries []*MessagingGroupEntry, _err error)

func DBGetMessagingGroupEntry

func DBGetMessagingGroupEntry(db *badger.DB, snap *Snapshot,
	messagingGroupKey *MessagingGroupKey) *MessagingGroupEntry

func DBGetMessagingGroupEntryWithTxn

func DBGetMessagingGroupEntryWithTxn(txn *badger.Txn, snap *Snapshot,
	messagingGroupKey *MessagingGroupKey) *MessagingGroupEntry

func DBGetMessagingGroupMemberWithTxn

func DBGetMessagingGroupMemberWithTxn(txn *badger.Txn, snap *Snapshot, messagingGroupMember *MessagingGroupMember,
	messagingGroupEntry *MessagingGroupEntry) *MessagingGroupEntry

func DBGetMessagingMember

func DBGetMessagingMember(db *badger.DB, snap *Snapshot, messagingMember *MessagingGroupMember,
	messagingGroupEntry *MessagingGroupEntry) *MessagingGroupEntry

func (*MessagingGroupEntry) GetEncoderType

func (entry *MessagingGroupEntry) GetEncoderType() EncoderType

func (*MessagingGroupEntry) GetVersionByte

func (entry *MessagingGroupEntry) GetVersionByte(blockHeight uint64) byte

func (*MessagingGroupEntry) IsDeleted

func (entry *MessagingGroupEntry) IsDeleted() bool

func (*MessagingGroupEntry) RawDecodeWithoutMetadata

func (entry *MessagingGroupEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*MessagingGroupEntry) RawEncodeWithoutMetadata

func (entry *MessagingGroupEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

func (*MessagingGroupEntry) String

func (entry *MessagingGroupEntry) String() string

type MessagingGroupKey

type MessagingGroupKey struct {
	OwnerPublicKey PublicKey
	GroupKeyName   GroupKeyName
}

MessagingGroupKey is similar to the MessageKey, and is used to index messaging keys for a user.

func NewMessagingGroupKey

func NewMessagingGroupKey(ownerPublicKey *PublicKey, groupKeyName []byte) *MessagingGroupKey

func (*MessagingGroupKey) String

func (key *MessagingGroupKey) String() string

type MessagingGroupMember

type MessagingGroupMember struct {
	// GroupMemberPublicKey is the main public key of the group chat member.
	// Importantly, it isn't a messaging public key.
	GroupMemberPublicKey *PublicKey

	// GroupMemberKeyName determines the key of the recipient that the
	// encrypted key is addressed to. We allow adding recipients by their
	// messaging keys. It suffices to specify the recipient's main public key
	// and recipient's messaging key name for the consensus to know how to
	// index the recipient. That's why we don't actually store the messaging
	// public key in the MessagingGroupMember entry.
	GroupMemberKeyName *GroupKeyName

	// EncryptedKey is the encrypted messaging public key, addressed to the recipient.
	EncryptedKey []byte
}

MessagingGroupMember is used to store information about a group chat member.

func (*MessagingGroupMember) FromBytes

func (rec *MessagingGroupMember) FromBytes(rr *bytes.Reader) error

func (*MessagingGroupMember) GetEncoderType

func (rec *MessagingGroupMember) GetEncoderType() EncoderType

func (*MessagingGroupMember) GetVersionByte

func (rec *MessagingGroupMember) GetVersionByte(blockHeight uint64) byte

func (*MessagingGroupMember) RawDecodeWithoutMetadata

func (rec *MessagingGroupMember) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*MessagingGroupMember) RawEncodeWithoutMetadata

func (rec *MessagingGroupMember) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

func (*MessagingGroupMember) ToBytes

func (rec *MessagingGroupMember) ToBytes() []byte

type MessagingGroupMetadata

type MessagingGroupMetadata struct {
	// This struct is very similar to the MessagingGroupEntry type.
	MessagingPublicKey    []byte
	MessagingGroupKeyName []byte
	// This value is the signature of the following using the private key
	// of the AccessGroupOwnerPublicKey (aka txn.PublicKey):
	// - Sha256DoubleHash(MessagingPublicKey || MessagingGroupKeyName)
	//
	// This signature is only required when setting up a group where
	// - MessagingGroupKeyName = "default-key"
	// In this case, we want to make sure that people don't accidentally register
	// this group name with a derived key, and forcing this signature ensures that.
	// The reason is that if someone accidentally registers the default-key with
	// the wrong public key, then they won't be able to receive messages cross-device
	// anymore.
	//
	// This field is not critical and can be removed in the future.
	GroupOwnerSignature []byte

	MessagingGroupMembers []*MessagingGroupMember
}

func (*MessagingGroupMetadata) FromBytes

func (txnData *MessagingGroupMetadata) FromBytes(data []byte) error

func (*MessagingGroupMetadata) GetTxnType

func (txnData *MessagingGroupMetadata) GetTxnType() TxnType

func (*MessagingGroupMetadata) New

func (txnData *MessagingGroupMetadata) New() DeSoTxnMetadata

func (*MessagingGroupMetadata) ToBytes

func (txnData *MessagingGroupMetadata) ToBytes(preSignature bool) ([]byte, error)

type MigrationHeight

type MigrationHeight struct {
	Height  uint64
	Version byte
	Name    MigrationName
}

func GetEncoderMigrationHeightsList

func GetEncoderMigrationHeightsList(forkHeights *ForkHeights) (
	_migrationHeightsList []*MigrationHeight)

type MigrationName

type MigrationName string

MigrationName is used to store migration heights for DeSoEncoder types. To properly migrate a DeSoEncoder, you should:

  1. Typically, encoder migrations should align with hard fork heights. So the first step is to define a new value in ForkHeights, and set the value accordingly for mainnet, testnet, and regtest param structs. Add a name for your migration so that it can be accessed robustly.
  2. Define a new block height in the EncoderMigrationHeights struct. This should map 1:1 with the fork height defined prior.
  3. Add conditional statements to the RawEncode / RawDecodeWithoutMetadata methods that trigger at the defined height.
  4. Add a condition to GetVersionByte to return version associated with the migration height.

So for example, let's say you want to add a migration for UtxoEntry at height 1200.

  1. Add a field to ForkHeight that marks the point at which this entry will come into play: - Add the following to the ForkHeight struct: UtxoEntryTestHeight uint64 - Add the following to the individual param structs (MainnetForkHeights, TestnetForkHeights, and RegtestForkHeights): UtxoEntryTestHeight: 1200 (may differ for mainnet vs testnet & regtest) - Add the migration name below DefaultMigration UtxoEntryTestHeight MigrationName = "UtxoEntryTestHeight"
  1. Add a field to the EncoderMigrationHeights that looks like this: UtxoEntryTestHeight MigrationHeight
  1. Modify func (utxoEntry *UtxoEntry) RawEncode/RawDecodeWithoutMetadata. E.g. add the following condition at the end of RawEncodeWithoutMetadata (note the usage of the MigrationName UtxoEntryTestHeight): if MigrationTriggered(blockHeight, UtxoEntryTestHeight) { data = append(data, byte(127)) } And this at the end of RawDecodeWithoutMetadata: if MigrationTriggered(blockHeight, UtxoEntryTestHeight) { _, err = rr.ReadByte() if err != nil { return errors.Wrapf(err, "UtxoEntry.Decode: Problem reading random byte.") } } MAKE SURE TO WRITE CORRECT CONDITIONS FOR THE HEIGHTS IN BOTH ENCODE AND DECODE!
  1. Modify func (utxo *UtxoEntry) GetVersionByte to return the correct encoding version depending on the height. Use the function GetMigrationVersion to chain encoder migrations (Note the variadic parameter of GetMigrationVersion and the usage of the MigrationName UtxoEntryTestHeight)

    return GetMigrationVersion(blockHeight, UtxoEntryTestHeight)

That's it!

const (
	DefaultMigration                     MigrationName = "DefaultMigration"
	UnlimitedDerivedKeysMigration        MigrationName = "UnlimitedDerivedKeysMigration"
	AssociationsAndAccessGroupsMigration MigrationName = "AssociationsAndAccessGroupsMigration"
)

type MiningSupplyIntervalStart

type MiningSupplyIntervalStart struct {
	StartBlockHeight uint32
	BlockRewardNanos uint64
}

type MsgDeSoAddr

type MsgDeSoAddr struct {
	// The definition of NetAddress as defined by the btcd guys works fine for
	// our purposes. The only difference is that for DeSo nodes, the Service
	// flag in the NetAddress is as we define it above in ServiceFlag.
	// Note that we also rewrite the serialization logic as well to avoid
	// relying on potentially crusty Bitcoin-related work-arounds going forward.
	AddrList []*SingleAddr
}

func (*MsgDeSoAddr) FromBytes

func (msg *MsgDeSoAddr) FromBytes(data []byte) error

func (*MsgDeSoAddr) GetMsgType

func (msg *MsgDeSoAddr) GetMsgType() MsgType

func (*MsgDeSoAddr) String

func (msg *MsgDeSoAddr) String() string

func (*MsgDeSoAddr) ToBytes

func (msg *MsgDeSoAddr) ToBytes(preSignature bool) ([]byte, error)

type MsgDeSoBlock

type MsgDeSoBlock struct {
	Header *MsgDeSoHeader
	Txns   []*MsgDeSoTxn

	// This field is optional and provides the producer of the block the ability to sign it
	// with their private key. Doing this proves that this block was produced by a particular
	// entity, which can be useful for nodes that want to restrict who they accept blocks
	// from.
	BlockProducerInfo *BlockProducerInfo
}

func GetBlock

func GetBlock(blockHash *BlockHash, handle *badger.DB, snap *Snapshot) (*MsgDeSoBlock, error)

func GetBlockWithTxn

func GetBlockWithTxn(txn *badger.Txn, snap *Snapshot, blockHash *BlockHash) *MsgDeSoBlock

func (*MsgDeSoBlock) EncodeBlockCommmon

func (msg *MsgDeSoBlock) EncodeBlockCommmon(preSignature bool) ([]byte, error)

func (*MsgDeSoBlock) EncodeBlockVersion0

func (msg *MsgDeSoBlock) EncodeBlockVersion0(preSignature bool) ([]byte, error)

func (*MsgDeSoBlock) EncodeBlockVersion1

func (msg *MsgDeSoBlock) EncodeBlockVersion1(preSignature bool) ([]byte, error)

func (*MsgDeSoBlock) FromBytes

func (msg *MsgDeSoBlock) FromBytes(data []byte) error

func (*MsgDeSoBlock) GetMsgType

func (msg *MsgDeSoBlock) GetMsgType() MsgType

func (*MsgDeSoBlock) Hash

func (msg *MsgDeSoBlock) Hash() (*BlockHash, error)

func (*MsgDeSoBlock) String

func (msg *MsgDeSoBlock) String() string

func (*MsgDeSoBlock) ToBytes

func (msg *MsgDeSoBlock) ToBytes(preSignature bool) ([]byte, error)

type MsgDeSoDonePeer

type MsgDeSoDonePeer struct {
}

func (*MsgDeSoDonePeer) FromBytes

func (msg *MsgDeSoDonePeer) FromBytes(data []byte) error

func (*MsgDeSoDonePeer) GetMsgType

func (msg *MsgDeSoDonePeer) GetMsgType() MsgType

func (*MsgDeSoDonePeer) ToBytes

func (msg *MsgDeSoDonePeer) ToBytes(preSignature bool) ([]byte, error)

type MsgDeSoGetAddr

type MsgDeSoGetAddr struct {
}

func (*MsgDeSoGetAddr) FromBytes

func (msg *MsgDeSoGetAddr) FromBytes(data []byte) error

func (*MsgDeSoGetAddr) GetMsgType

func (msg *MsgDeSoGetAddr) GetMsgType() MsgType

func (*MsgDeSoGetAddr) ToBytes

func (msg *MsgDeSoGetAddr) ToBytes(preSignature bool) ([]byte, error)

type MsgDeSoGetBlocks

type MsgDeSoGetBlocks struct {
	HashList []*BlockHash
}

func (*MsgDeSoGetBlocks) FromBytes

func (msg *MsgDeSoGetBlocks) FromBytes(data []byte) error

func (*MsgDeSoGetBlocks) GetMsgType

func (msg *MsgDeSoGetBlocks) GetMsgType() MsgType

func (*MsgDeSoGetBlocks) String

func (msg *MsgDeSoGetBlocks) String() string

func (*MsgDeSoGetBlocks) ToBytes

func (msg *MsgDeSoGetBlocks) ToBytes(preSignature bool) ([]byte, error)

type MsgDeSoGetHeaders

type MsgDeSoGetHeaders struct {
	StopHash     *BlockHash
	BlockLocator []*BlockHash
}

func (*MsgDeSoGetHeaders) FromBytes

func (msg *MsgDeSoGetHeaders) FromBytes(data []byte) error

func (*MsgDeSoGetHeaders) GetMsgType

func (msg *MsgDeSoGetHeaders) GetMsgType() MsgType

func (*MsgDeSoGetHeaders) String

func (msg *MsgDeSoGetHeaders) String() string

func (*MsgDeSoGetHeaders) ToBytes

func (msg *MsgDeSoGetHeaders) ToBytes(preSignature bool) ([]byte, error)

type MsgDeSoGetSnapshot

type MsgDeSoGetSnapshot struct {
	// SnapshotStartKey is the db key from which we want to start fetching the data.
	SnapshotStartKey []byte
}

func (*MsgDeSoGetSnapshot) FromBytes

func (msg *MsgDeSoGetSnapshot) FromBytes(data []byte) error

func (*MsgDeSoGetSnapshot) GetMsgType

func (msg *MsgDeSoGetSnapshot) GetMsgType() MsgType

func (*MsgDeSoGetSnapshot) GetPrefix

func (msg *MsgDeSoGetSnapshot) GetPrefix() []byte

func (*MsgDeSoGetSnapshot) ToBytes

func (msg *MsgDeSoGetSnapshot) ToBytes(preSignature bool) ([]byte, error)

type MsgDeSoGetTransactions

type MsgDeSoGetTransactions struct {
	HashList []*BlockHash
}

func (*MsgDeSoGetTransactions) FromBytes

func (msg *MsgDeSoGetTransactions) FromBytes(data []byte) error

func (*MsgDeSoGetTransactions) GetMsgType

func (msg *MsgDeSoGetTransactions) GetMsgType() MsgType

func (*MsgDeSoGetTransactions) String

func (msg *MsgDeSoGetTransactions) String() string

func (*MsgDeSoGetTransactions) ToBytes

func (msg *MsgDeSoGetTransactions) ToBytes(preSignature bool) ([]byte, error)

type MsgDeSoHeader

type MsgDeSoHeader struct {
	// Note this is encoded as a fixed-width uint32 rather than a
	// uvarint or a uint64.
	Version uint32

	// Hash of the previous block in the chain.
	PrevBlockHash *BlockHash

	// The merkle root of all the transactions contained within the block.
	TransactionMerkleRoot *BlockHash

	// The unix timestamp (in seconds) specifying when this block was
	// mined.
	TstampSecs uint64

	// The height of the block this header corresponds to.
	Height uint64

	// The nonce that is used by miners in order to produce valid blocks.
	//
	// Note: Before the upgrade from HeaderVersion0 to HeaderVersion1, miners would make
	// use of ExtraData in the BlockRewardMetadata to get extra nonces. However, this is
	// no longer needed since HeaderVersion1 upgraded the nonce to 64 bits from 32 bits.
	Nonce uint64

	// An extra nonce that can be used to provice *even more* entropy for miners, in the
	// event that ASICs become powerful enough to have birthday problems in the future.
	ExtraNonce uint64
}

MsgDeSoHeader definition.

Note that all of these fields must be encoded as *full* big-endian ints/uints rather than varints. This is because these fields are hashed to produce a block and allowing them to be varints will heavily incentivize miners to keep them short, which corrupts their actual utility.

Additionally note that it's particularly important that headers be space-efficient, since light clients will need to download an entire history of them in order to be able to validate anything.

func DecodeHeader

func DecodeHeader(rr io.Reader) (*MsgDeSoHeader, error)

func DecodeHeaderVersion0

func DecodeHeaderVersion0(rr io.Reader) (*MsgDeSoHeader, error)

func DecodeHeaderVersion1

func DecodeHeaderVersion1(rr io.Reader) (*MsgDeSoHeader, error)

func (*MsgDeSoHeader) EncodeHeaderVersion0

func (msg *MsgDeSoHeader) EncodeHeaderVersion0(preSignature bool) ([]byte, error)

func (*MsgDeSoHeader) EncodeHeaderVersion1

func (msg *MsgDeSoHeader) EncodeHeaderVersion1(preSignature bool) ([]byte, error)

func (*MsgDeSoHeader) FromBytes

func (msg *MsgDeSoHeader) FromBytes(data []byte) error

func (*MsgDeSoHeader) GetMsgType

func (msg *MsgDeSoHeader) GetMsgType() MsgType

func (*MsgDeSoHeader) Hash

func (msg *MsgDeSoHeader) Hash() (*BlockHash, error)

Hash is a helper function to compute a hash of the header. Note that the header hash is special in that we always hash it using the ProofOfWorkHash rather than Sha256DoubleHash.

func (*MsgDeSoHeader) String

func (msg *MsgDeSoHeader) String() string

func (*MsgDeSoHeader) ToBytes

func (msg *MsgDeSoHeader) ToBytes(preSignature bool) ([]byte, error)

type MsgDeSoHeaderBundle

type MsgDeSoHeaderBundle struct {
	Headers   []*MsgDeSoHeader
	TipHash   *BlockHash
	TipHeight uint32
}

func (*MsgDeSoHeaderBundle) FromBytes

func (msg *MsgDeSoHeaderBundle) FromBytes(data []byte) error

func (*MsgDeSoHeaderBundle) GetMsgType

func (msg *MsgDeSoHeaderBundle) GetMsgType() MsgType

func (*MsgDeSoHeaderBundle) String

func (msg *MsgDeSoHeaderBundle) String() string

func (*MsgDeSoHeaderBundle) ToBytes

func (msg *MsgDeSoHeaderBundle) ToBytes(preSignature bool) ([]byte, error)

type MsgDeSoInv

type MsgDeSoInv struct {
	InvList []*InvVect
	// IsSyncResponse indicates that the inv was sent in response to a sync message.
	// This indicates that the node shouldn't relay it to peers because they likely
	// already have it.
	IsSyncResponse bool
}

func (*MsgDeSoInv) FromBytes

func (msg *MsgDeSoInv) FromBytes(data []byte) error

func (*MsgDeSoInv) GetMsgType

func (msg *MsgDeSoInv) GetMsgType() MsgType

func (*MsgDeSoInv) String

func (msg *MsgDeSoInv) String() string

func (*MsgDeSoInv) ToBytes

func (msg *MsgDeSoInv) ToBytes(preSignature bool) ([]byte, error)

type MsgDeSoMempool

type MsgDeSoMempool struct {
}

func (*MsgDeSoMempool) FromBytes

func (msg *MsgDeSoMempool) FromBytes(data []byte) error

func (*MsgDeSoMempool) GetMsgType

func (msg *MsgDeSoMempool) GetMsgType() MsgType

func (*MsgDeSoMempool) String

func (msg *MsgDeSoMempool) String() string

func (*MsgDeSoMempool) ToBytes

func (msg *MsgDeSoMempool) ToBytes(preSignature bool) ([]byte, error)

type MsgDeSoNewPeer

type MsgDeSoNewPeer struct {
}

func (*MsgDeSoNewPeer) FromBytes

func (msg *MsgDeSoNewPeer) FromBytes(data []byte) error

func (*MsgDeSoNewPeer) GetMsgType

func (msg *MsgDeSoNewPeer) GetMsgType() MsgType

func (*MsgDeSoNewPeer) ToBytes

func (msg *MsgDeSoNewPeer) ToBytes(preSignature bool) ([]byte, error)

type MsgDeSoPing

type MsgDeSoPing struct {
	Nonce uint64
}

func (*MsgDeSoPing) FromBytes

func (msg *MsgDeSoPing) FromBytes(data []byte) error

func (*MsgDeSoPing) GetMsgType

func (msg *MsgDeSoPing) GetMsgType() MsgType

func (*MsgDeSoPing) ToBytes

func (msg *MsgDeSoPing) ToBytes(preSignature bool) ([]byte, error)

type MsgDeSoPong

type MsgDeSoPong struct {
	Nonce uint64
}

func (*MsgDeSoPong) FromBytes

func (msg *MsgDeSoPong) FromBytes(data []byte) error

func (*MsgDeSoPong) GetMsgType

func (msg *MsgDeSoPong) GetMsgType() MsgType

func (*MsgDeSoPong) ToBytes

func (msg *MsgDeSoPong) ToBytes(preSignature bool) ([]byte, error)

type MsgDeSoQuit

type MsgDeSoQuit struct {
}

func (*MsgDeSoQuit) FromBytes

func (msg *MsgDeSoQuit) FromBytes(data []byte) error

func (*MsgDeSoQuit) GetMsgType

func (msg *MsgDeSoQuit) GetMsgType() MsgType

func (*MsgDeSoQuit) ToBytes

func (msg *MsgDeSoQuit) ToBytes(preSignature bool) ([]byte, error)

type MsgDeSoSnapshotData

type MsgDeSoSnapshotData struct {
	// SnapshotMetadata is the information about the current snapshot epoch.
	SnapshotMetadata *SnapshotEpochMetadata

	// SnapshotChunk is the snapshot state data chunk.
	SnapshotChunk []*DBEntry
	// SnapshotChunkFull indicates whether we've exhausted all entries for the given prefix.
	// If this is true, it means that there are more entries in node's db, and false means
	// we've fetched everything.
	SnapshotChunkFull bool

	// Prefix indicates the db prefix of the current snapshot chunk.
	Prefix []byte
}

func (*MsgDeSoSnapshotData) FromBytes

func (msg *MsgDeSoSnapshotData) FromBytes(data []byte) error

func (*MsgDeSoSnapshotData) GetMsgType

func (msg *MsgDeSoSnapshotData) GetMsgType() MsgType

func (*MsgDeSoSnapshotData) ToBytes

func (msg *MsgDeSoSnapshotData) ToBytes(preSignature bool) ([]byte, error)

type MsgDeSoTransactionBundle

type MsgDeSoTransactionBundle struct {
	Transactions []*MsgDeSoTxn
}

func (*MsgDeSoTransactionBundle) FromBytes

func (msg *MsgDeSoTransactionBundle) FromBytes(data []byte) error

func (*MsgDeSoTransactionBundle) GetMsgType

func (msg *MsgDeSoTransactionBundle) GetMsgType() MsgType

func (*MsgDeSoTransactionBundle) String

func (msg *MsgDeSoTransactionBundle) String() string

func (*MsgDeSoTransactionBundle) ToBytes

func (msg *MsgDeSoTransactionBundle) ToBytes(preSignature bool) ([]byte, error)

type MsgDeSoTxn

type MsgDeSoTxn struct {
	TxInputs  []*DeSoInput
	TxOutputs []*DeSoOutput

	// DeSoTxnMetadata is an interface type that will give us information on how
	// we should handle the transaction, including what type of transaction this
	// is.
	TxnMeta DeSoTxnMetadata

	// Transactions must generally explicitly include the key that is
	// spending the inputs to the transaction. The exception to this rule is that
	// BlockReward and BitcoinExchange transactions do not require the inclusion
	// of a public key since they have no inputs to spend.
	//
	// The public key should be a serialized compressed ECDSA public key on the
	// secp256k1 curve.
	PublicKey []byte

	// This is typically a JSON field that can be used to add extra information to
	// a transaction without causing a hard fork. It is useful in rare cases where we
	// realize that something needs to be added to a transaction but where we can't
	// afford a hard fork.
	ExtraData map[string][]byte

	// Transactions must generally be signed by the key that is spending the
	// inputs to the transaction. The exception to this rule is that
	// BLOCK_REWARD and CREATE_deso transactions do not require a signature
	// since they have no inputs.
	Signature DeSoSignature

	// (!!) **DO_NOT_USE** (!!)
	//
	// Use txn.TxnMeta.GetTxnType() instead.
	//
	// We need this for JSON encoding/decoding. It isn't used for anything
	// else and it isn't actually serialized or de-serialized when sent
	// across the network using ToBytes/FromBytes because we prefer that
	// any use of the MsgDeSoTxn in Go code rely on TxnMeta.GetTxnType() rather
	// than checking this value, which, in Go context, is redundant and
	// therefore error-prone (e.g. someone might change TxnMeta while
	// forgetting to set it). We make it a uint64 explicitly to prevent
	// people from using it in Go code.
	TxnTypeJSON uint64
}

func DbGetAllMempoolTxnsSortedByTimeAdded

func DbGetAllMempoolTxnsSortedByTimeAdded(handle *badger.DB) (_mempoolTxns []*MsgDeSoTxn, _error error)

func DbGetMempoolTxn

func DbGetMempoolTxn(db *badger.DB, snap *Snapshot, mempoolTx *MempoolTx) *MsgDeSoTxn

func DbGetMempoolTxnWithTxn

func DbGetMempoolTxnWithTxn(txn *badger.Txn, snap *Snapshot, mempoolTx *MempoolTx) *MsgDeSoTxn

func ExtractBitcoinExchangeTransactionsFromBitcoinBlock

func ExtractBitcoinExchangeTransactionsFromBitcoinBlock(
	bitcoinBlock *wire.MsgBlock, burnAddress string, params *DeSoParams) (
	_txns []*MsgDeSoTxn, _err error)

func (*MsgDeSoTxn) Copy

func (msg *MsgDeSoTxn) Copy() (*MsgDeSoTxn, error)

func (*MsgDeSoTxn) FromBytes

func (msg *MsgDeSoTxn) FromBytes(data []byte) error

func (*MsgDeSoTxn) GetMsgType

func (msg *MsgDeSoTxn) GetMsgType() MsgType

func (*MsgDeSoTxn) Hash

func (msg *MsgDeSoTxn) Hash() *BlockHash

Hash is a helper function to compute a hash of the transaction aka a transaction ID.

func (*MsgDeSoTxn) MarshalJSON

func (msg *MsgDeSoTxn) MarshalJSON() ([]byte, error)

MarshalJSON and UnmarshalJSON implement custom JSON marshaling/unmarshaling to support transaction metadata. The reason this needs to exist is because TxnMeta is an abstract interface and therefore when its decoded to JSON, the type information (i.e. which TxnType it is) cannot be inferred from the JSON unless we augment it a little bit. Note this format is not used to relay messages between nodes, only for replying to frontend/user-facing queries.

func (*MsgDeSoTxn) Sign

func (msg *MsgDeSoTxn) Sign(privKey *btcec.PrivateKey) (*btcec.Signature, error)

func (*MsgDeSoTxn) String

func (msg *MsgDeSoTxn) String() string

func (*MsgDeSoTxn) ToBytes

func (msg *MsgDeSoTxn) ToBytes(preSignature bool) ([]byte, error)

func (*MsgDeSoTxn) UnmarshalJSON

func (msg *MsgDeSoTxn) UnmarshalJSON(data []byte) error

UnmarshalJSON is covered by the comment on MarshalJSON.

type MsgDeSoVerack

type MsgDeSoVerack struct {
	// A verack message must contain the nonce the peer received in the
	// initial version message. This ensures the peer that is communicating
	// with us actually controls the address she says she does similar to
	// "SYN Cookie" DDOS protection.
	Nonce uint64
}

VERACK messages have no payload.

func (*MsgDeSoVerack) FromBytes

func (msg *MsgDeSoVerack) FromBytes(data []byte) error

func (*MsgDeSoVerack) GetMsgType

func (msg *MsgDeSoVerack) GetMsgType() MsgType

func (*MsgDeSoVerack) ToBytes

func (msg *MsgDeSoVerack) ToBytes(preSignature bool) ([]byte, error)

type MsgDeSoVersion

type MsgDeSoVersion struct {
	// What is the current version we're on?
	Version uint64

	// What are the services offered by this node?
	Services ServiceFlag

	// The node's unix timestamp that we use to compute a
	// robust "network time" using NTP.
	TstampSecs int64

	// Used to detect when a node connects to itself, which
	// we generally want to prevent.
	Nonce uint64

	// Used as a "vanity plate" to identify different DeSo
	// clients. Mainly useful in analyzing the network at
	// a meta level, not in the protocol itself.
	UserAgent string

	// The height of the last block on the main chain for
	// this node.
	//
	// TODO: We need to update this to uint64
	StartBlockHeight uint32

	// MinFeeRateNanosPerKB is the minimum feerate that a peer will
	// accept from other peers when validating transactions.
	MinFeeRateNanosPerKB uint64
}

func (*MsgDeSoVersion) FromBytes

func (msg *MsgDeSoVersion) FromBytes(data []byte) error

func (*MsgDeSoVersion) GetMsgType

func (msg *MsgDeSoVersion) GetMsgType() MsgType

func (*MsgDeSoVersion) ToBytes

func (msg *MsgDeSoVersion) ToBytes(preSignature bool) ([]byte, error)

type MsgType

type MsgType uint64

The MsgType is usually sent on the wire to indicate what type of struct is being sent in the payload part of the message.

const (
	// ControlMessagesStart is used to indicate the ID value at which control
	// messages start. Anything with an ID value greater than or equal to this
	// is a control message.
	ControlMessagesStart = 1000000

	MsgTypeUnset MsgType = 0
	//
	// The first message a peer sends. Used to negotiate a version
	// between the two peers.
	MsgTypeVersion MsgType = 1
	//
	// Sent after a peer has both sent its version message
	// and received its peer's version message and completed
	// the version negotiation.
	MsgTypeVerack MsgType = 2
	MsgTypeHeader MsgType = 3
	MsgTypeBlock  MsgType = 4
	MsgTypeTxn    MsgType = 5
	// MsgTypeGetHeaders is used to fetch headers from a peer.
	MsgTypeGetHeaders MsgType = 6
	// MsgTypeHeaderBundle contains headers from a peer.
	MsgTypeHeaderBundle    MsgType = 7
	MsgTypePing            MsgType = 8
	MsgTypePong            MsgType = 9
	MsgTypeInv             MsgType = 10
	MsgTypeGetBlocks       MsgType = 11
	MsgTypeGetTransactions MsgType = 12
	// MsgTypeTransactionBundle contains transactions from a peer.
	MsgTypeTransactionBundle MsgType = 13
	MsgTypeMempool           MsgType = 14
	// MsgTypeAddr is used by peers to share addresses of nodes they're aware about
	// with other peers.
	MsgTypeAddr MsgType = 15
	// MsgTypeGetAddr is used to solicit Addr messages from peers.
	MsgTypeGetAddr MsgType = 16

	// MsgTypeGetSnapshot is used to retrieve state from peers.
	MsgTypeGetSnapshot  MsgType = 17
	MsgTypeSnapshotData MsgType = 18

	MsgTypeQuit                 MsgType = ControlMessagesStart
	MsgTypeNewPeer              MsgType = ControlMessagesStart + 1
	MsgTypeDonePeer             MsgType = ControlMessagesStart + 2
	MsgTypeBlockAccepted        MsgType = ControlMessagesStart + 3
	MsgTypeBitcoinManagerUpdate MsgType = ControlMessagesStart + 4 // Deprecated

)

func (MsgType) String

func (msgType MsgType) String() string

type NFTBidEntry

type NFTBidEntry struct {
	BidderPKID     *PKID
	NFTPostHash    *BlockHash
	SerialNumber   uint64
	BidAmountNanos uint64

	AcceptedBlockHeight *uint32
	// contains filtered or unexported fields
}

This struct defines a single bid on an NFT.

func DBGetNFTBidEntries

func DBGetNFTBidEntries(handle *badger.DB, nftPostHash *BlockHash, serialNumber uint64,
) (_nftBidEntries []*NFTBidEntry)

Get NFT bid Entries *from the DB*. Does not include mempool txns.

func DBGetNFTBidEntriesForPKID

func DBGetNFTBidEntriesForPKID(handle *badger.DB, bidderPKID *PKID) (_nftBidEntries []*NFTBidEntry)

func DBGetNFTBidEntriesPaginated

func DBGetNFTBidEntriesPaginated(
	handle *badger.DB,
	nftHash *BlockHash,
	serialNumber uint64,
	startEntry *NFTBidEntry,
	limit int,
	reverse bool,
) (_bidEntries []*NFTBidEntry)

func DBGetNFTBidEntryForNFTBidKey

func DBGetNFTBidEntryForNFTBidKey(db *badger.DB, snap *Snapshot, nftBidKey *NFTBidKey) *NFTBidEntry

func DBGetNFTBidEntryForNFTBidKeyWithTxn

func DBGetNFTBidEntryForNFTBidKeyWithTxn(txn *badger.Txn, snap *Snapshot,
	nftBidKey *NFTBidKey) *NFTBidEntry

func (*NFTBidEntry) Copy

func (nftBidEntry *NFTBidEntry) Copy() *NFTBidEntry

func (*NFTBidEntry) GetEncoderType

func (be *NFTBidEntry) GetEncoderType() EncoderType

func (*NFTBidEntry) GetVersionByte

func (be *NFTBidEntry) GetVersionByte(blockHeight uint64) byte

func (*NFTBidEntry) RawDecodeWithoutMetadata

func (be *NFTBidEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*NFTBidEntry) RawEncodeWithoutMetadata

func (be *NFTBidEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type NFTBidEntryBundle

type NFTBidEntryBundle struct {
	// contains filtered or unexported fields
}

func (*NFTBidEntryBundle) GetEncoderType

func (bundle *NFTBidEntryBundle) GetEncoderType() EncoderType

func (*NFTBidEntryBundle) GetVersionByte

func (bundle *NFTBidEntryBundle) GetVersionByte(blockHeight uint64) byte

func (*NFTBidEntryBundle) RawDecodeWithoutMetadata

func (bundle *NFTBidEntryBundle) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*NFTBidEntryBundle) RawEncodeWithoutMetadata

func (bundle *NFTBidEntryBundle) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type NFTBidKey

type NFTBidKey struct {
	BidderPKID   PKID
	NFTPostHash  BlockHash
	SerialNumber uint64
}

func MakeNFTBidKey

func MakeNFTBidKey(bidderPKID *PKID, nftPostHash *BlockHash, serialNumber uint64) NFTBidKey

type NFTBidMetadata

type NFTBidMetadata struct {
	NFTPostHash    *BlockHash
	SerialNumber   uint64
	BidAmountNanos uint64
}

func (*NFTBidMetadata) FromBytes

func (txnData *NFTBidMetadata) FromBytes(dataa []byte) error

func (*NFTBidMetadata) GetTxnType

func (txnData *NFTBidMetadata) GetTxnType() TxnType

func (*NFTBidMetadata) New

func (txnData *NFTBidMetadata) New() DeSoTxnMetadata

func (*NFTBidMetadata) ToBytes

func (txnData *NFTBidMetadata) ToBytes(preSignature bool) ([]byte, error)

type NFTBidTxindexMetadata

type NFTBidTxindexMetadata struct {
	NFTPostHashHex            string
	SerialNumber              uint64
	BidAmountNanos            uint64
	IsBuyNowBid               bool
	OwnerPublicKeyBase58Check string
	// We omit the empty object here as a bid that doesn't trigger a "buy now" operation will have no royalty metadata
	NFTRoyaltiesMetadata *NFTRoyaltiesMetadata `json:",omitempty"`
}

func (*NFTBidTxindexMetadata) GetEncoderType

func (txnMeta *NFTBidTxindexMetadata) GetEncoderType() EncoderType

func (*NFTBidTxindexMetadata) GetVersionByte

func (txnMeta *NFTBidTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*NFTBidTxindexMetadata) RawDecodeWithoutMetadata

func (txnMeta *NFTBidTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*NFTBidTxindexMetadata) RawEncodeWithoutMetadata

func (txnMeta *NFTBidTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type NFTEntry

type NFTEntry struct {
	LastOwnerPKID              *PKID // This is needed to decrypt unlockable text.
	OwnerPKID                  *PKID
	NFTPostHash                *BlockHash
	SerialNumber               uint64
	IsForSale                  bool
	MinBidAmountNanos          uint64
	UnlockableText             []byte
	LastAcceptedBidAmountNanos uint64

	// If this NFT was transferred to the current owner, it will be pending until accepted.
	IsPending bool

	// If an NFT does not have unlockable content, it can be sold instantly at BuyNowPriceNanos.
	IsBuyNow bool

	// If an NFT is a Buy Now NFT, it can be purchased for this price.
	BuyNowPriceNanos uint64

	ExtraData map[string][]byte
	// contains filtered or unexported fields
}

This struct defines an individual NFT owned by a PKID. An NFT entry maps to a single postEntry, but a single postEntry can map to multiple NFT entries. Each NFT copy is defined by a serial number, which denotes it's place in the set (ie. #1 of 100).

func DBGetNFTEntriesForPKID

func DBGetNFTEntriesForPKID(handle *badger.DB, ownerPKID *PKID) (_nftEntries []*NFTEntry)

DBGetNFTEntriesForPKID gets NFT Entries *from the DB*. Does not include mempool txns.

func DBGetNFTEntriesForPostHash

func DBGetNFTEntriesForPostHash(handle *badger.DB, nftPostHash *BlockHash) (_nftEntries []*NFTEntry)

DBGetNFTEntriesForPostHash gets NFT Entries *from the DB*. Does not include mempool txns.

func DBGetNFTEntryByNFTOwnershipDetails

func DBGetNFTEntryByNFTOwnershipDetails(db *badger.DB, snap *Snapshot, ownerPKID *PKID,
	isForSale bool, bidAmountNanos uint64, postHash *BlockHash, serialNumber uint64) *NFTEntry

func DBGetNFTEntryByNFTOwnershipDetailsWithTxn

func DBGetNFTEntryByNFTOwnershipDetailsWithTxn(txn *badger.Txn, snap *Snapshot, ownerPKID *PKID,
	isForSale bool, bidAmountNanos uint64, postHash *BlockHash, serialNumber uint64) *NFTEntry

func DBGetNFTEntryByPostHashSerialNumber

func DBGetNFTEntryByPostHashSerialNumber(db *badger.DB, snap *Snapshot,
	postHash *BlockHash, serialNumber uint64) *NFTEntry

func DBGetNFTEntryByPostHashSerialNumberWithTxn

func DBGetNFTEntryByPostHashSerialNumberWithTxn(txn *badger.Txn, snap *Snapshot,
	postHash *BlockHash, serialNumber uint64) *NFTEntry

func (*NFTEntry) GetEncoderType

func (nft *NFTEntry) GetEncoderType() EncoderType

func (*NFTEntry) GetVersionByte

func (nft *NFTEntry) GetVersionByte(blockHeight uint64) byte

func (*NFTEntry) RawDecodeWithoutMetadata

func (nft *NFTEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*NFTEntry) RawEncodeWithoutMetadata

func (nft *NFTEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type NFTKey

type NFTKey struct {
	NFTPostHash  BlockHash
	SerialNumber uint64
}

func MakeNFTKey

func MakeNFTKey(nftPostHash *BlockHash, serialNumber uint64) NFTKey

type NFTLimitOperation

type NFTLimitOperation uint8
const (
	AnyNFTOperation            NFTLimitOperation = 0
	UpdateNFTOperation         NFTLimitOperation = 1
	AcceptNFTBidOperation      NFTLimitOperation = 2
	NFTBidOperation            NFTLimitOperation = 3
	TransferNFTOperation       NFTLimitOperation = 4
	BurnNFTOperation           NFTLimitOperation = 5
	AcceptNFTTransferOperation NFTLimitOperation = 6
	UndefinedNFTOperation      NFTLimitOperation = 7
)

func (NFTLimitOperation) IsUndefined

func (nftLimitOperation NFTLimitOperation) IsUndefined() bool

func (NFTLimitOperation) ToNFTLimitOperationString

func (nftLimitOperation NFTLimitOperation) ToNFTLimitOperationString() NFTLimitOperationString

func (NFTLimitOperation) ToString

func (nftLimitOperation NFTLimitOperation) ToString() string

type NFTLimitOperationString

type NFTLimitOperationString string
const (
	AnyNFTOperationString            NFTLimitOperationString = "any"
	UpdateNFTOperationString         NFTLimitOperationString = "update"
	AcceptNFTBidOperationString      NFTLimitOperationString = "accept_nft_bid"
	NFTBidOperationString            NFTLimitOperationString = "nft_bid"
	TransferNFTOperationString       NFTLimitOperationString = "transfer"
	BurnNFTOperationString           NFTLimitOperationString = "burn"
	AcceptNFTTransferOperationString NFTLimitOperationString = "accept_nft_transfer"
	UndefinedNFTOperationString      NFTLimitOperationString = "undefined"
)

func (NFTLimitOperationString) ToNFTLimitOperation

func (nftLimitOperationString NFTLimitOperationString) ToNFTLimitOperation() NFTLimitOperation

type NFTOperationLimitKey

type NFTOperationLimitKey struct {
	BlockHash    BlockHash
	SerialNumber uint64
	Operation    NFTLimitOperation
}

func MakeNFTOperationLimitKey

func MakeNFTOperationLimitKey(blockHash BlockHash, serialNumber uint64, operation NFTLimitOperation) NFTOperationLimitKey

func (*NFTOperationLimitKey) Decode

func (nftOperationLimitKey *NFTOperationLimitKey) Decode(rr *bytes.Reader) error

func (NFTOperationLimitKey) Encode

func (nftOperationLimitKey NFTOperationLimitKey) Encode() []byte

type NFTRoyaltiesMetadata

type NFTRoyaltiesMetadata struct {
	CreatorCoinRoyaltyNanos     uint64
	CreatorRoyaltyNanos         uint64
	CreatorPublicKeyBase58Check string
	// We omit the maps when empty to save some space.
	AdditionalCoinRoyaltiesMap map[string]uint64 `json:",omitempty"`
	AdditionalDESORoyaltiesMap map[string]uint64 `json:",omitempty"`
}

func (*NFTRoyaltiesMetadata) GetEncoderType

func (txnMeta *NFTRoyaltiesMetadata) GetEncoderType() EncoderType

func (*NFTRoyaltiesMetadata) GetVersionByte

func (txnMeta *NFTRoyaltiesMetadata) GetVersionByte(blockHeight uint64) byte

func (*NFTRoyaltiesMetadata) RawDecodeWithoutMetadata

func (txnMeta *NFTRoyaltiesMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*NFTRoyaltiesMetadata) RawEncodeWithoutMetadata

func (txnMeta *NFTRoyaltiesMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type NFTTransferMetadata

type NFTTransferMetadata struct {
	NFTPostHash       *BlockHash
	SerialNumber      uint64
	ReceiverPublicKey []byte
	UnlockableText    []byte
}

func (*NFTTransferMetadata) FromBytes

func (txnData *NFTTransferMetadata) FromBytes(dataa []byte) error

func (*NFTTransferMetadata) GetTxnType

func (txnData *NFTTransferMetadata) GetTxnType() TxnType

func (*NFTTransferMetadata) New

func (txnData *NFTTransferMetadata) New() DeSoTxnMetadata

func (*NFTTransferMetadata) ToBytes

func (txnData *NFTTransferMetadata) ToBytes(preSignature bool) ([]byte, error)

type NFTTransferTxindexMetadata

type NFTTransferTxindexMetadata struct {
	NFTPostHashHex string
	SerialNumber   uint64
}

func (*NFTTransferTxindexMetadata) GetEncoderType

func (txnMeta *NFTTransferTxindexMetadata) GetEncoderType() EncoderType

func (*NFTTransferTxindexMetadata) GetVersionByte

func (txnMeta *NFTTransferTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*NFTTransferTxindexMetadata) RawDecodeWithoutMetadata

func (txnMeta *NFTTransferTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*NFTTransferTxindexMetadata) RawEncodeWithoutMetadata

func (txnMeta *NFTTransferTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type NetworkType

type NetworkType uint64
const (
	// The different network types. For now we have a mainnet and a testnet.
	// Also create an UNSET value to catch errors.
	NetworkType_UNSET   NetworkType = 0
	NetworkType_MAINNET NetworkType = 1
	NetworkType_TESTNET NetworkType = 2
)

func (NetworkType) String

func (nt NetworkType) String() string

type NewMessageEntry added in v3.2.0

type NewMessageEntry struct {

	// Sender
	// SenderAccessGroupOwnerPublicKey is the owner public key of the sender's access group.
	// Messages are sent between two access groups: the sender, and the recipient.
	SenderAccessGroupOwnerPublicKey *PublicKey

	// SenderAccessGroupKeyName is the sender's access group key name
	SenderAccessGroupKeyName *GroupKeyName

	// SenderAccessGroupPublicKey is the sender's access public key that was used
	// to encrypt the corresponding message.
	SenderAccessGroupPublicKey *PublicKey

	// Recipient
	// RecipientAccessGroupOwnerPublicKey is the owner public key of the recipient's access group.
	RecipientAccessGroupOwnerPublicKey *PublicKey

	// RecipientAccessGroupKeyName is the recipient's access group key name
	RecipientAccessGroupKeyName *GroupKeyName

	// RecipientAccessGroupPublicKey is the recipient's access public key that was
	// used to encrypt the corresponding message.
	RecipientAccessGroupPublicKey *PublicKey

	EncryptedText []byte

	// Right now a sender can fake the timestamp and make it appear to
	// the recipient that she sent messages much earlier than she actually did.
	// This isn't a big deal because there is generally not much to gain from
	// faking a timestamp. Messaging apps can just display messages with timestamps
	// smaller than the current time.
	TimestampNanos uint64

	// Extra data
	ExtraData map[string][]byte
	// contains filtered or unexported fields
}

NewMessageEntry stores the essential content of a message transaction.

func DBGetDmMessageEntry added in v3.2.0

func DBGetDmMessageEntry(db *badger.DB, snap *Snapshot, key DmMessageKey) (*NewMessageEntry, error)

func DBGetDmMessageEntryWithTxn added in v3.2.0

func DBGetDmMessageEntryWithTxn(txn *badger.Txn, snap *Snapshot, key DmMessageKey) (*NewMessageEntry, error)

func DBGetGroupChatMessageEntry added in v3.2.0

func DBGetGroupChatMessageEntry(db *badger.DB, snap *Snapshot, key GroupChatMessageKey) (*NewMessageEntry, error)

func DBGetGroupChatMessageEntryWithTxn added in v3.2.0

func DBGetGroupChatMessageEntryWithTxn(txn *badger.Txn, snap *Snapshot, key GroupChatMessageKey) (*NewMessageEntry, error)

func DBGetPaginatedDmMessageEntry added in v3.2.0

func DBGetPaginatedDmMessageEntry(handle *badger.DB, snap *Snapshot,
	dmThreadKey DmThreadKey, maxTimestamp uint64, maxMessagesToFetch uint64) (
	_messageEntries []*NewMessageEntry, _err error)

func DBGetPaginatedDmMessageEntryWithTxn added in v3.2.0

func DBGetPaginatedDmMessageEntryWithTxn(txn *badger.Txn, snap *Snapshot,
	dmThreadKey DmThreadKey, maxTimestamp uint64, maxMessagesToFetch uint64) (
	_messageEntries []*NewMessageEntry, _err error)

func DBGetPaginatedGroupChatMessageEntry added in v3.2.0

func DBGetPaginatedGroupChatMessageEntry(handle *badger.DB, snap *Snapshot,
	groupChatThreadKey AccessGroupId, startingTimestamp uint64, maxMessagesToFetch uint64) (
	_messageEntries []*NewMessageEntry, _err error)

func DBGetPaginatedGroupChatMessageEntryWithTxn added in v3.2.0

func DBGetPaginatedGroupChatMessageEntryWithTxn(txn *badger.Txn, snap *Snapshot,
	groupChatThreadKey AccessGroupId, startingTimestamp uint64, maxMessagesToFetch uint64) (
	_messageEntries []*NewMessageEntry, _err error)

func (*NewMessageEntry) GetEncoderType added in v3.2.0

func (message *NewMessageEntry) GetEncoderType() EncoderType

func (*NewMessageEntry) GetVersionByte added in v3.2.0

func (message *NewMessageEntry) GetVersionByte(blockHeight uint64) byte

func (*NewMessageEntry) RawDecodeWithoutMetadata added in v3.2.0

func (message *NewMessageEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*NewMessageEntry) RawEncodeWithoutMetadata added in v3.2.0

func (message *NewMessageEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type NewMessageMetadata added in v3.2.0

type NewMessageMetadata struct {
	SenderAccessGroupOwnerPublicKey    PublicKey
	SenderAccessGroupKeyName           GroupKeyName
	SenderAccessGroupPublicKey         PublicKey
	RecipientAccessGroupOwnerPublicKey PublicKey
	RecipientAccessGroupKeyName        GroupKeyName
	RecipientAccessGroupPublicKey      PublicKey
	EncryptedText                      []byte
	TimestampNanos                     uint64
	// TODO: Add operation type create/update
	NewMessageType
	NewMessageOperation
}

func (*NewMessageMetadata) FromBytes added in v3.2.0

func (txnData *NewMessageMetadata) FromBytes(data []byte) error

func (*NewMessageMetadata) GetTxnType added in v3.2.0

func (txnData *NewMessageMetadata) GetTxnType() TxnType

func (*NewMessageMetadata) New added in v3.2.0

func (txnData *NewMessageMetadata) New() DeSoTxnMetadata

func (*NewMessageMetadata) ToBytes added in v3.2.0

func (txnData *NewMessageMetadata) ToBytes(preSignature bool) ([]byte, error)

type NewMessageOperation added in v3.2.0

type NewMessageOperation byte

type NewMessageTxindexMetadata added in v3.2.0

type NewMessageTxindexMetadata struct {
	SenderAccessGroupOwnerPublicKey    PublicKey
	SenderAccessGroupKeyName           GroupKeyName
	RecipientAccessGroupOwnerPublicKey PublicKey
	RecipientAccessGroupKeyName        GroupKeyName
	TimestampNanos                     uint64
	NewMessageType
	NewMessageOperation
}

func (*NewMessageTxindexMetadata) GetEncoderType added in v3.2.0

func (newMessageTxindexMetadata *NewMessageTxindexMetadata) GetEncoderType() EncoderType

func (*NewMessageTxindexMetadata) GetVersionByte added in v3.2.0

func (newMessageTxindexMetadata *NewMessageTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*NewMessageTxindexMetadata) RawDecodeWithoutMetadata added in v3.2.0

func (newMessageTxindexMetadata *NewMessageTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*NewMessageTxindexMetadata) RawEncodeWithoutMetadata added in v3.2.0

func (newMessageTxindexMetadata *NewMessageTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type NewMessageType added in v3.2.0

type NewMessageType byte

type NodeMessage

type NodeMessage uint32
const (
	NodeRestart NodeMessage = iota
	NodeErase
)

type NodeSyncType

type NodeSyncType string

type NotificationType

type NotificationType uint8
const (
	NotificationUnknown NotificationType = iota
	NotificationSendDESO
	NotificationLike
	NotificationFollow
	NotificationCoinPurchase
	NotificationCoinTransfer
	NotificationCoinDiamond
	NotificationPostMention
	NotificationPostReply
	NotificationPostRepost
	NotificationDESODiamond
)

type Notifier

type Notifier struct {
	// contains filtered or unexported fields
}

func NewNotifier

func NewNotifier(coreChain *Blockchain, postgres *Postgres) *Notifier

func (*Notifier) Start

func (notifier *Notifier) Start()

func (*Notifier) Update

func (notifier *Notifier) Update() error

type OperationType

type OperationType uint
const (
	// Every operation has a type that we document here. This information is
	// used when rolling back a txn to determine what kind of operations need
	// to be performed. For example, rolling back a BitcoinExchange may require
	// rolling back an AddUtxo operation.
	OperationTypeAddUtxo                      OperationType = 0
	OperationTypeSpendUtxo                    OperationType = 1
	OperationTypeBitcoinExchange              OperationType = 2
	OperationTypePrivateMessage               OperationType = 3
	OperationTypeSubmitPost                   OperationType = 4
	OperationTypeUpdateProfile                OperationType = 5
	OperationTypeDeletePost                   OperationType = 7
	OperationTypeUpdateBitcoinUSDExchangeRate OperationType = 8
	OperationTypeFollow                       OperationType = 9
	OperationTypeLike                         OperationType = 10
	OperationTypeCreatorCoin                  OperationType = 11
	OperationTypeSwapIdentity                 OperationType = 12
	OperationTypeUpdateGlobalParams           OperationType = 13
	OperationTypeCreatorCoinTransfer          OperationType = 14
	OperationTypeCreateNFT                    OperationType = 15
	OperationTypeUpdateNFT                    OperationType = 16
	OperationTypeAcceptNFTBid                 OperationType = 17
	OperationTypeNFTBid                       OperationType = 18
	OperationTypeDeSoDiamond                  OperationType = 19
	OperationTypeNFTTransfer                  OperationType = 20
	OperationTypeAcceptNFTTransfer            OperationType = 21
	OperationTypeBurnNFT                      OperationType = 22
	OperationTypeAuthorizeDerivedKey          OperationType = 23
	OperationTypeMessagingKey                 OperationType = 24
	OperationTypeDAOCoin                      OperationType = 25
	OperationTypeDAOCoinTransfer              OperationType = 26
	OperationTypeSpendingLimitAccounting      OperationType = 27
	OperationTypeDAOCoinLimitOrder            OperationType = 28
	OperationTypeCreateUserAssociation        OperationType = 29
	OperationTypeDeleteUserAssociation        OperationType = 30
	OperationTypeCreatePostAssociation        OperationType = 31
	OperationTypeDeletePostAssociation        OperationType = 32
	OperationTypeAccessGroup                  OperationType = 33
	OperationTypeAccessGroupMembers           OperationType = 34
	OperationTypeNewMessage                   OperationType = 35
)

func (OperationType) String

func (op OperationType) String() string

type OrphanBlock

type OrphanBlock struct {
	Block *MsgDeSoBlock
	Hash  *BlockHash
}

type PGAccessGroupEntry added in v3.2.0

type PGAccessGroupEntry struct {
	AccessGroupOwnerPublicKey *PublicKey    `pg:",pk,type:bytea"`
	AccessGroupKeyName        *GroupKeyName `pg:",pk,type:bytea"`
	AccessGroupPublicKey      *PublicKey    `pg:",type:bytea"`

	ExtraData map[string][]byte
	// contains filtered or unexported fields
}

func (*PGAccessGroupEntry) FromAccessGroupEntry added in v3.2.0

func (accessGroup *PGAccessGroupEntry) FromAccessGroupEntry(accessGroupEntry *AccessGroupEntry)

func (*PGAccessGroupEntry) ToAccessGroupEntry added in v3.2.0

func (accessGroup *PGAccessGroupEntry) ToAccessGroupEntry() *AccessGroupEntry

type PGAccessGroupMemberEntry added in v3.2.0

type PGAccessGroupMemberEntry struct {
	AccessGroupMemberPublicKey *PublicKey    `pg:",pk,type:bytea"`
	AccessGroupMemberKeyName   *GroupKeyName `pg:",type:bytea"`
	AccessGroupOwnerPublicKey  *PublicKey    `pg:",pk,type:bytea"`
	AccessGroupKeyName         *GroupKeyName `pg:",pk,type:bytea"`
	EncryptedKey               []byte        `pg:",type:bytea"`

	ExtraData map[string][]byte
	// contains filtered or unexported fields
}

func (*PGAccessGroupMemberEntry) FromAccessGroupMemberEntry added in v3.2.0

func (accessGroupMember *PGAccessGroupMemberEntry) FromAccessGroupMemberEntry(accessGroupOwnerPublicKey PublicKey,
	accessGroupKeyName GroupKeyName, accessGroupMemberEntry *AccessGroupMemberEntry)

func (*PGAccessGroupMemberEntry) ToAccessGroupMemberEntry added in v3.2.0

func (accessGroupMember *PGAccessGroupMemberEntry) ToAccessGroupMemberEntry() (
	_accessGroupOwnerPublicKey *PublicKey, _accessGroupKeyName *GroupKeyName, _accessGroupMemberEntry *AccessGroupMemberEntry)

type PGAccessGroupMemberEnumerationEntry added in v3.2.0

type PGAccessGroupMemberEnumerationEntry struct {
	AccessGroupMemberPublicKey *PublicKey    `pg:",pk,type:bytea"`
	AccessGroupOwnerPublicKey  *PublicKey    `pg:",pk,type:bytea"`
	AccessGroupKeyName         *GroupKeyName `pg:",pk,type:bytea"`
	// contains filtered or unexported fields
}

type PGBalance

type PGBalance struct {
	PublicKey    *PublicKey `pg:",pk,type:bytea"`
	BalanceNanos uint64     `pg:",use_zero"`
	// contains filtered or unexported fields
}

PGBalance represents PublicKeyToDeSoBalanceNanos

type PGBlock

type PGBlock struct {

	// BlockNode and MsgDeSoHeader
	Hash       *BlockHash `pg:",pk,type:bytea"`
	ParentHash *BlockHash `pg:",type:bytea"`
	Height     uint64     `pg:",use_zero"`

	// BlockNode
	DifficultyTarget *BlockHash  `pg:",type:bytea"`
	CumWork          *BlockHash  `pg:",type:bytea"`
	Status           BlockStatus `pg:",use_zero"` // TODO: Refactor

	// MsgDeSoHeader
	TxMerkleRoot *BlockHash `pg:",type:bytea"`
	Version      uint32     `pg:",use_zero"`
	Timestamp    uint64     `pg:",use_zero"`
	Nonce        uint64     `pg:",use_zero"`
	ExtraNonce   uint64     `pg:",use_zero"`

	// Notifications
	Notified bool `pg:",use_zero"`
	// contains filtered or unexported fields
}

PGBlock represents BlockNode and MsgDeSoHeader

type PGChain

type PGChain struct {
	Name    string     `pg:",pk"`
	TipHash *BlockHash `pg:",type:bytea"`
	// contains filtered or unexported fields
}

type PGCreatorCoinBalance

type PGCreatorCoinBalance struct {
	HolderPKID   *PKID `pg:",pk,type:bytea"`
	CreatorPKID  *PKID `pg:",pk,type:bytea"`
	BalanceNanos uint64
	HasPurchased bool
	// contains filtered or unexported fields
}

func (*PGCreatorCoinBalance) NewBalanceEntry

func (balance *PGCreatorCoinBalance) NewBalanceEntry() *BalanceEntry

type PGDAOCoinBalance

type PGDAOCoinBalance struct {
	HolderPKID   *PKID `pg:",pk,type:bytea"`
	CreatorPKID  *PKID `pg:",pk,type:bytea"`
	BalanceNanos string
	HasPurchased bool
	// contains filtered or unexported fields
}

func (*PGDAOCoinBalance) NewBalanceEntry

func (balance *PGDAOCoinBalance) NewBalanceEntry() *BalanceEntry

type PGDAOCoinLimitOrder

type PGDAOCoinLimitOrder struct {
	OrderID                                   *BlockHash `pg:",pk,type:bytea"`
	TransactorPKID                            *PKID      `pg:",type:bytea"`
	BuyingDAOCoinCreatorPKID                  *PKID      `pg:"buying_dao_coin_creator_pkid,type:bytea"`
	SellingDAOCoinCreatorPKID                 *PKID      `pg:"selling_dao_coin_creator_pkid,type:bytea"`
	ScaledExchangeRateCoinsToSellPerCoinToBuy string     `pg:",use_zero"`
	QuantityToFillInBaseUnits                 string     `pg:",use_zero"`
	OperationType                             uint8      `pg:",use_zero"`
	FillType                                  uint8      `pg:",use_zero"`
	BlockHeight                               uint32     `pg:",use_zero"`
	// contains filtered or unexported fields
}

PGDAOCoinLimitOrder represents DAOCoinLimitOrderEntry

func (*PGDAOCoinLimitOrder) FromDAOCoinLimitOrderEntry

func (order *PGDAOCoinLimitOrder) FromDAOCoinLimitOrderEntry(orderEntry *DAOCoinLimitOrderEntry)

func (*PGDAOCoinLimitOrder) ToDAOCoinLimitOrderEntry

func (order *PGDAOCoinLimitOrder) ToDAOCoinLimitOrderEntry() *DAOCoinLimitOrderEntry

type PGDerivedKey

type PGDerivedKey struct {
	OwnerPublicKey   PublicKey                        `pg:",pk,type:bytea"`
	DerivedPublicKey PublicKey                        `pg:",pk,type:bytea"`
	ExpirationBlock  uint64                           `pg:",use_zero"`
	OperationType    AuthorizeDerivedKeyOperationType `pg:",use_zero"`

	ExtraData map[string][]byte

	// TransactionSpendingLimit fields
	TransactionSpendingLimitTracker []byte `pg:",type:bytea"`
	Memo                            []byte `pg:",type:bytea"`
	BlockHeight                     uint64 `pg:",use_zero"`
	// contains filtered or unexported fields
}

PGDerivedKey represents DerivedKeyEntry

func (*PGDerivedKey) NewDerivedKeyEntry

func (key *PGDerivedKey) NewDerivedKeyEntry() *DerivedKeyEntry

type PGDiamond

type PGDiamond struct {
	SenderPKID      *PKID      `pg:",pk,type:bytea"`
	ReceiverPKID    *PKID      `pg:",pk,type:bytea"`
	DiamondPostHash *BlockHash `pg:",pk,type:bytea"`
	DiamondLevel    uint8
	// contains filtered or unexported fields
}

type PGFollow

type PGFollow struct {
	FollowerPKID *PKID `pg:",pk,type:bytea"`
	FollowedPKID *PKID `pg:",pk,type:bytea"`
	// contains filtered or unexported fields
}

func (*PGFollow) NewFollowEntry

func (follow *PGFollow) NewFollowEntry() *FollowEntry

type PGForbiddenKey

type PGForbiddenKey struct {
	PublicKey *PublicKey `pg:",pk,type:bytea"`
	// contains filtered or unexported fields
}

PGForbiddenKey represents ForbiddenPubKeyEntry

type PGGlobalParams

type PGGlobalParams struct {
	ID uint64

	USDCentsPerBitcoin      uint64 `pg:",use_zero"`
	CreateProfileFeeNanos   uint64 `pg:",use_zero"`
	CreateNFTFeeNanos       uint64 `pg:",use_zero"`
	MaxCopiesPerNFT         uint64 `pg:",use_zero"`
	MinNetworkFeeNanosPerKB uint64 `pg:",use_zero"`
	// contains filtered or unexported fields
}

PGGlobalParams represents GlobalParamsEntry

type PGLike

type PGLike struct {
	LikerPublicKey []byte     `pg:",pk,type:bytea"`
	LikedPostHash  *BlockHash `pg:",pk,type:bytea"`
	// contains filtered or unexported fields
}

func (*PGLike) NewLikeEntry

func (like *PGLike) NewLikeEntry() *LikeEntry

type PGMessage

type PGMessage struct {
	MessageHash        *BlockHash `pg:",pk,type:bytea"`
	SenderPublicKey    []byte
	RecipientPublicKey []byte
	EncryptedText      []byte
	TimestampNanos     uint64

	ExtraData map[string][]byte
	// contains filtered or unexported fields
}

TODO: This doesn't need to be a table. Just add sender to PGMetadataPrivateMessage? The only reason we might not want to do this is if we end up pruning Metadata tables.

type PGMessagingGroup

type PGMessagingGroup struct {
	GroupOwnerPublicKey   *PublicKey    `pg:",type:bytea"`
	MessagingPublicKey    *PublicKey    `pg:",type:bytea"`
	MessagingGroupKeyName *GroupKeyName `pg:",type:bytea"`
	MessagingGroupMembers []byte        `pg:",type:bytea"`

	ExtraData map[string][]byte
	// contains filtered or unexported fields
}

type PGMetadataAcceptNFTBid

type PGMetadataAcceptNFTBid struct {
	TransactionHash *BlockHash            `pg:",pk,type:bytea"`
	NFTPostHash     *BlockHash            `pg:",type:bytea"`
	SerialNumber    uint64                `pg:",use_zero"`
	BidderPKID      *PKID                 `pg:",type:bytea"`
	BidAmountNanos  uint64                `pg:",use_zero"`
	UnlockableText  []byte                `pg:",type:bytea"`
	BidderInputs    []*PGMetadataBidInput `pg:"rel:has-many,join_fk:transaction_hash"`
	// contains filtered or unexported fields
}

PGMetadataAcceptNFTBid represents AcceptNFTBidMetadata

type PGMetadataAcceptNFTTransfer

type PGMetadataAcceptNFTTransfer struct {
	TransactionHash *BlockHash `pg:",pk,type:bytea"`
	NFTPostHash     *BlockHash `pg:",pk,type:bytea"`
	SerialNumber    uint64     `pg:",use_zero"`
	// contains filtered or unexported fields
}

PGMetadataAcceptNFTTransfer represents AcceptNFTTransferMetadata

type PGMetadataAccessGroup added in v3.2.0

type PGMetadataAccessGroup struct {
	TransactionHash           *BlockHash    `pg:",pk,type:bytea"`
	AccessGroupOwnerPublicKey *PublicKey    `pg:",type:bytea"`
	AccessGroupKeyName        *GroupKeyName `pg:",type:bytea"`
	AccessGroupPublicKey      *PublicKey    `pg:",type:bytea"`
	OperationType             uint8         `pg:",type:smallint"`
	// contains filtered or unexported fields
}

type PGMetadataAccessGroupMembers added in v3.2.0

type PGMetadataAccessGroupMembers struct {
	TransactionHash           *BlockHash    `pg:",pk,type:bytea"`
	AccessGroupOwnerPublicKey *PublicKey    `pg:",type:bytea"`
	AccessGroupKeyName        *GroupKeyName `pg:",type:bytea"`
	AccessGroupMembersList    []byte        `pg:",type:bytea"`
	OperationType             uint8         `pg:",type:smallint"`
	// contains filtered or unexported fields
}

type PGMetadataBidInput

type PGMetadataBidInput struct {
	TransactionHash *BlockHash `pg:",pk,type:bytea"`
	InputHash       *BlockHash `pg:",pk,type:bytea"`
	InputIndex      uint32     `pg:",pk,use_zero"`
	// contains filtered or unexported fields
}

type PGMetadataBitcoinExchange

type PGMetadataBitcoinExchange struct {
	TransactionHash   *BlockHash `pg:",pk,type:bytea"`
	BitcoinBlockHash  *BlockHash `pg:",type:bytea"`
	BitcoinMerkleRoot *BlockHash `pg:",type:bytea"`
	// contains filtered or unexported fields
}

PGMetadataBitcoinExchange represents BitcoinExchangeMetadata

type PGMetadataBlockReward

type PGMetadataBlockReward struct {
	TransactionHash *BlockHash `pg:",pk,type:bytea"`
	ExtraData       []byte     `pg:",type:bytea"`
	// contains filtered or unexported fields
}

PGMetadataBlockReward represents BlockRewardMetadataa

type PGMetadataBurnNFT

type PGMetadataBurnNFT struct {
	TransactionHash *BlockHash `pg:",pk,type:bytea"`
	NFTPostHash     *BlockHash `pg:",pk,type:bytea"`
	SerialNumber    uint64     `pg:",use_zero"`
	// contains filtered or unexported fields
}

PGMetadataBurnNFT represents BurnNFTMetadata

type PGMetadataCreateNFT

type PGMetadataCreateNFT struct {
	TransactionHash           *BlockHash `pg:",pk,type:bytea"`
	NFTPostHash               *BlockHash `pg:",type:bytea"`
	NumCopies                 uint64     `pg:",use_zero"`
	HasUnlockable             bool       `pg:",use_zero"`
	IsForSale                 bool       `pg:",use_zero"`
	MinBidAmountNanos         uint64     `pg:",use_zero"`
	CreatorRoyaltyBasisPoints uint64     `pg:",use_zero"`
	CoinRoyaltyBasisPoints    uint64     `pg:",use_zero"`
	// contains filtered or unexported fields
}

PGMetadataCreateNFT represents CreateNFTMetadata

type PGMetadataCreatePostAssociation added in v3.2.0

type PGMetadataCreatePostAssociation struct {
	TransactionHash  *BlockHash `pg:",pk,type:bytea"`
	PostHash         *BlockHash `pg:",type:bytea"`
	AppPublicKey     *PublicKey `pg:",type:bytea"`
	AssociationType  string     `pg:",use_zero"`
	AssociationValue string     `pg:",use_zero"`
	// contains filtered or unexported fields
}

PGMetadataCreatePostAssociation represents CreatePostAssociationMetadata

type PGMetadataCreateUserAssociation added in v3.2.0

type PGMetadataCreateUserAssociation struct {
	TransactionHash     *BlockHash `pg:",pk,type:bytea"`
	TargetUserPublicKey *PublicKey `pg:",type:bytea"`
	AppPublicKey        *PublicKey `pg:",type:bytea"`
	AssociationType     string     `pg:",use_zero"`
	AssociationValue    string     `pg:",use_zero"`
	// contains filtered or unexported fields
}

PGMetadataCreateUserAssociation represents CreateUserAssociationMetadata

type PGMetadataCreatorCoin

type PGMetadataCreatorCoin struct {
	TransactionHash             *BlockHash               `pg:",pk,type:bytea"`
	ProfilePublicKey            []byte                   `pg:",type:bytea"`
	OperationType               CreatorCoinOperationType `pg:",use_zero"`
	DeSoToSellNanos             uint64                   `pg:",use_zero"`
	CreatorCoinToSellNanos      uint64                   `pg:",use_zero"`
	DeSoToAddNanos              uint64                   `pg:",use_zero"`
	MinDeSoExpectedNanos        uint64                   `pg:",use_zero"`
	MinCreatorCoinExpectedNanos uint64                   `pg:",use_zero"`
	// contains filtered or unexported fields
}

PGMetadataCreatorCoin represents CreatorCoinMetadataa

type PGMetadataCreatorCoinTransfer

type PGMetadataCreatorCoinTransfer struct {
	TransactionHash            *BlockHash `pg:",pk,type:bytea"`
	ProfilePublicKey           []byte     `pg:",type:bytea"`
	CreatorCoinToTransferNanos uint64     `pg:",use_zero"`
	ReceiverPublicKey          []byte     `pg:",type:bytea"`
	// contains filtered or unexported fields
}

PGMetadataCreatorCoinTransfer represents CreatorCoinTransferMetadataa

type PGMetadataDAOCoin

type PGMetadataDAOCoin struct {
	TransactionHash           *BlockHash           `pg:",pk,type:bytea"`
	ProfilePublicKey          []byte               `pg:",type:bytea"`
	OperationType             DAOCoinOperationType `pg:",use_zero"`
	CoinsToMintNanos          string
	CoinsToBurnNanos          string
	TransferRestrictionStatus `pg:",use_zero"`
	// contains filtered or unexported fields
}

PGMetadataDAOCoin represents DAOCoinMetadata

type PGMetadataDAOCoinLimitOrder

type PGMetadataDAOCoinLimitOrder struct {
	TransactionHash                           *BlockHash                                 `pg:",pk,type:bytea"`
	BuyingDAOCoinCreatorPublicKey             *PublicKey                                 `pg:"buying_dao_coin_creator_public_key,type:bytea"`
	SellingDAOCoinCreatorPublicKey            *PublicKey                                 `pg:"selling_dao_coin_creator_public_key,type:bytea"`
	ScaledExchangeRateCoinsToSellPerCoinToBuy string                                     `pg:",use_zero"`
	QuantityToFillInBaseUnits                 string                                     `pg:",use_zero"`
	OperationType                             uint8                                      `pg:",use_zero"`
	FillType                                  uint8                                      `pg:",use_zero"`
	CancelOrderID                             *BlockHash                                 `pg:",type:bytea"`
	FeeNanos                                  uint64                                     `pg:",use_zero"`
	BidderInputs                              []*PGMetadataDAOCoinLimitOrderBidderInputs `pg:"rel:has-many,join_fk:transaction_hash"`
	// contains filtered or unexported fields
}

PGMetadataDAOCoinLimitOrder represents DAOCoinLimitOrderMetadata

type PGMetadataDAOCoinLimitOrderBidderInputs

type PGMetadataDAOCoinLimitOrderBidderInputs struct {
	TransactionHash *BlockHash `pg:",pk,type:bytea"`
	InputHash       *BlockHash `pg:",pk,type:bytea"`
	InputIndex      uint32     `pg:",pk,use_zero"`
	// contains filtered or unexported fields
}

type PGMetadataDAOCoinTransfer

type PGMetadataDAOCoinTransfer struct {
	TransactionHash        *BlockHash `pg:",pk,type:bytea"`
	ProfilePublicKey       []byte     `pg:",type:bytea"`
	DAOCoinToTransferNanos string     `pg:"dao_coin_to_transfer_nanos,use_zero"`
	ReceiverPublicKey      []byte     `pg:",type:bytea"`
	// contains filtered or unexported fields
}

PGMetadataDAOCoinTransfer represents DAOCoinTransferMetadata

type PGMetadataDeletePostAssociation added in v3.2.0

type PGMetadataDeletePostAssociation struct {
	TransactionHash *BlockHash `pg:",pk,type:bytea"`
	AssociationID   *BlockHash `pg:",type:bytea"`
	// contains filtered or unexported fields
}

PGMetadataDeletePostAssociation represents DeletePostAssociationMetadata

type PGMetadataDeleteUserAssociation added in v3.2.0

type PGMetadataDeleteUserAssociation struct {
	TransactionHash *BlockHash `pg:",pk,type:bytea"`
	AssociationID   *BlockHash `pg:",type:bytea"`
	// contains filtered or unexported fields
}

PGMetadataDeleteUserAssociation represents DeleteUserAssociationMetadata

type PGMetadataDerivedKey

type PGMetadataDerivedKey struct {
	TransactionHash  *BlockHash                       `pg:",pk,type:bytea"`
	DerivedPublicKey PublicKey                        `pg:",type:bytea"`
	ExpirationBlock  uint64                           `pg:",use_zero"`
	OperationType    AuthorizeDerivedKeyOperationType `pg:",use_zero"`
	AccessSignature  []byte                           `pg:",type:bytea"`
	// contains filtered or unexported fields
}

PGMetadataDerivedKey represents AuthorizeDerivedKeyMetadata

type PGMetadataFollow

type PGMetadataFollow struct {
	TransactionHash   *BlockHash `pg:",pk,type:bytea"`
	FollowedPublicKey []byte     `pg:",type:bytea"`
	IsUnfollow        bool       `pg:",use_zero"`
	// contains filtered or unexported fields
}

PGMetadataFollow represents FollowMetadata

type PGMetadataLike

type PGMetadataLike struct {
	TransactionHash *BlockHash `pg:",pk,type:bytea"`
	LikedPostHash   *BlockHash `pg:",type:bytea"`
	IsUnlike        bool       `pg:",use_zero"`
	// contains filtered or unexported fields
}

PGMetadataLike represents LikeMetadata

type PGMetadataNFTBid

type PGMetadataNFTBid struct {
	TransactionHash *BlockHash `pg:",pk,type:bytea"`
	NFTPostHash     *BlockHash `pg:",type:bytea"`
	SerialNumber    uint64     `pg:",use_zero"`
	BidAmountNanos  uint64     `pg:",use_zero"`
	// contains filtered or unexported fields
}

PGMetadataNFTBid represents NFTBidMetadata

type PGMetadataNFTTransfer

type PGMetadataNFTTransfer struct {
	TransactionHash   *BlockHash `pg:",pk,type:bytea"`
	NFTPostHash       *BlockHash `pg:",pk,type:bytea"`
	SerialNumber      uint64     `pg:",use_zero"`
	ReceiverPublicKey []byte     `pg:",pk,type:bytea"`
	UnlockableText    []byte     `pg:",type:bytea"`
	// contains filtered or unexported fields
}

PGMetadataNFTTransfer represents NFTTransferMetadata

type PGMetadataNewMessage added in v3.2.0

type PGMetadataNewMessage struct {
	TransactionHash                    *BlockHash   `pg:",pk,type:bytea"`
	SenderAccessGroupOwnerPublicKey    PublicKey    `pg:",type:bytea"`
	SenderAccessGroupKeyName           GroupKeyName `pg:",type:bytea"`
	SenderAccessGroupPublicKey         PublicKey    `pg:",type:bytea"`
	RecipientAccessGroupOwnerPublicKey PublicKey    `pg:",type:bytea"`
	RecipientAccessGroupKeyName        GroupKeyName `pg:",type:bytea"`
	RecipientAccessGroupPublicKey      PublicKey    `pg:",type:bytea"`
	EncryptedText                      []byte       `pg:",type:bytea"`
	TimestampNanos                     uint64       `pg:",use_zero"`
	NewMessageType                     uint8        `pg:",type:smallint"`
	NewMessageOperation                uint8        `pg:",type:smallint"`
	// contains filtered or unexported fields
}

type PGMetadataPrivateMessage

type PGMetadataPrivateMessage struct {
	TransactionHash    *BlockHash `pg:",pk,type:bytea"`
	RecipientPublicKey []byte     `pg:",type:bytea"`
	EncryptedText      []byte     `pg:",type:bytea"`
	TimestampNanos     uint64
	// contains filtered or unexported fields
}

PGMetadataPrivateMessage represents PrivateMessageMetadata

type PGMetadataSubmitPost

type PGMetadataSubmitPost struct {
	TransactionHash  *BlockHash `pg:",pk,type:bytea"`
	PostHashToModify *BlockHash `pg:",type:bytea"`
	ParentStakeID    *BlockHash `pg:",type:bytea"`
	Body             []byte     `pg:",type:bytea"`
	TimestampNanos   uint64
	IsHidden         bool `pg:",use_zero"`
	// contains filtered or unexported fields
}

PGMetadataSubmitPost represents SubmitPostMetadata

type PGMetadataSwapIdentity

type PGMetadataSwapIdentity struct {
	TransactionHash *BlockHash `pg:",pk,type:bytea"`
	FromPublicKey   []byte     `pg:",type:bytea"`
	ToPublicKey     []byte     `pg:",type:bytea"`
	// contains filtered or unexported fields
}

PGMetadataSwapIdentity represents SwapIdentityMetadataa

type PGMetadataUpdateExchangeRate

type PGMetadataUpdateExchangeRate struct {
	TransactionHash    *BlockHash `pg:",pk,type:bytea"`
	USDCentsPerBitcoin uint64     `pg:",use_zero"`
	// contains filtered or unexported fields
}

PGMetadataUpdateExchangeRate represents UpdateBitcoinUSDExchangeRateMetadataa

type PGMetadataUpdateNFT

type PGMetadataUpdateNFT struct {
	TransactionHash   *BlockHash `pg:",pk,type:bytea"`
	NFTPostHash       *BlockHash `pg:",type:bytea"`
	SerialNumber      uint64     `pg:",use_zero"`
	IsForSale         bool       `pg:",use_zero"`
	MinBidAmountNanos uint64     `pg:",use_zero"`
	// contains filtered or unexported fields
}

PGMetadataUpdateNFT represents UpdateNFTMetadata

type PGMetadataUpdateProfile

type PGMetadataUpdateProfile struct {
	TransactionHash       *BlockHash `pg:",pk,type:bytea"`
	ProfilePublicKey      []byte     `pg:",type:bytea"`
	NewUsername           []byte     `pg:",type:bytea"`
	NewDescription        []byte     `pg:",type:bytea"`
	NewProfilePic         []byte     `pg:",type:bytea"`
	NewCreatorBasisPoints uint64     `pg:",use_zero"`
	// contains filtered or unexported fields
}

PGMetadataUpdateProfile represents UpdateProfileMetadata

type PGNFT

type PGNFT struct {
	NFTPostHash  *BlockHash `pg:",pk,type:bytea"`
	SerialNumber uint64     `pg:",pk"`

	// This is needed to decrypt unlockable text.
	LastOwnerPKID              *PKID  `pg:",type:bytea"`
	OwnerPKID                  *PKID  `pg:",type:bytea"`
	ForSale                    bool   `pg:",use_zero"`
	MinBidAmountNanos          uint64 `pg:",use_zero"`
	UnlockableText             string
	LastAcceptedBidAmountNanos uint64 `pg:",use_zero"`
	IsPending                  bool   `pg:",use_zero"`
	IsBuyNow                   bool   `pg:",use_zero"`
	BuyNowPriceNanos           uint64 `pg:",use_zero"`

	ExtraData map[string][]byte
	// contains filtered or unexported fields
}

PGNFT represents NFTEntry

func (*PGNFT) NewNFTEntry

func (nft *PGNFT) NewNFTEntry() *NFTEntry

type PGNFTBid

type PGNFTBid struct {
	BidderPKID          *PKID      `pg:",pk,type:bytea"`
	NFTPostHash         *BlockHash `pg:",pk,type:bytea"`
	SerialNumber        uint64     `pg:",pk,use_zero"`
	BidAmountNanos      uint64     `pg:",use_zero"`
	Accepted            bool       `pg:",use_zero"`
	AcceptedBlockHeight *uint32    `pg:",use_zero"`
	// contains filtered or unexported fields
}

PGNFTBid represents NFTBidEntry

func (*PGNFTBid) NewNFTBidEntry

func (bid *PGNFTBid) NewNFTBidEntry() *NFTBidEntry

type PGNewMessageDmEntry added in v3.2.0

type PGNewMessageDmEntry struct {
	MinorAccessGroupOwnerPublicKey *PublicKey    `pg:",pk,type:bytea"`
	MinorAccessGroupKeyName        *GroupKeyName `pg:",pk,type:bytea"`
	SenderAccessGroupPublicKey     *PublicKey    `pg:",type:bytea"`
	MajorAccessGroupOwnerPublicKey *PublicKey    `pg:",pk,type:bytea"`
	MajorAccessGroupKeyName        *GroupKeyName `pg:",pk,type:bytea"`
	RecipientAccessGroupPublicKey  *PublicKey    `pg:",type:bytea"`
	EncryptedText                  []byte        `pg:",type:bytea"`
	TimestampNanos                 uint64        `pg:",pk"`

	IsSenderMinor bool
	ExtraData     map[string][]byte
	// contains filtered or unexported fields
}

func (*PGNewMessageDmEntry) FromNewMessageEntry added in v3.2.0

func (messageEntry *PGNewMessageDmEntry) FromNewMessageEntry(newMessageEntry *NewMessageEntry)

func (*PGNewMessageDmEntry) ToNewMessageEntry added in v3.2.0

func (messageEntry *PGNewMessageDmEntry) ToNewMessageEntry() *NewMessageEntry

type PGNewMessageDmThreadEntry added in v3.2.0

type PGNewMessageDmThreadEntry struct {
	UserAccessGroupOwnerPublicKey  *PublicKey    `pg:",pk,type:bytea"`
	UserAccessGroupKeyName         *GroupKeyName `pg:",pk,type:bytea"`
	PartyAccessGroupOwnerPublicKey *PublicKey    `pg:",pk,type:bytea"`
	PartyAccessGroupKeyName        *GroupKeyName `pg:",pk,type:bytea"`
	// contains filtered or unexported fields
}

func (*PGNewMessageDmThreadEntry) FromDmThreadKey added in v3.2.0

func (messageEntry *PGNewMessageDmThreadEntry) FromDmThreadKey(dmThreadKey *DmThreadKey)

func (*PGNewMessageDmThreadEntry) ToDmThreadKey added in v3.2.0

func (messageEntry *PGNewMessageDmThreadEntry) ToDmThreadKey() *DmThreadKey

type PGNewMessageGroupChatEntry added in v3.2.0

type PGNewMessageGroupChatEntry struct {
	AccessGroupOwnerPublicKey *PublicKey    `pg:",pk,type:bytea"`
	AccessGroupKeyName        *GroupKeyName `pg:",pk,type:bytea"`
	AccessGroupPublicKey      *PublicKey    `pg:",type:bytea"`

	SenderAccessGroupOwnerPublicKey *PublicKey    `pg:",type:bytea"`
	SenderAccessGroupKeyName        *GroupKeyName `pg:",type:bytea"`
	SenderAccessGroupPublicKey      *PublicKey    `pg:",type:bytea"`
	EncryptedText                   []byte        `pg:",type:bytea"`
	TimestampNanos                  uint64        `pg:",pk"`

	ExtraData map[string][]byte
	// contains filtered or unexported fields
}

func (*PGNewMessageGroupChatEntry) FromNewMessageEntry added in v3.2.0

func (messageEntry *PGNewMessageGroupChatEntry) FromNewMessageEntry(newMessageEntry *NewMessageEntry)

func (*PGNewMessageGroupChatEntry) ToNewMessageEntry added in v3.2.0

func (messageEntry *PGNewMessageGroupChatEntry) ToNewMessageEntry() *NewMessageEntry

type PGNewMessageGroupChatThreadEntry added in v3.2.0

type PGNewMessageGroupChatThreadEntry struct {
	AccessGroupOwnerPublicKey *PublicKey    `pg:",pk,type:bytea"`
	AccessGroupKeyName        *GroupKeyName `pg:",pk,type:bytea"`
	// contains filtered or unexported fields
}

func (*PGNewMessageGroupChatThreadEntry) FromAccessGroupId added in v3.2.0

func (messageEntry *PGNewMessageGroupChatThreadEntry) FromAccessGroupId(groupId AccessGroupId)

func (*PGNewMessageGroupChatThreadEntry) ToAccessGroupId added in v3.2.0

func (messageEntry *PGNewMessageGroupChatThreadEntry) ToAccessGroupId() AccessGroupId

type PGNotification

type PGNotification struct {
	TransactionHash *BlockHash       `pg:",pk,type:bytea"`
	Mined           bool             `pg:",use_zero"`
	ToUser          []byte           `pg:",type:bytea"`
	FromUser        []byte           `pg:",type:bytea"`
	OtherUser       []byte           `pg:",type:bytea"`
	Type            NotificationType `pg:",use_zero"`
	Amount          uint64           `pg:",use_zero"`
	PostHash        *BlockHash       `pg:",type:bytea"`
	Timestamp       uint64           `pg:",use_zero"`
	// contains filtered or unexported fields
}

type PGPost

type PGPost struct {
	PostHash                                    *BlockHash `pg:",pk,type:bytea"`
	PosterPublicKey                             []byte
	ParentPostHash                              *BlockHash `pg:",type:bytea"`
	Body                                        string
	RepostedPostHash                            *BlockHash        `pg:",type:bytea"`
	QuotedRepost                                bool              `pg:",use_zero"`
	Timestamp                                   uint64            `pg:",use_zero"`
	Hidden                                      bool              `pg:",use_zero"`
	LikeCount                                   uint64            `pg:",use_zero"`
	RepostCount                                 uint64            `pg:",use_zero"`
	QuoteRepostCount                            uint64            `pg:",use_zero"`
	DiamondCount                                uint64            `pg:",use_zero"`
	CommentCount                                uint64            `pg:",use_zero"`
	Pinned                                      bool              `pg:",use_zero"`
	NFT                                         bool              `pg:",use_zero"`
	NumNFTCopies                                uint64            `pg:",use_zero"`
	NumNFTCopiesForSale                         uint64            `pg:",use_zero"`
	NumNFTCopiesBurned                          uint64            `pg:",use_zero"`
	Unlockable                                  bool              `pg:",use_zero"`
	CreatorRoyaltyBasisPoints                   uint64            `pg:",use_zero"`
	CoinRoyaltyBasisPoints                      uint64            `pg:",use_zero"`
	AdditionalNFTRoyaltiesToCoinsBasisPoints    map[string]uint64 `pg:"additional_nft_royalties_to_coins_basis_points"`
	AdditionalNFTRoyaltiesToCreatorsBasisPoints map[string]uint64 `pg:"additional_nft_royalties_to_creators_basis_points"`
	ExtraData                                   map[string][]byte
	IsFrozen                                    bool `pg:",use_zero"`
	// contains filtered or unexported fields
}

func (*PGPost) HasMedia

func (post *PGPost) HasMedia() bool

HasMedia is inefficient and needs to be moved to a column in the Posts table

func (*PGPost) NewPostEntry

func (post *PGPost) NewPostEntry() *PostEntry

type PGPostAssociation added in v3.2.0

type PGPostAssociation struct {
	AssociationID    *BlockHash `pg:",pk,type:bytea"`
	TransactorPKID   *PKID      `pg:",type:bytea"`
	PostHash         *BlockHash `pg:",type:bytea"`
	AppPKID          *PKID      `pg:",type:bytea"`
	AssociationType  string     `pg:",use_zero"`
	AssociationValue string     `pg:",use_zero"`
	ExtraData        map[string][]byte
	BlockHeight      uint32 `pg:",use_zero"`
	// contains filtered or unexported fields
}

PGPostAssociation represents PostAssociationEntry

func (*PGPostAssociation) FromPostAssociationEntry added in v3.2.0

func (postAssociation *PGPostAssociation) FromPostAssociationEntry(associationEntry *PostAssociationEntry) *PGPostAssociation

func (*PGPostAssociation) ToPostAssociationEntry added in v3.2.0

func (postAssociation *PGPostAssociation) ToPostAssociationEntry() *PostAssociationEntry

type PGProfile

type PGProfile struct {
	PKID               *PKID      `pg:",pk,type:bytea"`
	PublicKey          *PublicKey `pg:",type:bytea"`
	Username           string
	Description        string
	ProfilePic         []byte
	CreatorBasisPoints uint64
	DeSoLockedNanos    uint64
	NumberOfHolders    uint64
	// FIXME: Postgres will break when values exceed uint64
	// We don't use Postgres right now so going to plow ahead and set this as-is
	// to fix compile errors. CoinsInCirculationNanos will never exceed uint64
	CoinsInCirculationNanos          uint64
	CoinWatermarkNanos               uint64
	MintingDisabled                  bool
	DAOCoinNumberOfHolders           uint64                    `pg:"dao_coin_number_of_holders"`
	DAOCoinCoinsInCirculationNanos   string                    `pg:"dao_coin_coins_in_circulation_nanos"`
	DAOCoinMintingDisabled           bool                      `pg:"dao_coin_minting_disabled"`
	DAOCoinTransferRestrictionStatus TransferRestrictionStatus `pg:"dao_coin_transfer_restriction_status"`
	ExtraData                        map[string][]byte
	// contains filtered or unexported fields
}

func (*PGProfile) Empty

func (profile *PGProfile) Empty() bool

type PGRepost

type PGRepost struct {
	ReposterPublickey *PublicKey `pg:",pk,type:bytea"`
	RepostedPostHash  *BlockHash `pg:",pk,type:bytea"`
	RepostPostHash    *BlockHash `pg:",type:bytea"`
	// contains filtered or unexported fields
}

type PGTransaction

type PGTransaction struct {
	Hash          *BlockHash `pg:",pk,type:bytea"`
	BlockHash     *BlockHash `pg:",type:bytea"`
	Type          TxnType    `pg:",use_zero"`
	PublicKey     []byte     `pg:",type:bytea"`
	ExtraData     map[string][]byte
	R             *BlockHash `pg:",type:bytea"`
	S             *BlockHash `pg:",type:bytea"`
	RecoveryId    uint32     `pg:",use_zero"`
	IsRecoverable bool       `pg:",use_zero"`

	// Relationships
	Outputs                       []*PGTransactionOutput           `pg:"rel:has-many,join_fk:output_hash"`
	MetadataBlockReward           *PGMetadataBlockReward           `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataBitcoinExchange       *PGMetadataBitcoinExchange       `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataPrivateMessage        *PGMetadataPrivateMessage        `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataSubmitPost            *PGMetadataSubmitPost            `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataUpdateExchangeRate    *PGMetadataUpdateExchangeRate    `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataUpdateProfile         *PGMetadataUpdateProfile         `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataFollow                *PGMetadataFollow                `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataLike                  *PGMetadataLike                  `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataCreatorCoin           *PGMetadataCreatorCoin           `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataCreatorCoinTransfer   *PGMetadataCreatorCoinTransfer   `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataSwapIdentity          *PGMetadataSwapIdentity          `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataCreateNFT             *PGMetadataCreateNFT             `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataUpdateNFT             *PGMetadataUpdateNFT             `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataAcceptNFTBid          *PGMetadataAcceptNFTBid          `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataNFTBid                *PGMetadataNFTBid                `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataNFTTransfer           *PGMetadataNFTTransfer           `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataAcceptNFTTransfer     *PGMetadataAcceptNFTTransfer     `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataBurnNFT               *PGMetadataBurnNFT               `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataDerivedKey            *PGMetadataDerivedKey            `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataDAOCoin               *PGMetadataDAOCoin               `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataDAOCoinTransfer       *PGMetadataDAOCoinTransfer       `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataDAOCoinLimitOrder     *PGMetadataDAOCoinLimitOrder     `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataCreateUserAssociation *PGMetadataCreateUserAssociation `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataDeleteUserAssociation *PGMetadataDeleteUserAssociation `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataCreatePostAssociation *PGMetadataCreatePostAssociation `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataDeletePostAssociation *PGMetadataDeletePostAssociation `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataAccessGroup           *PGMetadataAccessGroup           `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataAccessGroupMembers    *PGMetadataAccessGroupMembers    `pg:"rel:belongs-to,join_fk:transaction_hash"`
	MetadataNewMessage            *PGMetadataNewMessage            `pg:"rel:belongs-to,join_fk:transaction_hash"`
	// contains filtered or unexported fields
}

PGTransaction represents MsgDeSoTxn

type PGTransactionOutput

type PGTransactionOutput struct {
	OutputHash  *BlockHash `pg:",pk"`
	OutputIndex uint32     `pg:",pk,use_zero"`
	OutputType  UtxoType   `pg:",use_zero"`
	Height      uint32     `pg:",use_zero"`
	PublicKey   []byte
	AmountNanos uint64 `pg:",use_zero"`
	Spent       bool   `pg:",use_zero"`
	InputHash   *BlockHash
	InputIndex  uint32 `pg:",pk,use_zero"`
	// contains filtered or unexported fields
}

PGTransactionOutput represents DeSoOutput, DeSoInput, and UtxoEntry

func (*PGTransactionOutput) NewUtxoEntry

func (utxo *PGTransactionOutput) NewUtxoEntry() *UtxoEntry

type PGUserAssociation added in v3.2.0

type PGUserAssociation struct {
	AssociationID    *BlockHash `pg:",pk,type:bytea"`
	TransactorPKID   *PKID      `pg:",type:bytea"`
	TargetUserPKID   *PKID      `pg:",type:bytea"`
	AppPKID          *PKID      `pg:",type:bytea"`
	AssociationType  string     `pg:",use_zero"`
	AssociationValue string     `pg:",use_zero"`
	ExtraData        map[string][]byte
	BlockHeight      uint32 `pg:",use_zero"`
	// contains filtered or unexported fields
}

PGUserAssociation represents UserAssociationEntry

func (*PGUserAssociation) FromUserAssociationEntry added in v3.2.0

func (userAssociation *PGUserAssociation) FromUserAssociationEntry(associationEntry *UserAssociationEntry) *PGUserAssociation

func (*PGUserAssociation) ToUserAssociationEntry added in v3.2.0

func (userAssociation *PGUserAssociation) ToUserAssociationEntry() *UserAssociationEntry

type PKID

func DBGetPKIDForUsername

func DBGetPKIDForUsername(db *badger.DB, snap *Snapshot, username []byte) *PKID

func DBGetPKIDForUsernameWithTxn

func DBGetPKIDForUsernameWithTxn(txn *badger.Txn,
	snap *Snapshot, username []byte) *PKID

func DbGetPKIDsFollowingYou

func DbGetPKIDsFollowingYou(handle *badger.DB, yourPKID *PKID) (
	_pkids []*PKID, _err error)

func DbGetPKIDsYouFollow

func DbGetPKIDsYouFollow(handle *badger.DB, yourPKID *PKID) (
	_pkids []*PKID, _err error)

func NewPKID

func NewPKID(pkidBytes []byte) *PKID

func PublicKeyToPKID

func PublicKeyToPKID(publicKey []byte) *PKID

func SortPKIDs

func SortPKIDs(pkids []PKID) []PKID

func (*PKID) Eq

func (pkid *PKID) Eq(other *PKID) bool

func (*PKID) FromBytes

func (pkid *PKID) FromBytes(rr *bytes.Reader) error

func (*PKID) GetEncoderType

func (pkid *PKID) GetEncoderType() EncoderType

func (*PKID) GetVersionByte

func (pkid *PKID) GetVersionByte(blockHeight uint64) byte

func (*PKID) IsZeroPKID

func (pkid *PKID) IsZeroPKID() bool

func (*PKID) NewPKID

func (pkid *PKID) NewPKID() *PKID

func (*PKID) RawDecodeWithoutMetadata

func (pkid *PKID) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*PKID) RawEncodeWithoutMetadata

func (pkid *PKID) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

func (*PKID) ToBytes

func (pkid *PKID) ToBytes() []byte

func (*PKID) ToString

func (pkid *PKID) ToString() string

type PKIDEntry

type PKIDEntry struct {
	PKID *PKID
	// We add the public key only so we can reuse this struct to store the reverse
	// mapping of pkid -> public key.
	PublicKey []byte
	// contains filtered or unexported fields
}

func DBGetPKIDEntryForPublicKey

func DBGetPKIDEntryForPublicKey(db *badger.DB, snap *Snapshot, publicKey []byte) *PKIDEntry

func DBGetPKIDEntryForPublicKeyWithTxn

func DBGetPKIDEntryForPublicKeyWithTxn(txn *badger.Txn, snap *Snapshot, publicKey []byte) *PKIDEntry

func (*PKIDEntry) GetEncoderType

func (pkid *PKIDEntry) GetEncoderType() EncoderType

func (*PKIDEntry) GetVersionByte

func (pkid *PKIDEntry) GetVersionByte(blockHeight uint64) byte

func (*PKIDEntry) RawDecodeWithoutMetadata

func (pkid *PKIDEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*PKIDEntry) RawEncodeWithoutMetadata

func (pkid *PKIDEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

func (*PKIDEntry) String

func (pkid *PKIDEntry) String() string

type Peer

type Peer struct {

	// Stats that should be accessed using the mutex below.
	StatsMtx       deadlock.RWMutex
	TimeOffsetSecs int64
	TimeConnected  time.Time

	ID uint64
	// Ping-related fields.
	LastPingNonce  uint64
	LastPingTime   time.Time
	LastPingMicros int64

	Conn net.Conn

	Params      *DeSoParams
	MessageChan chan *ServerMessage
	// A hack to make it so that we can allow an API endpoint to manually
	// delete a peer.
	PeerManuallyRemovedFromConnectionManager bool

	// In order to complete a version negotiation successfully, the peer must
	// reply to the initial version message we send them with a verack message
	// containing the nonce from that initial version message. This ensures that
	// the peer's IP isn't being spoofed since the only way to actually produce
	// a verack with the appropriate response is to actually own the IP that
	// the peer claims it has. As such, we maintain the version nonce we sent
	// the peer and the version nonce they sent us here.
	//
	// TODO: The way we synchronize the version nonce is currently a bit
	// messy; ideally we could do it without keeping global state.
	VersionNonceSent     uint64
	VersionNonceReceived uint64

	// Basic state.
	PeerInfoMtx deadlock.Mutex

	VersionNegotiated bool
	// contains filtered or unexported fields
}

Peer is an object that holds all of the state for a connection to another node. Any communication with other nodes happens via this object, which maintains a queue of messages to send to the other node.

func NewPeer

func NewPeer(_conn net.Conn, _isOutbound bool, _netAddr *wire.NetAddress,
	_isPersistent bool, _stallTimeoutSeconds uint64,
	_minFeeRateNanosPerKB uint64,
	params *DeSoParams,
	messageChan chan *ServerMessage,
	_cmgr *ConnectionManager, _srv *Server,
	_syncType NodeSyncType) *Peer

NewPeer creates a new Peer object.

func (*Peer) AddDeSoMessage

func (pp *Peer) AddDeSoMessage(desoMessage DeSoMessage, inbound bool)

func (*Peer) Address

func (pp *Peer) Address() string

func (*Peer) Connected

func (pp *Peer) Connected() bool

func (*Peer) Disconnect

func (pp *Peer) Disconnect()

Disconnect closes a peer's network connection.

func (*Peer) HandleGetBlocks

func (pp *Peer) HandleGetBlocks(msg *MsgDeSoGetBlocks)

func (*Peer) HandleGetSnapshot

func (pp *Peer) HandleGetSnapshot(msg *MsgDeSoGetSnapshot)

HandleGetSnapshot gets called whenever we receive a GetSnapshot message from a peer. This means a peer is asking us to send him some data from our most recent snapshot. To respond to the peer we will retrieve the chunk from our main and ancestral records db and attach it to the response message. This function is handled within peer's inbound message loop because retrieving a chunk is costly.

func (*Peer) HandleGetTransactionsMsg

func (pp *Peer) HandleGetTransactionsMsg(getTxnMsg *MsgDeSoGetTransactions)

This call blocks on the Peer's queue.

func (*Peer) HandleInv

func (pp *Peer) HandleInv(msg *MsgDeSoInv)

func (*Peer) HandlePingMsg

func (pp *Peer) HandlePingMsg(msg *MsgDeSoPing)

HandlePingMsg is invoked when a peer receives a ping message. It replies with a pong message.

func (*Peer) HandlePongMsg

func (pp *Peer) HandlePongMsg(msg *MsgDeSoPong)

HandlePongMsg is invoked when a peer receives a pong message. It updates the ping statistics.

func (*Peer) HandleTransactionBundleMessage

func (pp *Peer) HandleTransactionBundleMessage(msg *MsgDeSoTransactionBundle)

func (*Peer) HelpHandleInv

func (pp *Peer) HelpHandleInv(msg *MsgDeSoInv)

func (*Peer) IP

func (pp *Peer) IP() string

func (*Peer) IsOutbound

func (pp *Peer) IsOutbound() bool

func (*Peer) IsSyncCandidate

func (pp *Peer) IsSyncCandidate() bool

func (*Peer) MaybeDequeueDeSoMessage

func (pp *Peer) MaybeDequeueDeSoMessage() *DeSoMessageMeta

func (*Peer) MinFeeRateNanosPerKB

func (pp *Peer) MinFeeRateNanosPerKB() uint64

MinFeeRateNanosPerKB returns the minimum fee rate this peer requires in order to accept transactions into its mempool. We should generally not send a peer a transaction below this fee rate.

func (*Peer) NegotiateVersion

func (pp *Peer) NegotiateVersion(versionNegotiationTimeout time.Duration) error

func (*Peer) NewVersionMessage

func (pp *Peer) NewVersionMessage(params *DeSoParams) *MsgDeSoVersion

func (*Peer) NumBlocksToSend

func (pp *Peer) NumBlocksToSend() uint32

NumBlocksToSend is the number of blocks the Peer has requested from us that we have yet to send them.

func (*Peer) PingHandler

func (pp *Peer) PingHandler()

func (*Peer) Port

func (pp *Peer) Port() uint16

func (*Peer) QueueMessage

func (pp *Peer) QueueMessage(desoMessage DeSoMessage)

func (*Peer) ReadDeSoMessage

func (pp *Peer) ReadDeSoMessage() (DeSoMessage, error)

func (*Peer) ReadWithTimeout

func (pp *Peer) ReadWithTimeout(readFunc func() error, readTimeout time.Duration) error

func (*Peer) Start

func (pp *Peer) Start()

func (*Peer) StartDeSoMessageProcessor

func (pp *Peer) StartDeSoMessageProcessor()

func (*Peer) StartingBlockHeight

func (pp *Peer) StartingBlockHeight() uint32

StartingBlockHeight is the height of the peer's blockchain tip.

func (*Peer) String

func (pp *Peer) String() string

func (*Peer) WriteDeSoMessage

func (pp *Peer) WriteDeSoMessage(msg DeSoMessage) error

type PkMapKey

DEPRECATED: Replace all instances with lib.PublicKey

func MakePkMapKey

func MakePkMapKey(pk []byte) PkMapKey

func (PkMapKey) String

func (mm PkMapKey) String() string

type PostAssociationEntry added in v3.2.0

type PostAssociationEntry struct {
	AssociationID    *BlockHash
	TransactorPKID   *PKID
	PostHash         *BlockHash
	AppPKID          *PKID
	AssociationType  []byte
	AssociationValue []byte
	ExtraData        map[string][]byte
	BlockHeight      uint32
	// contains filtered or unexported fields
}

func DBGetPostAssociationByAttributes added in v3.2.0

func DBGetPostAssociationByAttributes(handle *badger.DB, snap *Snapshot, queryEntry *PostAssociationEntry) (*PostAssociationEntry, error)

func DBGetPostAssociationByAttributesWithTxn added in v3.2.0

func DBGetPostAssociationByAttributesWithTxn(txn *badger.Txn, snap *Snapshot, queryEntry *PostAssociationEntry) (*PostAssociationEntry, error)

func DBGetPostAssociationByID added in v3.2.0

func DBGetPostAssociationByID(handle *badger.DB, snap *Snapshot, associationID *BlockHash) (*PostAssociationEntry, error)

func DBGetPostAssociationByIDWithTxn added in v3.2.0

func DBGetPostAssociationByIDWithTxn(txn *badger.Txn, snap *Snapshot, associationID *BlockHash) (*PostAssociationEntry, error)

func DBGetPostAssociationsByAttributes added in v3.2.0

func DBGetPostAssociationsByAttributes(
	handle *badger.DB,
	snap *Snapshot,
	associationQuery *PostAssociationQuery,
	utxoViewAssociationIds *Set[BlockHash],
) ([]*PostAssociationEntry, []byte, error)

func (*PostAssociationEntry) Copy added in v3.2.0

func (associationEntry *PostAssociationEntry) Copy() *PostAssociationEntry

func (*PostAssociationEntry) Eq added in v3.2.0

func (associationEntry *PostAssociationEntry) Eq(other *PostAssociationEntry) bool

func (*PostAssociationEntry) GetEncoderType added in v3.2.0

func (associationEntry *PostAssociationEntry) GetEncoderType() EncoderType

func (*PostAssociationEntry) GetVersionByte added in v3.2.0

func (associationEntry *PostAssociationEntry) GetVersionByte(blockHeight uint64) byte

func (*PostAssociationEntry) RawDecodeWithoutMetadata added in v3.2.0

func (associationEntry *PostAssociationEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*PostAssociationEntry) RawEncodeWithoutMetadata added in v3.2.0

func (associationEntry *PostAssociationEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

func (*PostAssociationEntry) ToMapKey added in v3.2.0

func (associationEntry *PostAssociationEntry) ToMapKey() AssociationMapKey

type PostAssociationQuery added in v3.2.0

type PostAssociationQuery struct {
	TransactorPKID         *PKID
	PostHash               *BlockHash
	AppPKID                *PKID
	AssociationType        []byte
	AssociationTypePrefix  []byte
	AssociationValue       []byte
	AssociationValuePrefix []byte
	Limit                  int
	LastSeenAssociationID  *BlockHash
	SortDescending         bool
}

type PostEntry

type PostEntry struct {
	// The hash of this post entry. Used as the ID for the entry.
	PostHash *BlockHash

	// The public key of the user who made the post.
	PosterPublicKey []byte

	// The parent post. This is used for comments.
	ParentStakeID []byte

	// The body of this post.
	Body []byte

	// The PostHash of the post this post reposts
	RepostedPostHash *BlockHash

	// Indicator if this PostEntry is a quoted repost or not
	IsQuotedRepost bool

	// The amount the creator of the post gets when someone stakes
	// to the post.
	CreatorBasisPoints uint64

	// The multiple of the payout when a user stakes to a post.
	// 2x multiple = 200% = 20,000bps
	StakeMultipleBasisPoints uint64

	// The block height when the post was confirmed.
	ConfirmationBlockHeight uint32

	// A timestamp used for ordering messages when displaying them to
	// users. The timestamp must be unique. Note that we use a nanosecond
	// timestamp because it makes it easier to deal with the uniqueness
	// constraint technically (e.g. If one second spacing is required
	// as would be the case with a standard Unix timestamp then any code
	// that generates these transactions will need to potentially wait
	// or else risk a timestamp collision. This complexity is avoided
	// by just using a nanosecond timestamp). Note that the timestamp is
	// an unsigned int as opposed to a signed int, which means times
	// before the zero time are not represented which doesn't matter
	// for our purposes. Restricting the timestamp in this way makes
	// lexicographic sorting based on bytes easier in our database which
	// is one of the reasons we do it.
	TimestampNanos uint64

	// Users can "delete" posts, but right now we just implement this as
	// setting a flag on the post to hide it rather than actually deleting
	// it. This simplifies the implementation and makes it easier to "undelete"
	// posts in certain situations.
	IsHidden bool

	// Counter of users that have liked this post.
	LikeCount uint64

	// Counter of users that have reposted this post.
	RepostCount uint64

	// Counter of quote reposts for this post.
	QuoteRepostCount uint64

	// Counter of diamonds that the post has received.
	DiamondCount uint64

	// How many comments this post has
	CommentCount uint64

	// Indicator if a post is pinned or not.
	IsPinned bool

	// NFT info.
	IsNFT                          bool
	NumNFTCopies                   uint64
	NumNFTCopiesForSale            uint64
	NumNFTCopiesBurned             uint64
	HasUnlockable                  bool
	NFTRoyaltyToCreatorBasisPoints uint64
	NFTRoyaltyToCoinBasisPoints    uint64

	// AdditionalNFTRoyaltiesToCreatorsBasisPoints is a map where keys are PKIDs and values are uint64s representing
	// basis points. The user with the PKID specified should receive the basis points specified by the value as a
	// royalty anytime this NFT is sold. This map must not contain the post creator.
	AdditionalNFTRoyaltiesToCreatorsBasisPoints map[PKID]uint64
	// AdditionalNFTRoyaltiesToCoinsBasisPoints is a map where keys are PKIDs and values are uint64s representing
	// basis points. The user with the PKID specified should have the basis points specified as by the value added to
	// the DESO locked in their profile anytime this NFT is sold. This map must not contain the post creator.
	AdditionalNFTRoyaltiesToCoinsBasisPoints map[PKID]uint64

	// ExtraData map to hold arbitrary attributes of a post. Holds non-consensus related information about a post.
	// TODO: Change to just ExtraData. Will be easy to do once we have hypersync
	// encoders/decoders, but for now doing so would mess up GOB encoding so we'll
	// wait.
	PostExtraData map[string][]byte

	// If a PostEntry is frozen then it can no longer be updated.
	// That includes unfreezing the post.
	IsFrozen bool
	// contains filtered or unexported fields
}

func DBGetPostEntryByPostHash

func DBGetPostEntryByPostHash(db *badger.DB, snap *Snapshot, postHash *BlockHash) *PostEntry

func DBGetPostEntryByPostHashWithTxn

func DBGetPostEntryByPostHashWithTxn(txn *badger.Txn, snap *Snapshot,
	postHash *BlockHash) *PostEntry

func (*PostEntry) GetEncoderType

func (pe *PostEntry) GetEncoderType() EncoderType

func (*PostEntry) GetVersionByte

func (pe *PostEntry) GetVersionByte(blockHeight uint64) byte

func (*PostEntry) HasMedia

func (pe *PostEntry) HasMedia() bool

func (*PostEntry) IsDeleted

func (pe *PostEntry) IsDeleted() bool

func (*PostEntry) RawDecodeWithoutMetadata

func (pe *PostEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*PostEntry) RawEncodeWithoutMetadata

func (pe *PostEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type PostEntryReaderState

type PostEntryReaderState struct {
	// This is true if the reader has liked the associated post.
	LikedByReader bool

	// The number of diamonds that the reader has given this post.
	DiamondLevelBestowed int64

	// This is true if the reader has reposted the associated post.
	RepostedByReader bool

	// This is the post hash hex of the repost
	RepostPostHashHex string
}

This struct holds info on a readers interactions (e.g. likes) with a post. It is added to a post entry response in the frontend server api.

type Postgres

type Postgres struct {
	// contains filtered or unexported fields
}

func NewPostgres

func NewPostgres(db *pg.DB) *Postgres

func (*Postgres) CheckDmThreadExistence added in v3.2.0

func (postgres *Postgres) CheckDmThreadExistence(dmThreadKey DmThreadKey) *DmThreadEntry

func (*Postgres) DeleteTransactionsForBlock added in v3.2.0

func (postgres *Postgres) DeleteTransactionsForBlock(block *MsgDeSoBlock, blockNode *BlockNode) error

func (*Postgres) FlushView

func (postgres *Postgres) FlushView(view *UtxoView, blockHeight uint64) error

func (*Postgres) GetAccessGroupByAccessGroupId added in v3.2.0

func (postgres *Postgres) GetAccessGroupByAccessGroupId(accessGroupId *AccessGroupId) *PGAccessGroupEntry

func (*Postgres) GetAccessGroupEntriesForOwner added in v3.2.0

func (postgres *Postgres) GetAccessGroupEntriesForOwner(ownerPublicKey PublicKey) []*PGAccessGroupEntry

func (*Postgres) GetAccessGroupEnumerationEntriesForMember added in v3.2.0

func (postgres *Postgres) GetAccessGroupEnumerationEntriesForMember(memberPublicKey PublicKey) (
	_accessGroupIdsMember []*PGAccessGroupMemberEnumerationEntry, _err error)

func (*Postgres) GetAccessGroupMemberEntry added in v3.2.0

func (postgres *Postgres) GetAccessGroupMemberEntry(accessGroupMemberPublicKey PublicKey,
	accessGroupOwnerPublicKey PublicKey, accessGroupKeyName GroupKeyName) *PGAccessGroupMemberEntry

func (*Postgres) GetAccessGroupMemberEnumerationEntry added in v3.2.0

func (postgres *Postgres) GetAccessGroupMemberEnumerationEntry(accessGroupMemberPublicKey PublicKey,
	accessGroupOwnerPublicKey PublicKey, accessGroupKeyName GroupKeyName) bool

func (*Postgres) GetAllDAOCoinLimitOrders

func (postgres *Postgres) GetAllDAOCoinLimitOrders() ([]*DAOCoinLimitOrderEntry, error)

func (*Postgres) GetAllDAOCoinLimitOrdersForThisDAOCoinPair

func (postgres *Postgres) GetAllDAOCoinLimitOrdersForThisDAOCoinPair(
	buyingDAOCoinCreatorPKID *PKID,
	sellingDAOCoinCreatorPKID *PKID) ([]*DAOCoinLimitOrderEntry, error)

func (*Postgres) GetAllDAOCoinLimitOrdersForThisTransactor

func (postgres *Postgres) GetAllDAOCoinLimitOrdersForThisTransactor(transactorPKID *PKID) ([]*DAOCoinLimitOrderEntry, error)

func (*Postgres) GetAllDerivedKeysForOwner

func (postgres *Postgres) GetAllDerivedKeysForOwner(ownerPublicKey *PublicKey) []*PGDerivedKey

func (*Postgres) GetAllUserDmThreads added in v3.2.0

func (postgres *Postgres) GetAllUserDmThreads(userAccessGroupOwnerPublicKey PublicKey) ([]*DmThreadKey, error)

func (*Postgres) GetBalance

func (postgres *Postgres) GetBalance(publicKey *PublicKey) uint64

func (*Postgres) GetBlockIndex

func (postgres *Postgres) GetBlockIndex() (map[BlockHash]*BlockNode, error)

GetBlockIndex gets all the PGBlocks and creates a map of BlockHash to BlockNode as needed by blockchain.go

func (*Postgres) GetBlockRewardsForPublicKey

func (postgres *Postgres) GetBlockRewardsForPublicKey(publicKey *PublicKey, startHeight uint32, endHeight uint32) []*PGTransactionOutput

func (*Postgres) GetChain

func (postgres *Postgres) GetChain(name string) *PGChain

GetChain returns the current chain by name. Postgres only supports MAIN_CHAIN for now but will eventually support multiple chains. A chain is defined by its Name and TipHash.

func (*Postgres) GetComments

func (postgres *Postgres) GetComments(parentPostHash *BlockHash) []*PGPost

TODO: Pagination

func (*Postgres) GetCreatorCoinBalance

func (postgres *Postgres) GetCreatorCoinBalance(holderPkid *PKID, creatorPkid *PKID) *PGCreatorCoinBalance

func (*Postgres) GetCreatorCoinBalances

func (postgres *Postgres) GetCreatorCoinBalances(balances []*PGCreatorCoinBalance) []*PGCreatorCoinBalance

func (*Postgres) GetCreatorCoinHolders

func (postgres *Postgres) GetCreatorCoinHolders(pkid *PKID) []*PGCreatorCoinBalance

func (*Postgres) GetCreatorCoinHoldings

func (postgres *Postgres) GetCreatorCoinHoldings(pkid *PKID) []*PGCreatorCoinBalance

func (*Postgres) GetDAOCoinBalance

func (postgres *Postgres) GetDAOCoinBalance(holderPkid *PKID, creatorPkid *PKID) *PGDAOCoinBalance

func (*Postgres) GetDAOCoinBalances

func (postgres *Postgres) GetDAOCoinBalances(balances []*PGDAOCoinBalance) []*PGDAOCoinBalance

func (*Postgres) GetDAOCoinHolders

func (postgres *Postgres) GetDAOCoinHolders(pkid *PKID) []*PGDAOCoinBalance

func (*Postgres) GetDAOCoinHoldings

func (postgres *Postgres) GetDAOCoinHoldings(pkid *PKID) []*PGDAOCoinBalance

func (*Postgres) GetDAOCoinLimitOrder

func (postgres *Postgres) GetDAOCoinLimitOrder(orderID *BlockHash) (*DAOCoinLimitOrderEntry, error)

func (*Postgres) GetDerivedKey

func (postgres *Postgres) GetDerivedKey(ownerPublicKey *PublicKey, derivedPublicKey *PublicKey) *PGDerivedKey

func (*Postgres) GetDiamond

func (postgres *Postgres) GetDiamond(senderPkid *PKID, receiverPkid *PKID, postHash *BlockHash) *PGDiamond

func (*Postgres) GetFollow

func (postgres *Postgres) GetFollow(followerPkid *PKID, followedPkid *PKID) *PGFollow

func (*Postgres) GetFollowers

func (postgres *Postgres) GetFollowers(pkid *PKID) []*PGFollow

func (*Postgres) GetFollowing

func (postgres *Postgres) GetFollowing(pkid *PKID) []*PGFollow

func (*Postgres) GetFollows

func (postgres *Postgres) GetFollows(follows []*PGFollow) []*PGFollow

func (*Postgres) GetLike

func (postgres *Postgres) GetLike(likerPublicKey []byte, likedPostHash *BlockHash) *PGLike

func (*Postgres) GetLikes

func (postgres *Postgres) GetLikes(likes []*PGLike) []*PGLike

func (*Postgres) GetLikesForPost

func (postgres *Postgres) GetLikesForPost(postHash *BlockHash) []*PGLike

func (*Postgres) GetMatchingDAOCoinLimitOrders

func (postgres *Postgres) GetMatchingDAOCoinLimitOrders(inputOrder *DAOCoinLimitOrderEntry, lastSeenOrder *DAOCoinLimitOrderEntry, orderEntriesInView map[DAOCoinLimitOrderMapKey]bool) ([]*DAOCoinLimitOrderEntry, error)

func (*Postgres) GetMessage

func (postgres *Postgres) GetMessage(messageHash *BlockHash) *PGMessage

func (*Postgres) GetNFT

func (postgres *Postgres) GetNFT(nftPostHash *BlockHash, serialNumber uint64) *PGNFT

func (*Postgres) GetNFTBid

func (postgres *Postgres) GetNFTBid(nftPostHash *BlockHash, bidderPKID *PKID, serialNumber uint64) *PGNFTBid

func (*Postgres) GetNFTBidsForPKID

func (postgres *Postgres) GetNFTBidsForPKID(pkid *PKID) []*PGNFTBid

func (*Postgres) GetNFTBidsForSerial

func (postgres *Postgres) GetNFTBidsForSerial(nftPostHash *BlockHash, serialNumber uint64) []*PGNFTBid

func (*Postgres) GetNFTsForPKID

func (postgres *Postgres) GetNFTsForPKID(pkid *PKID) []*PGNFT

func (*Postgres) GetNFTsForPostHash

func (postgres *Postgres) GetNFTsForPostHash(nftPostHash *BlockHash) []*PGNFT

func (*Postgres) GetNewMessageDmEntry added in v3.2.0

func (postgres *Postgres) GetNewMessageDmEntry(dmMessageKey DmMessageKey) *PGNewMessageDmEntry

func (*Postgres) GetNewMessageGroupChatEntry added in v3.2.0

func (postgres *Postgres) GetNewMessageGroupChatEntry(groupChatMessageKey GroupChatMessageKey) *PGNewMessageGroupChatEntry

func (*Postgres) GetNotifications

func (postgres *Postgres) GetNotifications(publicKey string) ([]*PGNotification, error)

func (*Postgres) GetOutputs

func (postgres *Postgres) GetOutputs(outputs []*PGTransactionOutput) []*PGTransactionOutput

func (*Postgres) GetPaginatedAccessGroupMembersFromEnumerationIndex added in v3.2.0

func (postgres *Postgres) GetPaginatedAccessGroupMembersFromEnumerationIndex(accessGroupOwnerPublicKey PublicKey,
	accessGroupKeyName GroupKeyName, startingAccessGroupMemberPublicKeyBytes []byte, maxMembersToFetch uint32) (
	_accessGroupMemberPublicKeys []*PublicKey, _err error)

func (*Postgres) GetPaginatedMessageEntriesForDmThread added in v3.2.0

func (postgres *Postgres) GetPaginatedMessageEntriesForDmThread(dmThreadKey DmThreadKey, maxTimestamp uint64,
	maxMessagesToFetch uint64) (_messageEntries []*NewMessageEntry, _err error)

func (*Postgres) GetPaginatedMessageEntriesForGroupChatThread added in v3.2.0

func (postgres *Postgres) GetPaginatedMessageEntriesForGroupChatThread(groupChatThread AccessGroupId, startingTimestamp uint64,
	maxMessagesToFetch uint64) (_messageEntries []*NewMessageEntry, _err error)

func (*Postgres) GetPost

func (postgres *Postgres) GetPost(postHash *BlockHash) *PGPost

func (*Postgres) GetPostAssociationByAttributes added in v3.2.0

func (postgres *Postgres) GetPostAssociationByAttributes(associationEntry *PostAssociationEntry) (*PostAssociationEntry, error)

func (*Postgres) GetPostAssociationByID added in v3.2.0

func (postgres *Postgres) GetPostAssociationByID(associationID *BlockHash) (*PostAssociationEntry, error)

func (*Postgres) GetPostAssociationIdsByAttributes added in v3.2.0

func (postgres *Postgres) GetPostAssociationIdsByAttributes(
	associationQuery *PostAssociationQuery, utxoViewAssociationIds *Set[BlockHash],
) (*Set[BlockHash], []byte, error)

func (*Postgres) GetPostAssociationsByAttributes added in v3.2.0

func (postgres *Postgres) GetPostAssociationsByAttributes(
	associationQuery *PostAssociationQuery, utxoViewAssociationIds *Set[BlockHash],
) ([]*PostAssociationEntry, []byte, error)

func (*Postgres) GetPosts

func (postgres *Postgres) GetPosts(posts []*PGPost) []*PGPost

func (*Postgres) GetPostsForPublicKey

func (postgres *Postgres) GetPostsForPublicKey(publicKey []byte, startTime uint64, limit uint64) []*PGPost

func (*Postgres) GetProfile

func (postgres *Postgres) GetProfile(pkid PKID) *PGProfile

func (*Postgres) GetProfileForPublicKey

func (postgres *Postgres) GetProfileForPublicKey(publicKey []byte) *PGProfile

func (*Postgres) GetProfileForUsername

func (postgres *Postgres) GetProfileForUsername(nonLowercaseUsername string) *PGProfile

func (*Postgres) GetProfilesByCoinValue

func (postgres *Postgres) GetProfilesByCoinValue(startLockedNanos uint64, limit int) []*PGProfile

func (*Postgres) GetProfilesForPublicKeys

func (postgres *Postgres) GetProfilesForPublicKeys(publicKeys []*PublicKey) []*PGProfile

func (*Postgres) GetProfilesForUsername

func (postgres *Postgres) GetProfilesForUsername(usernames []string) []*PGProfile

func (*Postgres) GetProfilesForUsernamePrefixByCoinValue

func (postgres *Postgres) GetProfilesForUsernamePrefixByCoinValue(usernamePrefix string, limit int) []*PGProfile

func (*Postgres) GetTransactionByHash

func (postgres *Postgres) GetTransactionByHash(txnHash *BlockHash) *PGTransaction

func (*Postgres) GetUserAssociationByAttributes added in v3.2.0

func (postgres *Postgres) GetUserAssociationByAttributes(associationEntry *UserAssociationEntry) (*UserAssociationEntry, error)

func (*Postgres) GetUserAssociationByID added in v3.2.0

func (postgres *Postgres) GetUserAssociationByID(associationID *BlockHash) (*UserAssociationEntry, error)

func (*Postgres) GetUserAssociationIdsByAttributes added in v3.2.0

func (postgres *Postgres) GetUserAssociationIdsByAttributes(
	associationQuery *UserAssociationQuery, utxoViewAssociationIds *Set[BlockHash],
) (*Set[BlockHash], []byte, error)

func (*Postgres) GetUserAssociationsByAttributes added in v3.2.0

func (postgres *Postgres) GetUserAssociationsByAttributes(
	associationQuery *UserAssociationQuery, utxoViewAssociationIds *Set[BlockHash],
) ([]*UserAssociationEntry, []byte, error)

func (*Postgres) GetUtxoEntriesForPublicKey

func (postgres *Postgres) GetUtxoEntriesForPublicKey(publicKey []byte) []*UtxoEntry

func (*Postgres) GetUtxoEntryForUtxoKey

func (postgres *Postgres) GetUtxoEntryForUtxoKey(utxoKey *UtxoKey) *UtxoEntry

func (*Postgres) InitGenesisBlock

func (postgres *Postgres) InitGenesisBlock(params *DeSoParams, db *badger.DB) error

func (*Postgres) InsertTransactionsTx

func (postgres *Postgres) InsertTransactionsTx(tx *pg.Tx, desoTxns []*MsgDeSoTxn, blockNode *BlockNode, delete bool) error

InsertTransactionsTx inserts all the transactions from a block in a bulk query

func (*Postgres) UpsertBlock

func (postgres *Postgres) UpsertBlock(blockNode *BlockNode) error

func (*Postgres) UpsertBlockAndTransactions

func (postgres *Postgres) UpsertBlockAndTransactions(blockNode *BlockNode, desoBlock *MsgDeSoBlock) error

func (*Postgres) UpsertBlockTx

func (postgres *Postgres) UpsertBlockTx(tx *pg.Tx, blockNode *BlockNode) error

func (*Postgres) UpsertChain

func (postgres *Postgres) UpsertChain(name string, tipHash *BlockHash) error

func (*Postgres) UpsertChainTx

func (postgres *Postgres) UpsertChainTx(tx *pg.Tx, name string, tipHash *BlockHash) error

type PrivateMessageMetadata

type PrivateMessageMetadata struct {

	// The public key of the recipient of the message.
	RecipientPublicKey []byte

	// The content of the message. It is encrypted with the recipient's
	// public key using ECIES.
	EncryptedText []byte

	// A timestamp used for ordering messages when displaying them to
	// users. The timestamp must be unique. Note that we use a nanosecond
	// timestamp because it makes it easier to deal with the uniqueness
	// constraint technically (e.g. If one second spacing is required
	// as would be the case with a standard Unix timestamp then any code
	// that generates these transactions will need to potentially wait
	// or else risk a timestamp collision. This complexity is avoided
	// by just using a nanosecond timestamp). Note that the timestamp is
	// an unsigned int as opposed to a signed int, which means times
	// before the zero time are not represented which doesn't matter
	// for our purposes. Restricting the timestamp in this way makes
	// lexicographic sorting based on bytes easier in our database which
	// is one of the reasons we do it.
	TimestampNanos uint64
}

func (*PrivateMessageMetadata) FromBytes

func (txnData *PrivateMessageMetadata) FromBytes(data []byte) error

func (*PrivateMessageMetadata) GetTxnType

func (txnData *PrivateMessageMetadata) GetTxnType() TxnType

func (*PrivateMessageMetadata) New

func (txnData *PrivateMessageMetadata) New() DeSoTxnMetadata

func (*PrivateMessageMetadata) ToBytes

func (txnData *PrivateMessageMetadata) ToBytes(preSignature bool) ([]byte, error)

type PrivateMessageTxindexMetadata

type PrivateMessageTxindexMetadata struct {
	TimestampNanos uint64
}

func (*PrivateMessageTxindexMetadata) GetEncoderType

func (txnMeta *PrivateMessageTxindexMetadata) GetEncoderType() EncoderType

func (*PrivateMessageTxindexMetadata) GetVersionByte

func (txnMeta *PrivateMessageTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*PrivateMessageTxindexMetadata) RawDecodeWithoutMetadata

func (txnMeta *PrivateMessageTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*PrivateMessageTxindexMetadata) RawEncodeWithoutMetadata

func (txnMeta *PrivateMessageTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type ProfileEntry

type ProfileEntry struct {
	// PublicKey is the key used by the user to sign for things and generally
	// verify her identity.
	PublicKey []byte

	// Username is a unique human-readable identifier associated with a profile.
	Username []byte

	// Some text describing the profile.
	Description []byte

	// The profile pic string encoded as a link e.g.
	// data:image/png;base64,<data in base64>
	ProfilePic []byte

	// Users can "delete" profiles, but right now we just implement this as
	// setting a flag on the post to hide it rather than actually deleting
	// it. This simplifies the implementation and makes it easier to "undelete"
	// profiles in certain situations.
	IsHidden bool

	// CreatorCoinEntry tracks the information required to buy/sell creator coins on a user's
	// profile. We "embed" it here for convenience so we can access the fields
	// directly on the ProfileEntry object. Embedding also makes it so that we
	// don't need to initialize it explicitly.
	CreatorCoinEntry CoinEntry

	// DAOCoinEntry tracks the information around the DAO coins issued on a user's profile.
	// Note: the following fields are basically ignored for the DAOCoinEntry
	// 1. CreatorBasisPoints
	// 2. DeSoLockedNanos
	// 3. CoinWaterMarkNanos
	DAOCoinEntry CoinEntry

	// ExtraData map to hold arbitrary attributes of a profile. Holds
	// non-consensus related information about a profile.
	ExtraData map[string][]byte
	// contains filtered or unexported fields
}

func DBGetPaginatedProfilesByDeSoLocked

func DBGetPaginatedProfilesByDeSoLocked(
	db *badger.DB, snap *Snapshot, startDeSoLockedNanos uint64,
	startProfilePubKeyy []byte, numToFetch int, fetchProfileEntries bool) (
	_profilePublicKeys [][]byte, _profileEntries []*ProfileEntry, _err error)

DBGetPaginatedProfilesByDeSoLocked returns up to 'numToFetch' profiles from the db.

func DBGetProfileEntryForPKID

func DBGetProfileEntryForPKID(db *badger.DB, snap *Snapshot, pkid *PKID) *ProfileEntry

func DBGetProfileEntryForPKIDWithTxn

func DBGetProfileEntryForPKIDWithTxn(txn *badger.Txn, snap *Snapshot,
	pkid *PKID) *ProfileEntry

func DBGetProfileEntryForUsername

func DBGetProfileEntryForUsername(db *badger.DB, snap *Snapshot, username []byte) *ProfileEntry

func DBGetProfileEntryForUsernameWithTxn

func DBGetProfileEntryForUsernameWithTxn(txn *badger.Txn,
	snap *Snapshot, username []byte) *ProfileEntry

func DBGetProfilesByUsernamePrefixAndDeSoLocked

func DBGetProfilesByUsernamePrefixAndDeSoLocked(db *badger.DB,
	snap *Snapshot, usernamePrefix string, utxoView *UtxoView) (
	_profileEntries []*ProfileEntry, _err error)

func (*ProfileEntry) GetEncoderType

func (pe *ProfileEntry) GetEncoderType() EncoderType

func (*ProfileEntry) GetVersionByte

func (pe *ProfileEntry) GetVersionByte(blockHeight uint64) byte

func (*ProfileEntry) IsDeleted

func (pe *ProfileEntry) IsDeleted() bool

func (*ProfileEntry) RawDecodeWithoutMetadata

func (pe *ProfileEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*ProfileEntry) RawEncodeWithoutMetadata

func (pe *ProfileEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type PublicKey

type PublicKey [PublicKeyLenCompressed]byte

func DBGetPaginatedAccessGroupMembersFromEnumerationIndex added in v3.2.0

func DBGetPaginatedAccessGroupMembersFromEnumerationIndex(handle *badger.DB, snap *Snapshot,
	groupOwnerPublicKey PublicKey, groupKeyName GroupKeyName, startingAccessGroupMemberPublicKeyBytes []byte, limit uint32) (
	_accessGroupMemberPublicKeys []*PublicKey, _err error)

func DBGetPaginatedAccessGroupMembersFromEnumerationIndexWithTxn added in v3.2.0

func DBGetPaginatedAccessGroupMembersFromEnumerationIndexWithTxn(txn *badger.Txn, snap *Snapshot,
	groupOwnerPublicKey PublicKey, groupKeyName GroupKeyName, startingAccessGroupMemberPublicKeyBytes []byte,
	maxMembersToFetch uint32) (_accessGroupMemberPublicKeys []*PublicKey, _err error)

DBGetPaginatedAccessGroupMembersFromEnumerationIndexWithTxn for a given group will return a list of group members, with public keys lexicographically GREATER than startingAccessGroupMemberPublicKeyBytes. The number of returned entries will be at most maxMembersToFetch.

func NewPublicKey

func NewPublicKey(publicKeyBytes []byte) *PublicKey

func ReadOptionalPublicKey

func ReadOptionalPublicKey(rr *bytes.Reader) (*PublicKey, error)

func ReadPublicKey

func ReadPublicKey(rr io.Reader) (*PublicKey, error)

func (*PublicKey) Equal added in v3.2.0

func (publicKey *PublicKey) Equal(other PublicKey) bool

func (*PublicKey) GetEncoderType

func (publicKey *PublicKey) GetEncoderType() EncoderType

func (*PublicKey) GetVersionByte

func (publicKey *PublicKey) GetVersionByte(blockHeight uint64) byte

func (*PublicKey) IsZeroPublicKey

func (publicKey *PublicKey) IsZeroPublicKey() bool

func (*PublicKey) RawDecodeWithoutMetadata

func (publicKey *PublicKey) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*PublicKey) RawEncodeWithoutMetadata

func (publicKey *PublicKey) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

func (*PublicKey) ToBytes

func (publicKey *PublicKey) ToBytes() []byte

type PublicKeyRoyaltyPair

type PublicKeyRoyaltyPair struct {
	PublicKey          []byte
	RoyaltyAmountNanos uint64
}

func (*PublicKeyRoyaltyPair) GetEncoderType

func (pair *PublicKeyRoyaltyPair) GetEncoderType() EncoderType

func (*PublicKeyRoyaltyPair) GetVersionByte

func (pair *PublicKeyRoyaltyPair) GetVersionByte(blockHeight uint64) byte

func (*PublicKeyRoyaltyPair) RawDecodeWithoutMetadata

func (pair *PublicKeyRoyaltyPair) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*PublicKeyRoyaltyPair) RawEncodeWithoutMetadata

func (pair *PublicKeyRoyaltyPair) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type PurchaseSupplyIntervalStart

type PurchaseSupplyIntervalStart struct {
	// How much each unit costs to purchase in Satoshis.
	SatoshisPerUnit uint64
	// The total supply cutoff at which this price applies.
	SupplyStartNanos uint64
}

type RepostEntry

type RepostEntry struct {
	ReposterPubKey []byte

	// BlockHash of the repost
	RepostPostHash *BlockHash

	// Post Hash of post that was reposted
	RepostedPostHash *BlockHash
	// contains filtered or unexported fields
}

RepostEntry stores the content of a Repost transaction.

func DbGetReposterPubKeyRepostedPostHashToRepostEntryWithTxn

func DbGetReposterPubKeyRepostedPostHashToRepostEntryWithTxn(txn *badger.Txn,
	snap *Snapshot, userPubKey []byte, repostedPostHash BlockHash) *RepostEntry

func DbReposterPubKeyRepostedPostHashToRepostEntry

func DbReposterPubKeyRepostedPostHashToRepostEntry(db *badger.DB,
	snap *Snapshot, userPubKey []byte, repostedPostHash BlockHash) *RepostEntry

func (*RepostEntry) GetEncoderType

func (re *RepostEntry) GetEncoderType() EncoderType

func (*RepostEntry) GetVersionByte

func (re *RepostEntry) GetVersionByte(blockHeight uint64) byte

func (*RepostEntry) RawDecodeWithoutMetadata

func (re *RepostEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*RepostEntry) RawEncodeWithoutMetadata

func (re *RepostEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type RepostKey

type RepostKey struct {
	ReposterPubKey PkMapKey
	// Post Hash of post that was reposted
	RepostedPostHash BlockHash
}

func MakeRepostKey

func MakeRepostKey(userPk []byte, RepostedPostHash BlockHash) RepostKey

type RuleError

type RuleError string

RuleError is an error type that specifies an error occurred during block processing that is related to a consensus rule. By checking the type of the error the caller can determine that the error was due to a consensus rule and determine which consensus rule caused the issue.

const (
	RuleErrorDuplicateBlock                       RuleError = "RuleErrorDuplicateBlock"
	RuleErrorDuplicateOrphan                      RuleError = "RuleErrorDuplicateOrphan"
	RuleErrorMinDifficulty                        RuleError = "RuleErrorMinDifficulty"
	RuleErrorBlockTooBig                          RuleError = "RuleErrorBlockTooBig"
	RuleErrorNoTxns                               RuleError = "RuleErrorNoTxns"
	RuleErrorFirstTxnMustBeBlockReward            RuleError = "RuleErrorFirstTxnMustBeBlockReward"
	RuleErrorMoreThanOneBlockReward               RuleError = "RuleErrorMoreThanOneBlockReward"
	RuleErrorPreviousBlockInvalid                 RuleError = "RuleErrorPreviousBlockInvalid"
	RuleErrorPreviousBlockHeaderInvalid           RuleError = "RuleErrorPreviousBlockHeaderInvalid"
	RuleErrorTxnMustHaveAtLeastOneInput           RuleError = "RuleErrorTxnMustHaveAtLeastOneInput"
	RuleErrorTxnMustHaveAtLeastOneOutput          RuleError = "RuleErrorTxnMustHaveAtLeastOneOutput"
	RuleErrorOutputExceedsMax                     RuleError = "RuleErrorOutputExceedsMax"
	RuleErrorOutputOverflowsTotal                 RuleError = "RuleErrorOutputOverflowsTotal"
	RuleErrorTotalOutputExceedsMax                RuleError = "RuleErrorTotalOutputExceedsMax"
	RuleErrorDuplicateInputs                      RuleError = "RuleErrorDuplicateInputs"
	RuleErrorInvalidTxnMerkleRoot                 RuleError = "RuleErrorInvalidTxnMerkleRoot"
	RuleErrorDuplicateTxn                         RuleError = "RuleErrorDuplicateTxn"
	RuleErrorInputSpendsNonexistentUtxo           RuleError = "RuleErrorInputSpendsNonexistentUtxo"
	RuleErrorInputSpendsPreviouslySpentOutput     RuleError = "RuleErrorInputSpendsPreviouslySpentOutput"
	RuleErrorInputSpendsImmatureBlockReward       RuleError = "RuleErrorInputSpendsImmatureBlockReward"
	RuleErrorInputSpendsOutputWithInvalidAmount   RuleError = "RuleErrorInputSpendsOutputWithInvalidAmount"
	RuleErrorTxnOutputWithInvalidAmount           RuleError = "RuleErrorTxnOutputWithInvalidAmount"
	RuleErrorTxnOutputExceedsInput                RuleError = "RuleErrorTxnOutputExceedsInput"
	RuleErrorTxnFeeBelowNetworkMinimum            RuleError = "RuleErrorTxnFeeBelowNetworkMinimum"
	RuleErrorOverflowDetectedInFeeRateCalculation RuleError = "RuleErrorOverflowDetectedInFeeRateCalculation"
	RuleErrorBlockRewardOutputWithInvalidAmount   RuleError = "RuleErrorBlockRewardOutputWithInvalidAmount"
	RuleErrorBlockRewardOverflow                  RuleError = "RuleErrorBlockRewardOverflow"
	RuleErrorBlockRewardExceedsMaxAllowed         RuleError = "RuleErrorBlockRewardExceedsMaxAllowed"
	RuleErrorProfileUsernameExists                RuleError = "RuleErrorProfileUsernameExists"
	RuleErrorPubKeyLen                            RuleError = "RuleErrorPubKeyLen"
	RuleErrorMaxProfilePicSize                    RuleError = "RuleErrorMaxProfilePicSize"
	RuleErrorProfileCreatorPercentageSize         RuleError = "RuleErrorProfileCreatorPercentageSize"
	RuleErrorProfileStakeMultipleSize             RuleError = "RuleErrorProfileStakeMultipleSize"
	RuleErrorInvalidUsername                      RuleError = "RuleErrorInvalidUsername"
	RuleErrorEncryptedDataLen                     RuleError = "RuleErrorEncryptedDataLen"
	RuleErrorInputOverflows                       RuleError = "RuleErrorInputOverflows"
	RuleErrorInsufficientRefund                   RuleError = "RuleErrorInsufficientRefund"
	RuleErrorMissingSignature                     RuleError = "RuleErrorMissingSignature"
	RuleErrorSigHash                              RuleError = "RuleErrorSigHash"
	RuleErrorParsePublicKey                       RuleError = "RuleErrorParsePublicKey"
	RuleErrorSigCheckFailed                       RuleError = "RuleErrorSigCheckFailed"
	RuleErrorOutputPublicKeyNotRecognized         RuleError = "RuleErrorOutputPublicKeyNotRecognized"
	RuleErrorInputsWithDifferingSpendKeys         RuleError = "RuleErrorInputsWithDifferingSpendKeys"
	RuleErrorInvalidTransactionSignature          RuleError = "RuleErrorInvalidTransactionSignature"

	RuleErrorMissingBlockProducerSignature                      RuleError = "RuleErrorMissingBlockProducerSignature"
	RuleErrorInvalidBlockProducerPublicKey                      RuleError = "RuleErrorInvalidBlockProducerPublicKey"
	RuleErrorBlockProducerPublicKeyNotInWhitelist               RuleError = "RuleErrorBlockProducerPublicKeyNotInWhitelist"
	RuleErrorForbiddenBlockProducerPublicKey                    RuleError = "RuleErrorForbiddenBlockProducerPublicKey"
	RuleErrorInvalidBlockProducerSIgnature                      RuleError = "RuleErrorInvalidBlockProducerSIgnature"
	RuleErrorInvalidBlockHeader                                 RuleError = "RuleErrorInvalidBlockHeader"
	RuleErrorBlockAlreadyExists                                 RuleError = "RuleErrorBlockAlreadyExists"
	RuleErrorOrphanBlock                                        RuleError = "RuleErrorOrphanBlock"
	RuleErrorInputWithPublicKeyDifferentFromTxnPublicKey        RuleError = "RuleErrorInputWithPublicKeyDifferentFromTxnPublicKey"
	RuleErrorBlockRewardTxnNotAllowedToHaveInputs               RuleError = "RuleErrorBlockRewardTxnNotAllowedToHaveInputs"
	RuleErrorBlockRewardTxnNotAllowedToHaveSignature            RuleError = "RuleErrorBlockRewardTxnNotAllowedToHaveSignature"
	RuleErrorDeflationBombForbidsMintingAnyMoreDeSo             RuleError = "RuleErrorDeflationBombForbidsMintingAnyMoreDeSo"
	RuleErrorBitcoinExchangeShouldNotHaveInputs                 RuleError = "RuleErrorBitcoinExchangeShouldNotHaveInputs"
	RuleErrorBitcoinExchangeShouldNotHaveOutputs                RuleError = "RuleErrorBitcoinExchangeShouldNotHaveOutputs"
	RuleErrorBitcoinExchangeShouldNotHavePublicKey              RuleError = "RuleErrorBitcoinExchangeShouldNotHavePublicKey"
	RuleErrorBitcoinExchangeShouldNotHaveSignature              RuleError = "RuleErrorBitcoinExchangeShouldNotHaveSignature"
	RuleErrorBitcoinExchangeHasBadBitcoinTxHash                 RuleError = "RuleErrorBitcoinExchangeHasBadBitcoinTxHash"
	RuleErrorBitcoinExchangeDoubleSpendingBitcoinTransaction    RuleError = "RuleErrorBitcoinExchangeDoubleSpendingBitcoinTransaction"
	RuleErrorBitcoinExchangeBlockHashNotFoundInMainBitcoinChain RuleError = "RuleErrorBitcoinExchangeBlockHashNotFoundInMainBitcoinChain"
	RuleErrorBitcoinExchangeHasBadMerkleRoot                    RuleError = "RuleErrorBitcoinExchangeHasBadMerkleRoot"
	RuleErrorBitcoinExchangeInvalidMerkleProof                  RuleError = "RuleErrorBitcoinExchangeInvalidMerkleProof"
	RuleErrorBitcoinExchangeValidPublicKeyNotFoundInInputs      RuleError = "RuleErrorBitcoinExchangeValidPublicKeyNotFoundInInputs"
	RuleErrorBitcoinExchangeProblemComputingBurnOutput          RuleError = "RuleErrorBitcoinExchangeProblemComputingBurnOutput"
	RuleErrorBitcoinExchangeFeeOverflow                         RuleError = "RuleErrorBitcoinExchangeFeeOverflow"
	RuleErrorBitcoinExchangeTotalOutputLessThanOrEqualZero      RuleError = "RuleErrorBitcoinExchangeTotalOutputLessThanOrEqualZero"
	RuleErrorTxnSanity                                          RuleError = "RuleErrorTxnSanity"
	RuleErrorTxnTooBig                                          RuleError = "RuleErrorTxnTooBig"
	RuleErrorTxnSigHasHighS                                     RuleError = "RuleErrorTxnSigHasHighS"

	RuleErrorPrivateMessageEncryptedTextLengthExceedsMax           RuleError = "RuleErrorPrivateMessageEncryptedTextLengthExceedsMax"
	RuleErrorPrivateMessageRecipientPubKeyLen                      RuleError = "RuleErrorPrivateMessageRecipientPubKeyLen"
	RuleErrorPrivateMessageTstampIsZero                            RuleError = "RuleErrorPrivateMessageTstampIsZero"
	RuleErrorTransactionMissingPublicKey                           RuleError = "RuleErrorTransactionMissingPublicKey"
	RuleErrorPrivateMessageExistsWithSenderPublicKeyTstampTuple    RuleError = "RuleErrorPrivateMessageExistsWithSenderPublicKeyTstampTuple"
	RuleErrorPrivateMessageExistsWithRecipientPublicKeyTstampTuple RuleError = "RuleErrorPrivateMessageExistsWithRecipientPublicKeyTstampTuple"
	RuleErrorPrivateMessageParsePubKeyError                        RuleError = "RuleErrorPrivateMessageParsePubKeyError"
	RuleErrorPrivateMessageSenderPublicKeyEqualsRecipientPublicKey RuleError = "RuleErrorPrivateMessageSenderPublicKeyEqualsRecipientPublicKey"
	RuleErrorPrivateMessageMessagingPartyBeforeBlockHeight         RuleError = "RuleErrorPrivateMessageMessagingPartyBeforeBlockHeight"
	RuleErrorPrivateMessageSentWithoutProperMessagingParty         RuleError = "RuleErrorPrivateMessageSentWithoutProperMessagingParty"
	RuleErrorPrivateMessageFailedToValidateMessagingKey            RuleError = "RuleErrorPrivateMessageFailedToValidateMessagingKey"
	RuleErrorBurnAddressCannotBurnBitcoin                          RuleError = "RuleErrorBurnAddressCannotBurnBitcoin"
	RuleErrorPrivateMessageInvalidVersion                          RuleError = "RuleErrorPrivateMessageInvalidVersion"
	RuleErrorPrivateMessageMissingExtraData                        RuleError = "RuleErrorPrivateMessageMissingExtraData"

	RuleErrorAccessGroupsBeforeBlockHeight               RuleError = "RuleErrorAccessGroupsBeforeBlockHeight"
	RuleErrorAccessGroupsNameCannotBeZeros               RuleError = "RuleErrorAccessGroupsNameCannotBeZeros"
	RuleErrorAccessPublicKeyCannotBeOwnerKey             RuleError = "RuleErrorAccessPublicKeyCannotBeOwnerKey"
	RuleErrorAccessGroupOwnerPublicKeyCannotBeDifferent  RuleError = "RuleErrorAccessGroupOwnerPublicKeyCannotBeDifferent"
	RuleErrorAccessGroupAlreadyExists                    RuleError = "RuleErrorAccessGroupAlreadyExists"
	RuleErrorAccessGroupDoesNotExist                     RuleError = "RuleErrorAccessGroupDoesNotExist"
	RuleErrorAccessGroupOperationTypeNotSupported        RuleError = "RuleErrorAccessGroupOperationTypeNotSupported"
	RuleErrorAccessGroupMembersBeforeBlockHeight         RuleError = "RuleErrorAccessGroupMembersBeforeBlockHeight"
	RuleErrorAccessGroupDoesntExist                      RuleError = "RuleErrorAccessGroupDoesntExist"
	RuleErrorAccessGroupKeyNameTooShort                  RuleError = "RuleErrorAccessGroupKeyNameTooShort"
	RuleErrorAccessGroupKeyNameTooLong                   RuleError = "RuleErrorAccessGroupKeyNameTooLong"
	RuleErrorAccessGroupMembersListCannotBeEmpty         RuleError = "RuleErrorAccessGroupMembersListCannotBeEmpty"
	RuleErrorAccessMemberAlreadyExists                   RuleError = "RuleErrorAccessMemberAlreadyExists"
	RuleErrorAccessGroupMemberOperationTypeNotSupported  RuleError = "RuleErrorAccessGroupMemberOperationTypeNotSupported"
	RuleErrorAccessMemberDoesntExist                     RuleError = "RuleErrorAccessMemberDoesntExist"
	RuleErrorAccessGroupMemberListDuplicateMember        RuleError = "RuleErrorAccessGroupMemberListDuplicateMember"
	RuleErrorAccessGroupMemberCantAddOwnerBySameGroup    RuleError = "RuleErrorAccessGroupMemberCantAddOwnerBySameGroup"
	RuleErrorAccessGroupMemberDoesntExistOrIsDeleted     RuleError = "RuleErrorAccessGroupMemberDoesntExistOrIsDeleted"
	RuleErrorAccessGroupMemberRemoveEncryptedKeyNotEmpty RuleError = "RuleErrorAccessGroupMemberRemoveEncryptedKeyNotEmpty"
	RuleErrorAccessGroupMemberRemoveExtraDataNotEmpty    RuleError = "RuleErrorAccessGroupMemberRemoveExtraDataNotEmpty"
	RuleErrorAccessGroupPrevMembersListIsIncorrect       RuleError = "RuleErrorAccessGroupPrevMembersListIsIncorrect"
	RuleErrorAccessGroupMemberEnumerationRecursionLimit  RuleError = "RuleErrorAccessGroupMemberEnumerationRecursionLimit"
	RuleErrorAccessGroupMemberPublicKeyMismatch          RuleError = "RuleErrorAccessGroupMemberPublicKeyMismatch"
	RuleErrorAccessGroupCreateRequiresNonZeroInput       RuleError = "RuleErrorAccessGroupCreateRequiresNonZeroInput"
	RuleErrorAccessGroupTransactionSpendingLimitInvalid  RuleError = "RuleErrorAccessGroupTransactionSpendingLimitInvalid"
	RuleErrorAccessGroupMemberSpendingLimitInvalid       RuleError = "RuleErrorAccessGroupMemberSpendingLimitInvalid"
	RuleErrorAccessGroupMemberPublicKeyCannotBeDifferent RuleError = "RuleErrorAccessGroupMemberPublicKeyCannotBeDifferent"

	RuleErrorNewMessageEncryptedTextLengthExceedsMax         RuleError = "RuleErrorNewMessageEncryptedTextLengthExceedsMax"
	RuleErrorNewMessageTimestampNanosCannotBeZero            RuleError = "RuleErrorNewMessageTimestampNanosCannotBeZero"
	RuleErrorNewMessageDmSenderAndRecipientCannotBeTheSame   RuleError = "RuleErrorNewMessageDmSenderAndRecipientCannotBeTheSame"
	RuleErrorNewMessageDmMessageAlreadyExists                RuleError = "RuleErrorNewMessageDmMessageAlreadyExists"
	RuleErrorNewMessageDmMessageDoesNotExist                 RuleError = "RuleErrorNewMessageDmMessageDoesNotExist"
	RuleErrorNewMessageDmMessageTimestampMismatch            RuleError = "RuleErrorNewMessageDmMessageTimestampMismatch"
	RuleErrorNewMessageMessageSenderDoesNotMatchTxnPublicKey RuleError = "RuleErrorNewMessageMessageSenderDoesNotMatchTxnPublicKey"
	RuleErrorNewMessageBeforeDeSoAccessGroups                RuleError = "RuleErrorNewMessageBeforeDeSoAccessGroups"
	RuleErrorNewMessageGroupChatMessageAlreadyExists         RuleError = "RuleErrorNewMessageGroupChatMessageAlreadyExists"
	RuleErrorNewMessageGroupChatMessageDoesNotExist          RuleError = "RuleErrorNewMessageGroupChatMessageDoesNotExist"
	RuleErrorNewMessageGroupMessageTimestampMismatch         RuleError = "RuleErrorNewMessageGroupMessageTimestampMismatch"
	RuleErrorNewMessageGetDmMessagesRecursionLimit           RuleError = "RuleErrorNewMessageGetDmMessagesRecursionLimit"
	RuleErrorNewMessageGetGroupMessagesRecursionLimit        RuleError = "RuleErrorNewMessageGetGroupMessagesRecursionLimit"
	RuleErrorNewMessageGroupChatMemberEntryDoesntExist       RuleError = "RuleErrorNewMessageGroupChatMemberEntryDoesntExist"
	RuleErrorNewMessageUnknownMessageType                    RuleError = "RuleErrorNewMessageUnknownMessageType"
	RuleErrorNewMessageUnknownOperationType                  RuleError = "RuleErrorNewMessageUnknownOperationType"

	RuleErrorFollowPubKeyLen                         RuleError = "RuleErrorFollowFollowedPubKeyLen"
	RuleErrorFollowParsePubKeyError                  RuleError = "RuleErrorFollowParsePubKeyError"
	RuleErrorFollowEntryAlreadyExists                RuleError = "RuleErrorFollowEntryAlreadyExists"
	RuleErrorFollowingNonexistentProfile             RuleError = "RuleErrorFollowingNonexistentProfile"
	RuleErrorCannotUnfollowNonexistentFollowEntry    RuleError = "RuleErrorCannotUnfollowNonexistentFollowEntry"
	RuleErrorProfilePublicKeyNotEqualToPKIDPublicKey RuleError = "RuleErrorProfilePublicKeyNotEqualToPKIDPublicKey"

	RuleErrorLikeEntryAlreadyExists            RuleError = "RuleErrorLikeEntryAlreadyExists"
	RuleErrorCannotLikeNonexistentPost         RuleError = "RuleErrorCannotLikeNonexistentPost"
	RuleErrorCannotUnlikeWithoutAnExistingLike RuleError = "RuleErrorCannotUnlikeWithoutAnExistingLike"

	RuleErrorProfileUsernameTooShort            RuleError = "RuleErrorProfileUsernameTooShort"
	RuleErrorProfileDescriptionTooShort         RuleError = "RuleErrorProfileDescriptionTooShort"
	RuleErrorProfileUsernameTooLong             RuleError = "RuleErrorProfileUsernameTooLong"
	RuleErrorProfileDescriptionTooLong          RuleError = "RuleErrorProfileDescriptionTooLong"
	RuleErrorProfileProfilePicTooShort          RuleError = "RuleErrorProfileProfilePicTooShort"
	RuleErrorProfileUpdateRequiresNonZeroInput  RuleError = "RuleErrorProfileUpdateRequiresNonZeroInput"
	RuleErrorCreateProfileTxnOutputExceedsInput RuleError = "RuleErrorCreateProfileTxnOutputExceedsInput"
	RuleErrorProfilePublicKeySize               RuleError = "RuleErrorProfilePublicKeySize"
	RuleErrorProfileBadPublicKey                RuleError = "RuleErrorProfileBadPublicKey"
	RuleErrorProfilePubKeyNotAuthorized         RuleError = "RuleErrorProfilePubKeyNotAuthorized"
	RuleErrorProfileModificationNotAuthorized   RuleError = "RuleErrorProfileModificationNotAuthorized"
	RuleErrorProfileUsernameCannotContainZeros  RuleError = "RuleErrorProfileUsernameCannotContainZeros"

	RuleSubmitPostNilParentPostHash                  RuleError = "RuleSubmitPostNilParentPostHash"
	RuleSubmitPostTitleLength                        RuleError = "RuleSubmitPostTitleLength"
	RuleSubmitPostBodyLength                         RuleError = "RuleSubmitPostBodyLength"
	RuleSubmitPostSubLength                          RuleError = "RuleSubmitPostSubLength"
	RuleErrorSubmitPostStakeMultipleSize             RuleError = "RuleErrorSubmitPostStakeMultipleSize"
	RuleErrorSubmitPostCreatorPercentageSize         RuleError = "RuleErrorSubmitPostCreatorPercentageSize"
	RuleErrorSubmitPostTimestampIsZero               RuleError = "RuleErrorSubmitPostTimestampIsZero"
	RuleErrorPostAlreadyExists                       RuleError = "RuleErrorPostAlreadyExists"
	RuleErrorSubmitPostInvalidCommentStakeID         RuleError = "RuleErrorSubmitPostInvalidCommentStakeID"
	RuleErrorSubmitPostRequiresNonZeroInput          RuleError = "RuleErrorSubmitPostRequiresNonZeroInput"
	RuleErrorSubmitPostInvalidPostHashToModify       RuleError = "RuleErrorSubmitPostInvalidPostHashToModify"
	RuleErrorSubmitPostModifyingNonexistentPost      RuleError = "RuleErrorSubmitPostModifyingNonexistentPost"
	RuleErrorSubmitPostPostModificationNotAuthorized RuleError = "RuleErrorSubmitPostPostModificationNotAuthorized"
	RuleErrorSubmitPostInvalidParentStakeIDLength    RuleError = "RuleErrorSubmitPostInvalidParentStakeIDLength"
	RuleErrorSubmitPostParentNotFound                RuleError = "RuleErrorSubmitPostParentNotFound"
	RuleErrorSubmitPostRepostPostNotFound            RuleError = "RuleErrorSubmitPostRepostPostNotFound"
	RuleErrorSubmitPostRepostOfRepost                RuleError = "RuleErrorSubmitPostRepostOfRepost"
	RuleErrorSubmitPostUpdateRepostHash              RuleError = "RuleErrorSubmitPostUpdateRepostHash"
	RuleErrorSubmitPostUpdateIsQuotedRepost          RuleError = "RuleErrorSubmitPostUpdateIsQuotedRepost"
	RuleErrorSubmitPostCannotUpdateNFT               RuleError = "RuleErrorSubmitPostCannotUpdateNFT"
	RuleErrorSubmitPostModifyingFrozenPost           RuleError = "RuleErrorSubmitPostModifyingFrozenPost"

	RuleErrorInvalidStakeID                      RuleError = "RuleErrorInvalidStakeID"
	RuleErrorInvalidStakeIDSize                  RuleError = "RuleErrorInvalidStakeIDSize"
	RuleErrorStakingToNonexistentPost            RuleError = "RuleErrorStakingToNonexistentPost"
	RuleErrorStakingToNonexistentProfile         RuleError = "RuleErrorStakingToNonexistentProfile"
	RuleErrorNotImplemented                      RuleError = "RuleErrorNotImplemented"
	RuleErrorStakingZeroNanosNotAllowed          RuleError = "RuleErrorStakingZeroNanosNotAllowed"
	RuleErrorAddStakeTxnMustHaveExactlyOneOutput RuleError = "RuleErrorAddStakeTxnMustHaveExactlyOneOutput"
	RuleErrorExistingStakeExceedsMaxAllowed      RuleError = "RuleErrorExistingStakeExceedsMaxAllowed"
	RuleErrorAddStakeRequiresNonZeroInput        RuleError = "RuleErrorAddStakeRequiresNonZeroInput"
	RuleErrorProfileForPostDoesNotExist          RuleError = "RuleErrorProfileForPostDoesNotExist"

	// Global Params
	RuleErrorExchangeRateTooLow                    RuleError = "RuleErrorExchangeRateTooLow"
	RuleErrorExchangeRateTooHigh                   RuleError = "RuleErrorExchangeRateTooHigh"
	RuleErrorMinNetworkFeeTooLow                   RuleError = "RuleErrorMinNetworkFeeTooLow"
	RuleErrorMinNetworkFeeTooHigh                  RuleError = "RuleErrorMinNetworkFeeTooHigh"
	RuleErrorCreateProfileFeeTooLow                RuleError = "RuleErrorCreateProfileFeeTooLow"
	RuleErrorCreateProfileTooHigh                  RuleError = "RuleErrorCreateProfileTooHigh"
	RuleErrorCreateNFTFeeTooLow                    RuleError = "RuleErrorCreateNFTFeeTooLow"
	RuleErrorCreateNFTFeeTooHigh                   RuleError = "RuleErrorCreateNFTFeeTooHigh"
	RuleErrorMaxCopiesPerNFTTooLow                 RuleError = "RuleErrorMaxCopiesPerNFTTooLow"
	RuleErrorMaxCopiesPerNFTTooHigh                RuleError = "RuleErrorMaxCopiesPerNFTTooHigh"
	RuleErrorForbiddenPubKeyLength                 RuleError = "RuleErrorForbiddenPubKeyLength"
	RuleErrorUserNotAuthorizedToUpdateExchangeRate RuleError = "RuleErrorUserNotAuthorizedToUpdateExchangeRate"
	RuleErrorUserNotAuthorizedToUpdateGlobalParams RuleError = "RuleErrorUserNotAuthorizedToUpdateGlobalParams"
	RuleErrorUserOutputMustBeNonzero               RuleError = "RuleErrorUserOutputMustBeNonzero"

	// DeSo Diamonds
	RuleErrorBasicTransferHasDiamondPostHashWithoutDiamondLevel   RuleError = "RuleErrorBasicTransferHasDiamondPostHashWithoutDiamondLevel"
	RuleErrorBasicTransferHasInvalidDiamondLevel                  RuleError = "RuleErrorBasicTransferHasInvalidDiamondLevel"
	RuleErrorBasicTransferDiamondInvalidLengthForPostHashBytes    RuleError = "RuleErrorBasicTransferInvalidLengthForPostHashBytes"
	RuleErrorBasicTransferDiamondPostEntryDoesNotExist            RuleError = "RuleErrorBasicTransferDiamondPostEntryDoesNotExist"
	RuleErrorBasicTransferInsufficientCreatorCoinsForDiamondLevel RuleError = "RuleErrorBasicTransferInsufficientCreatorCoinsForDiamondLevel"
	RuleErrorBasicTransferDiamondCannotTransferToSelf             RuleError = "RuleErrorBasicTransferDiamondCannotTransferToSelf"
	RuleErrorBasicTransferInsufficientDeSoForDiamondLevel         RuleError = "RuleErrorBasicTransferInsufficientDeSoForDiamondLevel"

	RuleErrorCoinTransferRequiresNonZeroInput                           RuleError = "RuleErrorCoinTransferRequiresNonZeroInput"
	RuleErrorCoinTransferInvalidProfilePubKeySize                       RuleError = "RuleErrorCoinTransferInvalidProfilePubKeySize"
	RuleErrorCoinTransferInvalidReceiverPubKeySize                      RuleError = "RuleErrorCoinTransferInvalidReceiverPubKeySize"
	RuleErrorCoinTransferInvalidReceiverPubKey                          RuleError = "RuleErrorCoinTransferInvalidReceiverPubKey"
	RuleErrorCoinTransferInvalidProfilePubKey                           RuleError = "RuleErrorCoinTransferInvalidProfilePubKey"
	RuleErrorCoinTransferOnNonexistentProfile                           RuleError = "RuleErrorCoinTransferOnNonexistentProfile"
	RuleErrorCoinTransferBalanceEntryDoesNotExist                       RuleError = "RuleErrorCoinTransferBalanceEntryDoesNotExist"
	RuleErrorCreatorCoinTransferMustBeGreaterThanMinThreshold           RuleError = "RuleErrorCreatorCoinTransferMustBeGreaterThanMinThreshold"
	RuleErrorCoinTransferInsufficientCoins                              RuleError = "RuleErrorCoinTransferInsufficientCoins"
	RuleErrorCoinTransferCannotTransferToSelf                           RuleError = "RuleErrorCoinTransferCannotTransferToSelf"
	RuleErrorCreatorCoinTransferHasDiamondPostHashWithoutDiamondLevel   RuleError = "RuleErrorCreatorCoinTransferHasDiamondPostHashWithoutDiamondLevel"
	RuleErrorCreatorCoinTransferCantSendDiamondsForOtherProfiles        RuleError = "RuleErrorCreatorCoinTransferCantSendDiamondsForOtherProfiles"
	RuleErrorCreatorCoinTransferCantDiamondYourself                     RuleError = "RuleErrorCreatorCoinTransferCantDiamondYourself"
	RuleErrorCreatorCoinTransferInvalidLengthForPostHashBytes           RuleError = "RuleErrorCreatorCoinTransferInvalidLengthForPostHashBytes"
	RuleErrorCreatorCoinTransferInsufficientCreatorCoinsForDiamondLevel RuleError = "RuleErrorCreatorCoinTransferInsufficientCreatorCoinsForDiamondLevel"
	RuleErrorCreatorCoinTransferHasInvalidDiamondLevel                  RuleError = "RuleErrorCreatorCoinTransferHasInvalidDiamondLevel"
	RuleErrorCreatorCoinTransferHasDiamondsAfterDeSoBlockHeight         RuleError = "RuleErrorCreatorCoinTransferHasDiamondsAfterDeSoBlockHeight"
	RuleErrorCreatorCoinTransferPostAlreadyHasSufficientDiamonds        RuleError = "RuleErrorCreatorCoinTransferPostAlreadyHasSufficientDiamonds"
	RuleErrorCreatorCoinTransferDiamondsCantHaveNegativeNanos           RuleError = "RuleErrorCreatorCoinTransferDiamondsCantHaveNegativeNanos"
	RuleErrorCreatorCoinTransferDiamondPostEntryDoesNotExist            RuleError = "RuleErrorCreatorCoinTransferDiamondPostEntryDoesNotExist"

	RuleErrorCreatorCoinRequiresNonZeroInput                           RuleError = "RuleErrorCreatorCoinRequiresNonZeroInput"
	RuleErrorCreatorCoinInvalidPubKeySize                              RuleError = "RuleErrorCreatorCoinInvalidPubKeySize"
	RuleErrorCreatorCoinOperationOnNonexistentProfile                  RuleError = "RuleErrorCreatorCoinOperationOnNonexistentProfile"
	RuleErrorCreatorCoinBuyMustTradeNonZeroDeSo                        RuleError = "RuleErrorCreatorCoinBuyMustTradeNonZeroDeSo"
	RuleErrorCreatorCoinTxnOutputWithInvalidBuyAmount                  RuleError = "RuleErrorCreatorCoinTxnOutputWithInvalidBuyAmount"
	RuleErrorCreatorCoinTxnOutputExceedsInput                          RuleError = "RuleErrorCreatorCoinTxnOutputExceedsInput"
	RuleErrorCreatorCoinLessThanMinimumSetByUser                       RuleError = "RuleErrorCreatorCoinLessThanMinimumSetByUser"
	RuleErrorCreatorCoinBuyMustTradeNonZeroDeSoAfterFees               RuleError = "RuleErrorCreatorCoinBuyMustTradeNonZeroDeSoAfterFees"
	RuleErrorCreatorCoinBuyMustTradeNonZeroDeSoAfterFounderReward      RuleError = "RuleErrorCreatorCoinBuyMustTradeNonZeroDeSoAfterFounderReward"
	RuleErrorCreatorCoinBuyMustSatisfyAutoSellThresholdNanos           RuleError = "RuleErrorCreatorCoinBuyMustSatisfyAutoSellThresholdNanos"
	RuleErrorCreatorCoinBuyMustSatisfyAutoSellThresholdNanosForCreator RuleError = "RuleErrorCreatorCoinBuyMustSatisfyAutoSellThresholdNanosForCreator"
	RuleErrorCreatorCoinBuyMustSatisfyAutoSellThresholdNanosForBuyer   RuleError = "RuleErrorCreatorCoinBuyMustSatisfyAutoSellThresholdNanosForBuyer"
	RuleErrorCreatorCoinBuyZeroLockedNanosAndNonZeroHolders            RuleError = "RuleErrorCreatorCoinBuyZeroLockedNanosAndNonZeroHolders"
	RuleErrorCreatorCoinSellMustHaveAtLeastOneInput                    RuleError = "RuleErrorCreatorCoinSellMustHaveAtLeastOneInput"
	RuleErrorCreatorCoinSellMustTradeNonZeroCreatorCoin                RuleError = "RuleErrorCreatorCoinSellMustTradeNonZeroCreatorCoin"
	RuleErrorCreatorCoinSellerBalanceEntryDoesNotExist                 RuleError = "RuleErrorCreatorCoinSellerBalanceEntryDoesNotExist"
	RuleErrorCreatorCoinSellInsufficientCoins                          RuleError = "RuleErrorCreatorCoinSellInsufficientCoins"
	RuleErrorCreatorCoinSellNotAllowedWhenZeroDeSoLocked               RuleError = "RuleErrorCreatorCoinSellNotAllowedWhenZeroDeSoLocked"
	RuleErrorDeSoReceivedIsLessThanMinimumSetBySeller                  RuleError = "RuleErrorDeSoReceivedIsLessThanMinimumSetBySeller"

	// DAO Coins
	RuleErrorDAOCoinRequiresNonZeroInput                  RuleError = "RuleErrorDAOCoinRequiresNonZeroInput"
	RuleErrorDAOCoinInvalidPubKeySize                     RuleError = "RuleErrorDAOCoinInvalidPubKeySize"
	RuleErrorDAOCoinInvalidPubKey                         RuleError = "RuleErrorDAOCoinInvalidPubKey"
	RuleErrorDAOCoinOperationOnNonexistentProfile         RuleError = "RuleErrorDAOCoinOperationOnNonexistentProfile"
	RuleErrorDAOCoinBurnMustBurnNonZeroDAOCoin            RuleError = "RuleErrorDAOCoinBurnMustBurnNonZeroDAOCoin"
	RuleErrorDAOCoinBurnerBalanceEntryDoesNotExist        RuleError = "RuleErrorDAOCoinBurnerBalanceEntryDoesNotExist"
	RuleErrorDAOCoinBurnInsufficientCoins                 RuleError = "RuleErrorDAOCoinBurnInsufficientCoins"
	RuleErrorOnlyProfileOwnerCanMintDAOCoin               RuleError = "RuleErrorOnlyProfileOwnerCanMintDAOCoin"
	RuleErrorDAOCoinMustMintNonZeroDAOCoin                RuleError = "RuleErrorDAOCoinMustMintNonZeroDAOCoin"
	RuleErrorOverflowWhileMintingDAOCoins                 RuleError = "RuleErrorOverflowWhileMintingDAOCoins"
	RuleErrorDAOCoinBurnAmountExceedsCoinsInCirculation   RuleError = "RuleErrorDAOCoinBurnAmountExceedsCoinsInCirculation"
	RuleErrorDAOCoinBeforeDAOCoinBlockHeight              RuleError = "RuleErrorDAOCoinBeforeDAOCoinBlockHeight"
	RuleErrorDAOCoinCannotDisableMintingIfAlreadyDisabled RuleError = "RuleErrorDAOCoinCannotDisableMintingIfAlreadyDisabled"
	RuleErrorDAOCoinCannotMintIfMintingIsDisabled         RuleError = "RuleErrorDAOCoinCannotMintIfMintingIsDisabled"
	RuleErrorOnlyProfileOwnerCanDisableMintingDAOCoin     RuleError = "RuleErrorOnlyProfileOwnerCanDisableMintingDAOCoin"
	RuleErrorDAOCoinTransferProfileOwnerOnlyViolation     RuleError = "RuleErrorDAOCoinTransferProfileOwnerOnlyViolation"
	RuleErrorDAOCoinTransferDAOMemberOnlyViolation        RuleError = "RuleErrorDAOCoinTransferDAOMemberOnlyViolation"

	// DAO Coin Transfer Restrictions
	RuleErrorOnlyProfileOwnerCanUpdateTransferRestrictionStatus                    RuleError = "RuleErrorOnlyProfileOwnerCanUpdateTransferRestrictionStatus"
	RuleErrorDAOCoinCannotUpdateRestrictionStatusIfStatusIsPermanentlyUnrestricted RuleError = "RuleErrorDAOCoinCannotUpdateRestrictionStatusIfStatusIsPermanentlyUnrestricted"
	RuleErrorDAOCoinCannotUpdateTransferRestrictionStatusToCurrentStatus           RuleError = "RuleErrorDAOCoinCannotUpdateTransferRestrictionStatusToCurrentStatus"

	// DAO Coin Limit Orders
	RuleErrorDAOCoinLimitOrderBeforeBlockHeight                       RuleError = "RuleErrorDAOCoinLimitOrderBeforeBlockHeight"
	RuleErrorDAOCoinLimitOrderInvalidTransactorPKID                   RuleError = "RuleErrorDAOCoinLimitOrderInvalidTransactorPKID"
	RuleErrorDAOCoinLimitOrderInvalidBuyingDAOCoinCreatorPKID         RuleError = "RuleErrorDAOCoinLimitOrderInvalidBuyingDAOCoinCreatorPKID"
	RuleErrorDAOCoinLimitOrderInvalidSellingDAOCoinCreatorPKID        RuleError = "RuleErrorDAOCoinLimitOrderInvalidSellingDAOCoinCreatorPKID"
	RuleErrorDAOCoinLimitOrderCannotBuyAndSellSameCoin                RuleError = "RuleErrorDAOCoinLimitOrderCannotBuyAndSellSameCoin"
	RuleErrorDAOCoinLimitOrderInvalidOperationType                    RuleError = "RuleErrorDAOCoinLimitOrderInvalidOperationType"
	RuleErrorDAOCoinLimitOrderBuyingDAOCoinCreatorMissingProfile      RuleError = "RuleErrorDAOCoinLimitOrderBuyingDAOCoinCreatorMissingProfile"
	RuleErrorDAOCoinLimitOrderSellingDAOCoinCreatorMissingProfile     RuleError = "RuleErrorDAOCoinLimitOrderSellingDAOCoinCreatorMissingProfile"
	RuleErrorDAOCoinLimitOrderInvalidExchangeRate                     RuleError = "RuleErrorDAOCoinLimitOrderInvalidExchangeRate"
	RuleErrorDAOCoinLimitOrderInvalidQuantity                         RuleError = "RuleErrorDAOCoinLimitOrderInvalidQuantity"
	RuleErrorDAOCoinLimitOrderTotalCostOverflowsUint256               RuleError = "RuleErrorDAOCoinLimitOrderTotalCostOverflowsUint256"
	RuleErrorDAOCoinLimitOrderTotalCostOverflowsUint64                RuleError = "RuleErrorDAOCoinLimitOrderTotalCostOverflowsUint64"
	RuleErrorDAOCoinLimitOrderTotalCostIsLessThanOneNano              RuleError = "RuleErrorDAOCoinLimitOrderTotalCostIsLessThanOneNano"
	RuleErrorDAOCoinLimitOrderInsufficientDESOToOpenOrder             RuleError = "RuleErrorDAOCoinLimitOrderInsufficientDESOToOpenOrder"
	RuleErrorDAOCoinLimitOrderInsufficientDAOCoinsToOpenOrder         RuleError = "RuleErrorDAOCoinLimitOrderInsufficientDAOCoinsToOpenOrder"
	RuleErrorDAOCoinLimitOrderBidderInputNoLongerExists               RuleError = "RuleErrorDAOCoinLimitOrderBidderInputNoLongerExists"
	RuleErrorDAOCoinLimitOrderToCancelNotFound                        RuleError = "RuleErrorDAOCoinLimitOrderToCancelNotFound"
	RuleErrorDAOCoinLimitOrderToCancelNotYours                        RuleError = "RuleErrorDAOCoinLimitOrderToCancelNotYours"
	RuleErrorDAOCoinLimitOrderOverspendingDESO                        RuleError = "RuleErrorDAOCoinLimitOrderOverspendingDESO"
	RuleErrorDAOCoinLimitOrderOverflowsDESO                           RuleError = "RuleErrorDAOCoinLimitOrderOverflowsDESO"
	RuleErrorDAOCoinLimitOrderOverspendingDAOCoin                     RuleError = "RuleErrorDAOCoinLimitOrderOverspendingDAOCoin"
	RuleErrorDAOCoinLimitOrderOverflowsDAOCoin                        RuleError = "RuleErrorDAOCoinLimitOrderOverflowsDAOCoin"
	RuleErrorDAOCoinLimitOrderMatchingOrderIsDeleted                  RuleError = "RuleErrorDAOCoinLimitOrderMatchingOrderIsDeleted"
	RuleErrorDAOCoinLimitOrderMatchingOwnOrder                        RuleError = "RuleErrorDAOCoinLimitOrderMatchingOwnOrder"
	RuleErrorDAOCoinLimitOrderMatchingOrderBuyingDifferentCoins       RuleError = "RuleErrorDAOCoinLimitOrderMatchingOrderBuyingDifferentCoins"
	RuleErrorDAOCoinLimitOrderMatchingOrderSellingDifferentCoins      RuleError = "RuleErrorDAOCoinLimitOrderMatchingOrderSellingDifferentCoins"
	RuleErrorDAOCoinLimitOrderBalanceEntryDoesNotExist                RuleError = "RuleErrorDAOCoinLimitOrderBalanceEntryDoesNotExist"
	RuleErrorDAOCoinLimitOrderBalanceDeltasNonZero                    RuleError = "RuleErrorDAOCoinLimitOrderBalanceDeltasNonZero"
	RuleErrorDAOCoinLimitOrderFeeNanosBelowMinTxFee                   RuleError = "RuleErrorDAOCoinLimitOrderFeeNanosBelowMinTxFee"
	RuleErrorDAOCoinLimitOrderFeeNanosOverflow                        RuleError = "RuleErrorDAOCoinLimitOrderFeeNanosOverflow"
	RuleErrorDAOCoinLimitOrderTotalInputMinusTotalOutputNotEqualToFee RuleError = "RuleErrorDAOCoinLimitOrderTotalInputMinusTotalOutputNotEqualToFee"
	RuleErrorDAOCoinLimitOrderInvalidFillType                         RuleError = "RuleErrorDAOCoinLimitOrderInvalidFillType"
	RuleErrorDAOCoinLimitOrderFillOrKillOrderUnfulfilled              RuleError = "RuleErrorDAOCoinLimitOrderFillOrKillOrderUnfulfilled"

	// Derived Keys
	RuleErrorAuthorizeDerivedKeyAccessSignatureNotValid RuleError = "RuleErrorAuthorizeDerivedKeyAccessSignatureNotValid"
	RuleErrorAuthorizeDerivedKeyRequiresNonZeroInput    RuleError = "RuleErrorAuthorizeDerivedKeyRequiresNonZeroInput"
	RuleErrorAuthorizeDerivedKeyExpiredDerivedPublicKey RuleError = "RuleErrorAuthorizeDerivedKeyExpired"
	RuleErrorAuthorizeDerivedKeyInvalidDerivedPublicKey RuleError = "RuleErrorAuthorizeDerivedKeyInvalidDerivedKey"
	RuleErrorAuthorizeDerivedKeyDeletedDerivedPublicKey RuleError = "RuleErrorAuthorizeDerivedKeyDeletedDerivedPublicKey"
	RuleErrorAuthorizeDerivedKeyInvalidOwnerPublicKey   RuleError = "RuleErrorAuthorizeDerivedKeyInvalidOwnerPublicKey"
	RuleErrorDerivedKeyNotAuthorized                    RuleError = "RuleErrorDerivedKeyNotAuthorized"
	RuleErrorDerivedKeyInvalidExtraData                 RuleError = "RuleErrorDerivedKeyInvalidExtraData"
	RuleErrorDerivedKeyBeforeBlockHeight                RuleError = "RuleErrorDerivedKeyBeforeBlockHeight"
	RuleErrorDerivedKeyHasBothExtraDataAndRecoveryId    RuleError = "RuleErrorDerivedKeyHasBothExtraDataAndRecoveryId"
	RuleErrorDerivedKeyInvalidRecoveryId                RuleError = "RuleErrorDerivedKeyInvalidRecoveryId"
	RuleErrorUnlimitedDerivedKeyBeforeBlockHeight       RuleError = "RuleErrorUnlimitedDerivedKeyBeforeBlockHeight"
	RuleErrorUnlimitedDerivedKeyNonEmptySpendingLimits  RuleError = "RuleErrorUnlimitedDerivedKeyNonEmptySpendingLimits"

	// Messages
	RuleErrorMessagingPublicKeyCannotBeOwnerKey     RuleError = "RuleErrorMessagingPublicKeyCannotBeOwnerKey"
	RuleErrorMessagingSignatureInvalid              RuleError = "RuleErrorMessagingSignatureInvalid"
	RuleErrorMessagingPublicKeyCannotBeDifferent    RuleError = "RuleErrorMessagingPublicKeyCannotBeDifferent"
	RuleErrorMessagingEncryptedKeyCannotBeDifferent RuleError = "RuleErrorMessagingEncryptedKeyCannotBeDifferent"
	RuleErrorMessagingMemberEncryptedKeyTooShort    RuleError = "RuleErrorMessagingMemberEncryptedKeyTooShort"
	RuleErrorMessagingMemberKeyDoesntExist          RuleError = "RuleErrorMessagingMemberKeyDoesntExist"
	RuleErrorMessagingMemberAlreadyExists           RuleError = "RuleErrorMessagingMemberAlreadyExists"
	RuleErrorMessagingKeyDoesntAddMembers           RuleError = "RuleErrorMessagingKeyDoesntAddMembers"
	RuleErrorMessagingKeyNameNotProvided            RuleError = "RuleErrorMessagingKeyNameNotProvided"
	RuleErrorMessagingKeyNameTooShort               RuleError = "RuleErrorMessagingKeyNameTooShort"
	RuleErrorMessagingKeyNameTooLong                RuleError = "RuleErrorMessagingKeyNameTooLong"
	RuleErrorMessagingKeyNameCannotBeZeros          RuleError = "RuleErrorMessagingKeyNameCannotBeZeros"
	RuleErrorMessagingOwnerPublicKeyInvalid         RuleError = "RuleErrorMessagingOwnerPublicKeyInvalid"
	RuleErrorMessagingKeyConnect                    RuleError = "RuleErrorMessagingKeyConnect"
	RuleErrorMessagingKeySignatureNotProvided       RuleError = "RuleErrorMessagingKeySignatureNotProvided"
	RuleErrorMessagingKeyBeforeBlockHeight          RuleError = "RuleErrorMessagingKeyBeforeBlockHeight"

	// NFTs
	RuleErrorTooManyNFTCopies                            RuleError = "RuleErrorTooManyNFTCopies"
	RuleErrorCreateNFTRequiresNonZeroInput               RuleError = "RuleErrorCreateNFTRequiresNonZeroInput"
	RuleErrorUpdateNFTRequiresNonZeroInput               RuleError = "RuleErrorUpdateNFTRequiresNonZeroInput"
	RuleErrorCreateNFTOnNonexistentPost                  RuleError = "RuleErrorCreateNFTOnNonexistentPost"
	RuleErrorCreateNFTOnVanillaRepost                    RuleError = "RuleErrorCreateNFTOnVanillaRepost"
	RuleErrorCreateNFTWithInsufficientFunds              RuleError = "RuleErrorCreateNFTWithInsufficientFunds"
	RuleErrorCreateNFTOnPostThatAlreadyIsNFT             RuleError = "RuleErrorCreateNFTOnPostThatAlreadyIsNFT"
	RuleErrorCannotHaveUnlockableAndBuyNowNFT            RuleError = "RuleErrorCannotHaveUnlockableAndBuyNowNFT"
	RuleErrorCannotHaveBuyNowPriceBelowMinBidAmountNanos RuleError = "RuleErrorCannotHaveBuyNowPriceBelowMinBidAmountNanos"
	RuleErrorCreateNFTMustBeCalledByPoster               RuleError = "RuleErrorCreateNFTMustBeCalledByPoster"
	RuleErrorNFTMustHaveNonZeroCopies                    RuleError = "RuleErrorNFTMustHaveNonZeroCopies"
	RuleErrorCannotUpdateNonExistentNFT                  RuleError = "RuleErrorCannotUpdateNonExistentNFT"
	RuleErrorCannotUpdatePendingNFTTransfer              RuleError = "RuleErrorCannotUpdatePendingNFTTransfer"
	RuleErrorCannotAcceptBidForPendingNFTTransfer        RuleError = "RuleErrorCannotAcceptBidForPendingNFTTransfer"
	RuleErrorCannotBidForPendingNFTTransfer              RuleError = "RuleErrorCannotBidForPendingNFTTransfer"
	RuleErrorUpdateNFTByNonOwner                         RuleError = "RuleErrorUpdateNFTByNonOwner"
	RuleErrorAcceptNFTBidByNonOwner                      RuleError = "RuleErrorAcceptNFTBidByNonOwner"
	RuleErrorCantCreateNFTWithoutProfileEntry            RuleError = "RuleErrorCantCreateNFTWithoutProfileEntry"
	RuleErrorNFTRoyaltyHasTooManyBasisPoints             RuleError = "RuleErrorNFTRoyaltyHasTooManyBasisPoints"
	RuleErrorNFTRoyaltyOverflow                          RuleError = "RuleErrorNFTRoyaltyOverflow"
	RuleErrorNFTUpdateMustUpdateIsForSaleStatus          RuleError = "RuleErrorNFTUpdateMustUpdateIsForSaleStatus"
	RuleErrorBuyNowNFTBeforeBlockHeight                  RuleError = "RuleErrorBuyNowNFTBeforeBlockHeight"
	RuleErrorAdditionalCoinRoyaltyMustHaveProfile        RuleError = "RuleErrorAdditionalCoinRoyaltyMustHaveProfile"
	RuleErrorAdditionalCoinRoyaltyOverflow               RuleError = "RuleErrorAdditionalCoinRoyaltyOverflow"
	RuleErrorCannotSpecifyCreatorAsAdditionalRoyalty     RuleError = "RuleErrorCannotSpecifyCreatorAsAdditionalRoyalty"
	RuleErrorAdditionalRoyaltyPubKeyMustBeValid          RuleError = "RuleErrorAdditionalRoyaltyPubKeyMustBeValid"

	// NFT Bids
	RuleErrorNFTBidRequiresNonZeroInput                    RuleError = "RuleErrorNFTBidRequiresNonZeroInput"
	RuleErrorAcceptNFTBidRequiresNonZeroInput              RuleError = "RuleErrorAcceptNFTBidRequiresNonZeroInput"
	RuleErrorNFTBidTxnOutputWithInvalidBidAmount           RuleError = "RuleErrorNFTBidTxnOutputWithInvalidBidAmount"
	RuleErrorBuyNowNFTBidTxnOutputExceedsInput             RuleError = "RuleErrorBuyNowNFTBidTxnOutputExceedsInput"
	RuleErrorBuyNowNFTBidMustBidNonZeroDeSo                RuleError = "RuleErrorBuyNowNFTBidMustBidNonZeroDeSo"
	RuleErrorBuyNowNFTBidMustHaveMinBidAmountNanos         RuleError = "RuleErrorBuyNowNFTBidMustHaveMinBidAmountNanos"
	RuleErrorNFTBidOnNonExistentPost                       RuleError = "RuleErrorNFTBidOnNonExistentPost"
	RuleErrorNFTBidOnPostThatIsNotAnNFT                    RuleError = "RuleErrorNFTBidOnPostThatIsNotAnNFT"
	RuleErrorNFTBidOnInvalidSerialNumber                   RuleError = "RuleErrorNFTBidOnInvalidSerialNumber"
	RuleErrorNFTBidOnNonExistentNFTEntry                   RuleError = "RuleErrorNFTBidOnNonExistentNFTEntry"
	RuleErrorNFTBidOnNFTThatIsNotForSale                   RuleError = "RuleErrorNFTBidOnNFTThatIsNotForSale"
	RuleErrorNFTOwnerCannotBidOnOwnedNFT                   RuleError = "RuleErrorNFTOwnerCannotBidOnOwnedNFT"
	RuleErrorCantAcceptNonExistentBid                      RuleError = "RuleErrorCantAcceptNonExistentBid"
	RuleErrorAcceptedNFTBidAmountDoesNotMatch              RuleError = "RuleErrorAcceptedNFTBidAmountDoesNotMatch"
	RuleErrorPostEntryNotFoundForAcceptedNFTBid            RuleError = "RuleErrorPostEntryNotFoundForAcceptedNFTBid"
	RuleErrorUnlockableNFTMustProvideUnlockableText        RuleError = "RuleErrorUnlockableNFTMustProvideUnlockableText"
	RuleErrorUnlockableTextLengthExceedsMax                RuleError = "RuleErrorUnlockableTextLengthExceedsMax"
	RuleErrorAcceptedNFTBidMustSpecifyBidderInputs         RuleError = "RuleErrorAcceptedNFTBidMustSpecifyBidderInputs"
	RuleErrorBidderInputForAcceptedNFTBidNoLongerExists    RuleError = "RuleErrorBidderInputForAcceptedNFTBidNoLongerExists"
	RuleErrorAcceptNFTBidderInputsInsufficientForBidAmount RuleError = "RuleErrorAcceptNFTBidderInputsInsufficientForBidAmount"
	RuleErrorInsufficientFundsForNFTBid                    RuleError = "RuleErrorInsufficientFundsForNFTBid"
	RuleErrorNFTBidLessThanMinBidAmountNanos               RuleError = "RuleErrorNFTBidLessThanMinBidAmountNanos"
	RuleErrorZeroBidOnBuyNowNFT                            RuleError = "RuleErrorZeroBidOnBuyNowNFT"

	// NFT Transfers
	RuleErrorNFTTransferBeforeBlockHeight                 RuleError = "RuleErrorNFTTranserBeforeBlockHeight"
	RuleErrorAcceptNFTTransferBeforeBlockHeight           RuleError = "RuleErrorAcceptNFTTranserBeforeBlockHeight"
	RuleErrorNFTTransferInvalidReceiverPubKeySize         RuleError = "RuleErrorNFTTransferInvalidReceiverPubKeySize"
	RuleErrorNFTTransferCannotTransferToSelf              RuleError = "RuleErrorNFTTransferCannotTransferToSelf"
	RuleErrorCannotTransferNonExistentNFT                 RuleError = "RuleErrorCannotTransferNonExistentNFT"
	RuleErrorNFTTransferByNonOwner                        RuleError = "RuleErrorNFTTransferByNonOwner"
	RuleErrorCannotTransferForSaleNFT                     RuleError = "RuleErrorCannotTransferForSaleNFT"
	RuleErrorCannotTransferUnlockableNFTWithoutUnlockable RuleError = "RuleErrorCannotTransferUnlockableNFTWithoutUnlockable"
	RuleErrorNFTTransferRequiresNonZeroInput              RuleError = "RuleErrorNFTTransferRequiresNonZeroInput"
	RuleErrorCannotAcceptTransferOfNonExistentNFT         RuleError = "RuleErrorCannotAcceptTransferOfNonExistentNFT"
	RuleErrorAcceptNFTTransferByNonOwner                  RuleError = "RuleErrorAcceptNFTTransferByNonOwner"
	RuleErrorAcceptNFTTransferForNonPendingNFT            RuleError = "RuleErrorAcceptNFTTransferForNonPendingNFT"
	RuleErrorAcceptNFTTransferRequiresNonZeroInput        RuleError = "RuleErrorAcceptNFTTransferRequiresNonZeroInput"

	// NFT Burns
	RuleErrorBurnNFTBeforeBlockHeight    RuleError = "RuleErrorBurnNFTBeforeBlockHeight"
	RuleErrorCannotBurnNonExistentNFT    RuleError = "RuleErrorCannotBurnNonExistentNFT"
	RuleErrorBurnNFTByNonOwner           RuleError = "RuleErrorBurnNFTByNonOwner"
	RuleErrorCannotBurnNFTThatIsForSale  RuleError = "RuleErrorCannotBurnNFTThatIsForSale"
	RuleErrorBurnNFTRequiresNonZeroInput RuleError = "RuleErrorBurnNFTRequiresNonZeroInput"

	RuleErrorSwapIdentityIsParamUpdaterOnly RuleError = "RuleErrorSwapIdentityIsParamUpdaterOnly"
	RuleErrorFromPublicKeyIsRequired        RuleError = "RuleErrorFromPublicKeyIsRequired"
	RuleErrorInvalidFromPublicKey           RuleError = "RuleErrorInvalidFromPublicKey"
	RuleErrorToPublicKeyIsRequired          RuleError = "RuleErrorToPublicKeyIsRequired"
	RuleErrorInvalidToPublicKey             RuleError = "RuleErrorInvalidToPublicKey"
	RuleErrorOldFromPublicKeyHasDeletedPKID RuleError = "RuleErrorOldFromPublicKeyHasDeletedPKID"
	RuleErrorOldToPublicKeyHasDeletedPKID   RuleError = "RuleErrorOldToPublicKeyHasDeletedPKID"

	// Derived Key Transaction Spending Limits
	RuleErrorDerivedKeyTxnTypeNotAuthorized              RuleError = "RuleErrorDerivedKeyTxnTypeNotAuthorized"
	RuleErrorDerivedKeyTxnSpendsMoreThanGlobalDESOLimit  RuleError = "RuleErrorDerivedKeyTxnSpendsMoreThanGlobalDESOLimit"
	RuleErrorDerivedKeyInvalidCreatorCoinLimitOperation  RuleError = "RuleErrorInvalidCreatorCoinLimitOperation"
	RuleErrorDerivedKeyInvalidDAOCoinLimitOperation      RuleError = "RuleErrorInvalidDAOCoinLimitOperation"
	RuleErrorDerivedKeyNFTOperationNotAuthorized         RuleError = "RuleErrorDerivedKeyNFTOperationNotAuthorized"
	RuleErrorDerivedKeyCreatorCoinOperationNotAuthorized RuleError = "RuleErrorDerivedKeyCreatorCoinOperationNotAuthorized"
	RuleErrorDerivedKeyDAOCoinOperationNotAuthorized     RuleError = "RuleErrorDerivedKeyDAOCoinOperationNotAuthorized"
	RuleErrorDerivedKeyInvalidDAOCoinLimitOrderOrderID   RuleError = "RuleErrorDerivedKeyInvalidDAOCoinLimitOrderOrderID"
	RuleErrorDerivedKeyDAOCoinLimitOrderNotAuthorized    RuleError = "RuleErrorDerivedKeyDAOCoinLimitOrderNotAuthorized"

	// Association Errors
	RuleErrorAssociationBeforeBlockHeight     RuleError = "RuleErrorAssociationBeforeBlockHeight"
	RuleErrorAssociationInvalidID             RuleError = "RuleErrorAssociationInvalidID"
	RuleErrorAssociationNotFound              RuleError = "RuleErrorAssociationNotFound"
	RuleErrorAssociationInvalidTransactor     RuleError = "RuleErrorAssociationInvalidTransactor"
	RuleErrorAssociationInvalidApp            RuleError = "RuleErrorAssociationInvalidApp"
	RuleErrorAssociationInvalidType           RuleError = "RuleErrorAssociationInvalidType"
	RuleErrorAssociationInvalidValue          RuleError = "RuleErrorAssociationInvalidValue"
	RuleErrorUserAssociationInvalidTargetUser RuleError = "RuleErrorUserAssociationInvalidTargetUser"
	RuleErrorPostAssociationInvalidPost       RuleError = "RuleErrorPostAssociationInvalidPost"

	HeaderErrorDuplicateHeader                                                   RuleError = "HeaderErrorDuplicateHeader"
	HeaderErrorNilPrevHash                                                       RuleError = "HeaderErrorNilPrevHash"
	HeaderErrorInvalidParent                                                     RuleError = "HeaderErrorInvalidParent"
	HeaderErrorBlockTooFarInTheFuture                                            RuleError = "HeaderErrorBlockTooFarInTheFuture"
	HeaderErrorTimestampTooEarly                                                 RuleError = "HeaderErrorTimestampTooEarly"
	HeaderErrorBlockDifficultyAboveTarget                                        RuleError = "HeaderErrorBlockDifficultyAboveTarget"
	HeaderErrorHeightInvalid                                                     RuleError = "HeaderErrorHeightInvalid"
	HeaderErrorDifficultyBitsNotConsistentWithTargetDifficultyComputedFromParent RuleError = "HeaderErrorDifficultyBitsNotConsistentWithTargetDifficultyComputedFromParent"

	TxErrorTooLarge                     RuleError = "TxErrorTooLarge"
	TxErrorDuplicate                    RuleError = "TxErrorDuplicate"
	TxErrorIndividualBlockReward        RuleError = "TxErrorIndividualBlockReward"
	TxErrorInsufficientFeeMinFee        RuleError = "TxErrorInsufficientFeeMinFee"
	TxErrorInsufficientFeeRateLimit     RuleError = "TxErrorInsufficientFeeRateLimit"
	TxErrorInsufficientFeePriorityQueue RuleError = "TxErrorInsufficientFeePriorityQueue"
	TxErrorUnconnectedTxnNotAllowed     RuleError = "TxErrorUnconnectedTxnNotAllowed"
)

func (RuleError) Error

func (e RuleError) Error() string

type Server

type Server struct {
	TxIndex *TXIndex

	// During initial block download, we request headers and blocks from a single
	// peer. Note: These fields should only be accessed from the messageHandler thread.
	//
	// TODO: This could be much faster if we were to download blocks in parallel
	// rather than from a single peer but it won't be a problem until later, at which
	// point we can make the optimization.
	SyncPeer *Peer

	// If we're syncing state using hypersync, we'll keep track of the progress using HyperSyncProgress.
	// It stores information about all the prefixes that we're fetching. The way that HyperSyncProgress
	// is organized allows for multi-peer state synchronization. In such case, we would assign prefixes
	// to different peers. Whenever we assign a prefix to a peer, we would append a SyncProgressPrefix
	// struct to the HyperSyncProgress.PrefixProgress array.
	HyperSyncProgress SyncProgress

	// When set to true, we disable the ConnectionManager
	DisableNetworking bool

	// When set to true, transactions created on this node will be ignored.
	ReadOnlyMode                 bool
	IgnoreInboundPeerInvMessages bool

	Notifier *Notifier
	// contains filtered or unexported fields
}

Server is the core of the DeSo node. It effectively runs a single-threaded main loop that processes transactions from other peers and responds to them accordingly. Probably the best place to start looking is the messageHandler function.

func NewServer

func NewServer(
	_params *DeSoParams,
	_listeners []net.Listener,
	_desoAddrMgr *addrmgr.AddrManager,
	_connectIps []string,
	_db *badger.DB,
	postgres *Postgres,
	_targetOutboundPeers uint32,
	_maxInboundPeers uint32,
	_minerPublicKeys []string,
	_numMiningThreads uint64,
	_limitOneInboundConnectionPerIP bool,
	_hyperSync bool,
	_syncType NodeSyncType,
	_maxSyncBlockHeight uint32,
	_disableEncoderMigrations bool,
	_rateLimitFeerateNanosPerKB uint64,
	_minFeeRateNanosPerKB uint64,
	_stallTimeoutSeconds uint64,
	_maxBlockTemplatesToCache uint64,
	_minBlockUpdateIntervalSeconds uint64,
	_blockCypherAPIKey string,
	_runReadOnlyUtxoViewUpdater bool,
	_snapshotBlockHeightPeriod uint64,
	_dataDir string,
	_mempoolDumpDir string,
	_disableNetworking bool,
	_readOnlyMode bool,
	_ignoreInboundPeerInvMessages bool,
	statsd *statsd.Client,
	_blockProducerSeed string,
	_trustedBlockProducerPublicKeys []string,
	_trustedBlockProducerStartHeight uint64,
	eventManager *EventManager,
	_nodeMessageChan chan NodeMessage,
	_forceChecksum bool) (
	_srv *Server, _err error, _shouldRestart bool)

NewServer initializes all of the internal data structures. Right now this basically looks as follows:

  • ConnectionManager starts and keeps track of peers.
  • When messages are received from peers, they get forwarded on a channel to the Server to handle them. In that sense the ConnectionManager is basically just acting as a router.
  • When the Server receives a message from a peer, it can do any of the following:
  • Take no action.
  • Use the Blockchain data structure to validate the transaction or update the Blockchain data structure.
  • Send a new message. This can be a message directed back to that actually sent this message or it can be a message to another peer for whatever reason. When a message is sent in this way it can also have a deadline on it that the peer needs to respond by or else it will be disconnected.
  • Disconnect the peer. In this case the ConnectionManager gets notified about the disconnection and may opt to replace the now-disconnected peer with a new peer. This happens for example when an outbound peer is disconnected in order to maintain TargetOutboundPeers.
  • The server could also receive a control message that a peer has been disconnected. This can be useful to the server if, for example, it was expecting a response from a particular peer, which could be the case in initial block download where a single sync peer is used.

TODO: Refactor all these arguments into a config object or something.

func (*Server) BroadcastTransaction

func (srv *Server) BroadcastTransaction(txn *MsgDeSoTxn) ([]*MempoolTx, error)

func (*Server) ExpireRequests

func (srv *Server) ExpireRequests()

ExpireRequests checks to see if any requests have expired and removes them if so.

func (*Server) GetBlockProducer

func (srv *Server) GetBlockProducer() *DeSoBlockProducer

TODO: The hallmark of a messy non-law-of-demeter-following interface...

func (*Server) GetBlockchain

func (srv *Server) GetBlockchain() *Blockchain

TODO: The hallmark of a messy non-law-of-demeter-following interface...

func (*Server) GetBlocks

func (srv *Server) GetBlocks(pp *Peer, maxHeight int)

GetBlocks computes what blocks we need to fetch and asks for them from the corresponding peer. It is typically called after we have exited SyncStateSyncingHeaders.

func (*Server) GetBlocksToStore

func (srv *Server) GetBlocksToStore(pp *Peer)

GetBlocksToStore is part of the archival mode, which makes the node download all historical blocks after completing hypersync. We will go through all blocks corresponding to the snapshot and download the blocks.

func (*Server) GetConnectionManager

func (srv *Server) GetConnectionManager() *ConnectionManager

TODO: The hallmark of a messy non-law-of-demeter-following interface...

func (*Server) GetMempool

func (srv *Server) GetMempool() *DeSoMempool

TODO: The hallmark of a messy non-law-of-demeter-following interface...

func (*Server) GetMiner

func (srv *Server) GetMiner() *DeSoMiner

TODO: The hallmark of a messy non-law-of-demeter-following interface...

func (*Server) GetSnapshot

func (srv *Server) GetSnapshot(pp *Peer)

GetSnapshot is used for sending MsgDeSoGetSnapshot messages to peers. We will check if the passed peer has been assigned to an in-progress prefix and if so, we will request a snapshot data chunk from them. Otherwise, we will assign a new prefix to that peer.

func (*Server) GetStatsdClient

func (srv *Server) GetStatsdClient() *statsd.Client

func (*Server) HasProcessedFirstTransactionBundle

func (srv *Server) HasProcessedFirstTransactionBundle() bool

func (*Server) ProcessSingleTxnWithChainLock

func (srv *Server) ProcessSingleTxnWithChainLock(
	pp *Peer, txn *MsgDeSoTxn) ([]*MempoolTx, error)

func (*Server) ResetRequestQueues

func (srv *Server) ResetRequestQueues()

ResetRequestQueues resets all the request queues.

func (*Server) Start

func (srv *Server) Start()

Start actually kicks off all of the management processes. Among other things, it causes the ConnectionManager to actually start connecting to peers and receiving messages. If requested, it also starts the miner.

func (*Server) StartStatsdReporter

func (srv *Server) StartStatsdReporter()

func (*Server) Stop

func (srv *Server) Stop()

func (*Server) VerifyAndBroadcastTransaction

func (srv *Server) VerifyAndBroadcastTransaction(txn *MsgDeSoTxn) error

type ServerMessage

type ServerMessage struct {
	Peer      *Peer
	Msg       DeSoMessage
	ReplyChan chan *ServerReply
}

ServerMessage is the core data structure processed by the Server in its main loop.

type ServerReply

type ServerReply struct {
}

ServerReply is used to signal to outside programs that a particular ServerMessage they may have been waiting on has been processed.

type ServiceFlag

type ServiceFlag uint64
const (
	// SFFullNodeDeprecated is deprecated, and set on all nodes by default
	// now. We basically split it into SFHyperSync and SFArchivalMode.
	SFFullNodeDeprecated ServiceFlag = 1 << iota
	// SFHyperSync is a flag used to indicate that the peer supports hyper sync.
	SFHyperSync
	// SFArchivalNode is a flag complementary to SFHyperSync. If node is a hypersync node then
	// it might not be able to support block sync anymore, unless it has archival mode turned on.
	SFArchivalNode
)

type Set added in v3.2.0

type Set[T comparable] struct {
	// contains filtered or unexported fields
}

Generic Set object. Retains the order elements are addd to the set.

func DBGetPostAssociationIdsByAttributes added in v3.2.0

func DBGetPostAssociationIdsByAttributes(
	handle *badger.DB,
	snap *Snapshot,
	associationQuery *PostAssociationQuery,
	utxoViewAssociationIds *Set[BlockHash],
) (*Set[BlockHash], []byte, error)

func DBGetUserAssociationIdsByAttributes added in v3.2.0

func DBGetUserAssociationIdsByAttributes(
	handle *badger.DB,
	snap *Snapshot,
	associationQuery *UserAssociationQuery,
	utxoViewAssociationIds *Set[BlockHash],
) (*Set[BlockHash], []byte, error)

func NewSet added in v3.2.0

func NewSet[T comparable](elements []T) *Set[T]

func (*Set[T]) Add added in v3.2.0

func (set *Set[T]) Add(element T)

func (*Set[T]) ForEach added in v3.2.0

func (set *Set[T]) ForEach(applyFunc func(elem T) error) error

func (*Set[T]) Includes added in v3.2.0

func (set *Set[T]) Includes(element T) bool

func (*Set[T]) Remove added in v3.2.0

func (set *Set[T]) Remove(element T)

func (*Set[T]) Size added in v3.2.0

func (set *Set[T]) Size() int

func (*Set[T]) ToSlice added in v3.2.0

func (set *Set[T]) ToSlice() []T

type SingleAddr

type SingleAddr struct {
	// Last time the address was seen. Encoded as number UNIX seconds on the wire.
	Timestamp time.Time

	// Bitfield which identifies the services supported by the address.
	Services ServiceFlag

	// IP address of the peer. Must be 4 or 16 bytes for IPV4 or IPV6 respectively.
	IP net.IP

	// Port the peer is using.
	Port uint16
}

SingleAddr is similar to the wire.NetAddress definition from the btcd guys.

func (*SingleAddr) String

func (addr *SingleAddr) String() string

func (*SingleAddr) StringWithPort

func (addr *SingleAddr) StringWithPort(includePort bool) string

type Snapshot

type Snapshot struct {
	// SnapshotDb is used to store snapshot-related records.
	SnapshotDb      *badger.DB
	SnapshotDbMutex *sync.Mutex
	// AncestralMemory stores information about the ancestral records that should be flushed into the db.
	// We use a concurrency-safe deque which allows us to push objects to the end of the AncestralMemory
	// queue in one thread and consume objects from the beginning of the queue in another thread without
	// concurrency issues. The objects that we push to the queue will be instances of AncestralCache.
	AncestralMemory *lane.Deque

	// DatabaseCache is used to store most recent DB records that we've read/written.
	// This is a low-level optimization for ancestral records that
	// saves us read time when we're writing to the DB during UtxoView flush.
	DatabaseCache lru.KVCache

	// AncestralFlushCounter is used to offset ancestral records flush to occur only after x blocks.
	AncestralFlushCounter uint64

	// SnapshotBlockHeightPeriod is the constant height offset between individual snapshot epochs.
	SnapshotBlockHeightPeriod uint64

	// OperationChannel is used to enqueue actions to the main snapshot Run loop. It is used to
	// schedule actions such as ancestral records updates, checksum computation, snapshot operations.
	OperationChannel *SnapshotOperationChannel

	// Checksum allows us to confirm integrity of the state so that when we're syncing with peers,
	// we are confident that data wasn't tampered with.
	Checksum *StateChecksum

	Migrations *EncoderMigration

	// CurrentEpochSnapshotMetadata is the information about the currently stored complete snapshot, which
	// reflects the state of the blockchain at the largest height divisible by SnapshotBlockHeightPeriod.
	// The metadata includes the block height and its block hash of when the snapshot was taken, and the
	// state checksum.
	CurrentEpochSnapshotMetadata *SnapshotEpochMetadata

	// Status is used to monitor the health of the snapshot. Snapshot is updated concurrently to the main
	// block processing thread. Snapshot is efficient and doesn't stall the main thread, instead it does
	// the snapshot computation in parallel. In a way, Snapshot plays catch with the main thread. As you
	// can imagine this means a lot of concurrency control. Status contains information about the current
	// progress of the main and snapshot threads. We use it to recover the Snapshot in case node was shut
	// down incorrectly.
	Status *SnapshotStatus

	// ExitChannel is used to stop the snapshot when shutting down the node.
	ExitChannel chan bool
	// contains filtered or unexported fields
}

Before explaining what a snapshot is and how to create one, it is important to understand some context on how snapshots came about, and therefore why all this code is even needed in the first place.

Ordinarily, in the pre-hypersync era, one would create a UtxoView, call ConnectBlock() on it to connect all the transactions in the block, and then call flush() on that UtxoView in order to persist all the state changes to disk.

Then hypersync came along. With hypersync, we want to allow one node to download the entire state db directly from another node. But we have a problem: If we try and download the full db state at the "tip" of the chain, then the state could change in the middle of our download, which could take half an hour or more.

So, in order to allow nodes to reliably and robustly download the full db state from one another, we created the concept of a "snapshot." This works as follows:

  1. Ever 1,000 blocks, or every "snapshot epoch", nodes will save a "snapshot" of the current DB state, and keep it around. Imagine, for now, that this snapshot is just a FULL COPY of the db state at each 1,000 block interval...

  2. Whenever one node wants to hypersync from another node, it downloads this snapshot, which should remain static throughout the snapshot epoch, for about a thousand blocks or so. Then, once the node has successfully synced the snapshot, it can download the blocks from the snapshot height, which remember is a multiple of 1,000, up to the tip and just apply them like normal block sync.

This process is *much* faster than applying all blocks from the beginning of time because we don't need to validate transactions when downloading a snapshot *and* because a lot of txns *modify* existing state rather than *add* to existing state. For example, if two people money back and forth a million times, that would be only two account balances you need to download via the hypersync approach, which is much less than a million transactions worth!

Now, there is one detail we glossed over in step (1) above, which is: How is a snapshot generated? Clearly copying the entire state every 1,000 blocks would be prohibitively expensive *and* slow. So, this file implements some cleverness in order to make the generation of snapshots *insanely* efficient (virtually costless).

At a high level, this works by saving a copy of each key-value pair we modify from the snapshot height up to the tip. These copies are called "ancestral records" in all of this code, and you can imagine them as basically storing the "diff" between the snapshot height and the current tip.

Some terminology:

  1. "Main DB" refers to the main db representing all the state up to the current tip. When you flush() your UtxoView, you're flushing to the main DB.

  2. "Ancestral Records DB" refers to a separate db containing one key-value pair for every *modification* since the snapshot height. For example, let's suppose that the key-value (K1 -> V1) exists at the snapshot height, and then we modify it in the main DB to (K1 -> V2) at some block *after* the snapshot. In that case, the Ancestral Records DB would contain (K1 -> V1), i.e. the old value corresponding to K1. And if we were to *add* a new key-value pair (Knew -> Vnew) to the main DB, Ancestral Records would indicate that this record hasn't existed before by storing a special (Knew -> X) record, where X is a fixed value telling us that 'Knew' didn't exist at the snapshot. Finally, when we *delete* a key-value pair (K1 -> V1) from the main DB, then the Ancestral Records would represent this as basically (K1 -> V1), since that's the old value -- so identically to how we handled record modifications.

The key thing to understand is that if you take the MainDB and "merge" it with the Ancestral Records DB, modifying and deleting keys accordingly, then you can compute the snapshot at the historical height that the Ancestral Records started being computed at.

OK... so with all that context, you're now ready to understand how to use this file concretely. Remember that, before snapshots, we could just casually flush() our UtxoView without any issues. Well, now there's one extra step that we have to do to effectively tell the Ancestral Records DB to start "recording" all modifications we're going to make during our flush. The flow works as follows:

  1. Call PrepareAncestralRecordsFlush() to tell the Ancestral Records DB to start "recording" all the modifications you're about to make.

    This will increment a MainDBSemaphore variable, which I'll explain in a moment.

  2. Now you can call utxoView.flush() and be confident that everything being modified in the MainDB will have a corresponding record in the Ancestral Records DB. If you're curious, this was achieved by adding some clever code in DBSetWithTxn that checks to see if you're computing ancestral records, and does the right thing.

    There's one more caveat to the above, which is that we don't actually write to disk when we compute an ancestral record. That would slow down consensus, which we want to avoid. Instead, we just add all the ancestral records we're computing to an in-memory cache, which brings us to our next step...

  3. Once your utxoView.flush() is complete, you have to call StartAncestralRecordsFlush(). This signals that your "MainDB" write is complete, and you can now dump ancestral records to the Ancestral Records DB.

    Unfortunately, there's one more caveat here, which is that you're still not actually going to flush the ancestral records yet. Instead, you're going to add the "bundle" to a queue that is constantly getting processed in an asynchronous worker. Again, the reason for this complexity is to avoid getting in the way of the main consensus thread.

    This will increment a MainDBSemaphore *again*, making its value *even*. This is important! If the value of MainDBSemaphore is *even*, it means that you've properly paired your PrepareAncestralRecordsFlush() call with your StartAncestralRecordsFlush() call *and* it also means we're *NOT* in the middle of a main DB flush. These are the conditions needed in order for it to be OK to safely flush ancestral records basically.

    In addition to incrementing the MainDBSemaphore, we *also* increment a second semaphore, which we call the AncestralDBSemaphore. I'll explain this in a moment.

  4. Finally, in an ansynchronous thread, the bundle of in-memory ancestral records will be pulled off the queue and flushed to disk via FlushAncestralRecords().

    Once the flush of a particular bundle of ancestral records is complete, we then increment the AncestralDBSemaphore *again*, making its value *even*. This is important! If the value of the AncestralDBSemaphore is *even*, it means that we are *NOT* in the middle of an ancestral records flush, which is good. *IN ADDITION*, though, we have one more important condition to consider, which is whether (MainDBSempahore == AncestralDBSemaphore). When this is true *and* when both of these values are *even*, it means that the ancestral records queue is *empty*, meaning that the ancestral records are fully up-to-date.

    How would these values ever be "messed up?" This is a very important question. Suppose that the consensus thread is cranking, and we've enqueued 20 blocks worth of ancestral record flushes. That means that, if MainDBSemaphore is 100, let's say, then AncestralDBSemaphore is (100 - 20) = 80. Eventually, as FlushAncestralRecords() is called by the other thread, the value of AncestralDBSemaphore will increase until it becomes equal to the MainDBSemaphore. The reason why I mention this case is because, if a node is shut down at a point where the values are unequal like this, then the node's snapshot is basically *BROKEN* and needs to be recomputed from scratch. Right now, the only way to do this is to roll back the blocks to the snapshot height and re-apply them, which is not a robust process.

I want to personally apologize for the complexity around the MainDBSemaphore and the AncestralDBSemaphore. It's all in the name of making the snapshot flushing capable of operating fully in parallel with the "main" consensus thread, without slowing it down. In hindsight, it may have been worth side-stepping this complexity in favor of a slower and atomic flow, whereby we first flush the main DB and then immediately flush the ancestral records for that block before allowing forward progress. Doing it this way would also have avoided situations in which a snapshot can break, thus eliminating any reliance on block disconnecting in our codebase. But we live and learn.

---@petern: Fear not the complexity. Embrace it, and the parity semaphores will love you back.

In addition to all of the above, there is one more cool thing that a snapshot does, which is that it keeps track of an "online" checksum of all keys and values in the snapshot. This is done using a cool new primitive we developed called an "Elliptic Sum." At a high level, it's very simple: Imagine you can "add" a key-value pair to a checksum such that if ChecksumA = ChecksumB, then the key-value pairs that contributed to each *MUST* be identical. This allows a node to effectively *validate* that the key-value pairs that it downloaded during a hypersync are not tampered-with in any way. And this checksum is *really important* because, without it, another node could easily trick you into thinking that it has a billion dollars in an extra balance that it appended to the state it sent you...

If you understood all of the above, I think you mostly understand hypersync and the code in this file. Good job!

= = =

The comment below pre-dates the one above, but I'm leaving it here for posterity. It also has some useful tidbits of information and detail that are worth going through if you're going to go deep into this file.

= = =

Snapshot is the main data structure used in hyper sync. It manages the creation of the database snapshot (as the name suggests), which is a periodic copy of the node's state at certain block heights, separated by a constant period. This period is defined by SnapshotBlockHeightPeriod, meaning Snapshot will build copies of the db at heights: 0, period, 2 * period, 3 * period, ... The blocks between the snapshot heights are referred to as a snapshot epoch.

Cloning the database for infinite-state blockchains like DeSo would be extremely costly, incurring minutes of downtime. Using merkle trees is also out of the question because Merkle trees incur O(log n) computational complexity for updates and O(n) space complexity, where n is the number of leaves in the tree.

Instead, we use a structure called ancestral records, combined with a breakthrough checksum mechanism called EllipticSum. Ancestral records are constructed on-the-go and only store records modified during a snapshot epoch. This allows us to reconstruct the database at the last snapshot height by combining the ancestral record entries with the main db entries. This process has a significantly smaller computational and storage overhead.

The ancestral records are stored in a separate database that's modified asynchronously to the main db. This means that the main node thread is minimally affected by the snapshot computation. It also means that we need to manage the concurrency between these two databases. We will achieve this without locking through Snapshot's OperationChannel, to which the main thread will enqueue asynchronous operations such as ancestral record updates, checksum computations, snapshot operations, etc. In addition, Snapshot is used to serve state chunks to nodes that are booting using hyper sync. In such cases, the Snapshot will fetch a portion of the snapshot database by scanning a section of the main db as well as relevant ancestral records, to combine them into a chunk representing the database at a past snapshot heights.

Summarizing, Snapshot serves three main purposes:

  • maintaining ancestral records
  • managing the state checksum
  • serving snapshot chunks to syncing nodes.

func NewSnapshot

func NewSnapshot(mainDb *badger.DB, mainDbDirectory string, snapshotBlockHeightPeriod uint64, isTxIndex bool,
	disableChecksum bool, params *DeSoParams, disableMigrations bool) (_snap *Snapshot, _err error, _shouldRestart bool)

NewSnapshot creates a new snapshot instance.

func (*Snapshot) AddChecksumBytes

func (snap *Snapshot) AddChecksumBytes(key []byte, value []byte)

func (*Snapshot) AncestralRecordToDBEntry

func (snap *Snapshot) AncestralRecordToDBEntry(ancestralEntry *DBEntry) *DBEntry

AncestralRecordToDBEntry is used to translate the <ancestral_key, ancestral_value> pairs into the actual <key, value> pairs. Ancestral records have the format:

<prefix [1]byte, block height [8]byte, key []byte> -> <value []byte, existence_byte [1]byte>

So we need to trim the first 9 bytes off of the ancestral_key to get the actual key. And we need to trim the last 1 byte off of the ancestral_value to get the actual value.

func (*Snapshot) CheckAnceststralRecordExistenceByte

func (snap *Snapshot) CheckAnceststralRecordExistenceByte(value []byte) bool

CheckAnceststralRecordExistenceByte checks the existence_byte in the ancestral record value.

func (*Snapshot) DBSetAncestralRecordWithTxn

func (snap *Snapshot) DBSetAncestralRecordWithTxn(
	txn *badger.Txn, blockHeight uint64, keyBytes []byte, value *AncestralRecordValue) error

DBSetAncestralRecordWithTxn sets a record corresponding to our ExistingRecordsMap. We append a []byte{1} to the end to indicate that this is an existing record, and we append a []byte{0} to the end to indicate that this is a NON-existent record. We need to create this distinction to tell the difference between a record that was updated to have an *empty* value vs a record that was deleted entirely.

func (*Snapshot) DeleteAncestralRecords

func (snap *Snapshot) DeleteAncestralRecords(height uint64) error

DeleteAncestralRecords is used to delete ancestral records for the provided height.

func (*Snapshot) FinishProcessBlock

func (snap *Snapshot) FinishProcessBlock(blockNode *BlockNode)

func (*Snapshot) FlushAncestralRecords

func (snap *Snapshot) FlushAncestralRecords()

FlushAncestralRecords updates the ancestral records after a UtxoView flush. This function should be called in a go-routine after all UtxoView flushes.

func (*Snapshot) ForceResetToLastSnapshot

func (snap *Snapshot) ForceResetToLastSnapshot(chain *Blockchain) error

ForceResetToLastSnapshot is a doomsday scenario recovery mode. It will be triggered if the node was shutdown midway, resulting in a corrupted ancestral records or checksum. To recover from this situation, we will revert to the beginning of the current snapshot epoch. We do this by disconnecting blocks from the tip to the epoch's start and resetting the checksum.

func (*Snapshot) GetAncestralRecordsKey

func (snap *Snapshot) GetAncestralRecordsKey(key []byte, blockHeight uint64) []byte

GetAncestralRecordsKey is used to get an ancestral record key from a main DB key.

<prefix [1]byte, block height [8]byte, key []byte> -> <value []byte, existence_byte [1]byte>

func (*Snapshot) GetAncestralRecordsKeyWithTxn

func (snap *Snapshot) GetAncestralRecordsKeyWithTxn(txn *badger.Txn, key []byte, blockHeight uint64) (
	_record *badger.Item, _err error)

GetAncestralRecordsKey is warpper around an ancestral record.

func (*Snapshot) GetSnapshotChunk

func (snap *Snapshot) GetSnapshotChunk(mainDb *badger.DB, prefix []byte, startKey []byte) (
	_snapshotEntriesBatch []*DBEntry, _snapshotEntriesFilled bool, _concurrencyFault bool, _err error)

GetSnapshotChunk fetches a batch of records from the nodes DB that match the provided prefix and have a key at least equal to the startKey lexicographically. The function will also fetch ancestral records and combine them with the DB records so that the batch reflects an ancestral block.

func (*Snapshot) PersistChecksumAndMigration

func (snap *Snapshot) PersistChecksumAndMigration() error

func (*Snapshot) PrepareAncestralRecord

func (snap *Snapshot) PrepareAncestralRecord(key string, value []byte, existed bool) error

PrepareAncestralRecord prepares an individual ancestral record in the last ancestral cache. It will add the record to AncestralRecordsMap with a bool indicating whether the key existed before or not.

See comment at the top of this file to understand how to use this function to generate ancestral records needed to support hypersync.

func (*Snapshot) PrepareAncestralRecordsFlush

func (snap *Snapshot) PrepareAncestralRecordsFlush()

PrepareAncestralRecordsFlush adds a new instance of ancestral cache to the AncestralMemory deque. It must be called prior to calling StartAncestralRecordsFlush.

See comment at the top of this file to understand how to use this function to generate ancestral records needed to support hypersync.

func (*Snapshot) PrintChecksum

func (snap *Snapshot) PrintChecksum(text string)

func (*Snapshot) ProcessSnapshotChunk

func (snap *Snapshot) ProcessSnapshotChunk(mainDb *badger.DB, mainDbMutex *deadlock.RWMutex,
	snapshotChunk []*DBEntry, blockHeight uint64)

func (*Snapshot) RemoveChecksumBytes

func (snap *Snapshot) RemoveChecksumBytes(key []byte, value []byte)

func (*Snapshot) Run

func (snap *Snapshot) Run()

Run is the snapshot main loop. It handles the operations from the OperationChannel.

func (*Snapshot) SetSnapshotChunk

func (snap *Snapshot) SetSnapshotChunk(mainDb *badger.DB, mainDbMutex *deadlock.RWMutex,
	chunk []*DBEntry, blockHeight uint64) error

SetSnapshotChunk is called to put the snapshot chunk that we've got from a peer in the database.

func (*Snapshot) SnapshotProcessBlock

func (snap *Snapshot) SnapshotProcessBlock(blockNode *BlockNode)

SnapshotProcessBlock updates the snapshot information after a block has been added.

func (*Snapshot) StartAncestralRecordsFlush

func (snap *Snapshot) StartAncestralRecordsFlush(shouldIncrement bool)

StartAncestralRecordsFlush updates the ancestral records after a UtxoView flush. This function should be called after all UtxoView flushes. shouldIncrement is usually set to true and indicates that we are supposed to update the db semaphores. The semaphore are used to manage concurrency between the main and ancestral dbs.

See comment at the top of this file to understand how to use this function to generate ancestral records needed to support hypersync.

func (*Snapshot) Stop

func (snap *Snapshot) Stop()

func (*Snapshot) String

func (snap *Snapshot) String() string

func (*Snapshot) WaitForAllOperationsToFinish

func (snap *Snapshot) WaitForAllOperationsToFinish()

WaitForAllOperationsToFinish will busy-wait for the snapshot channel to process all current operations. Spinlocks are undesired but it's the easiest solution in this case,

type SnapshotCompletedEventFunc

type SnapshotCompletedEventFunc func()

type SnapshotEpochMetadata

type SnapshotEpochMetadata struct {
	// SnapshotBlockHeight is the height of the snapshot.
	SnapshotBlockHeight uint64

	// This is the block height of the very first snapshot this node encountered on its
	// initial hypersync. This field is distinct from SnapshotBlockHeight, which updates
	// every time we enter a new snapshot epoch. It is mainly used by Rosetta to determine
	// where to start returning "real" blocks vs "dummy" blocks. In particular, before the
	// first snapshot, Rosetta will return dummy blocks that don't have any txn operations
	// in them, whereas after the first snapshot, Rosetta will "bootstrap" all the balances
	// in a single mega-block at the snapshot, and then return "real" blocks thereafter.
	FirstSnapshotBlockHeight uint64

	// CurrentEpochChecksumBytes is the bytes of the state checksum for the snapshot at the epoch.
	CurrentEpochChecksumBytes []byte
	// CurrentEpochBlockHash is the hash of the first block of the current epoch. It's used to identify the snapshot.
	CurrentEpochBlockHash *BlockHash
	// contains filtered or unexported fields
}

func (*SnapshotEpochMetadata) FromBytes

func (metadata *SnapshotEpochMetadata) FromBytes(rr *bytes.Reader) error

func (*SnapshotEpochMetadata) Initialize

func (metadata *SnapshotEpochMetadata) Initialize(snapshotDb *badger.DB, snapshotDbMutex *sync.Mutex) error

func (*SnapshotEpochMetadata) ToBytes

func (metadata *SnapshotEpochMetadata) ToBytes() []byte

type SnapshotOperation

type SnapshotOperation struct {
	// contains filtered or unexported fields
}

SnapshotOperation is passed in the snapshot's OperationChannel.

type SnapshotOperationChannel

type SnapshotOperationChannel struct {
	OperationChannel chan *SnapshotOperation

	// Every time we enqueue a snapshot operation, this semaphore is incremented in
	// order to indicate how many operations we have yet to process. When an operation
	// is dequeued, this semaphore is decremented. When the semaphore value hits zero,
	// it means we've finished processing all snapshot operations.
	//
	// Note that this semaphore keeps track of snapshot operations, which include
	// but are not limited to ancestral record flushes. As such it is different
	// from the MainDBSemaphore and the AncestralDBSemaphore which manage concurrency
	// around flushes only.
	StateSemaphore     int32
	StateSemaphoreLock sync.Mutex
	// contains filtered or unexported fields
}

func (*SnapshotOperationChannel) DequeueOperationStateless

func (opChan *SnapshotOperationChannel) DequeueOperationStateless() *SnapshotOperation

func (*SnapshotOperationChannel) EnqueueOperation

func (opChan *SnapshotOperationChannel) EnqueueOperation(op *SnapshotOperation)

func (*SnapshotOperationChannel) FinishOperation

func (opChan *SnapshotOperationChannel) FinishOperation()

func (*SnapshotOperationChannel) GetStatus

func (opChan *SnapshotOperationChannel) GetStatus() int32

func (*SnapshotOperationChannel) Initialize

func (opChan *SnapshotOperationChannel) Initialize(snapshotDb *badger.DB, snapshotDbMutex *sync.Mutex,
	startOperationHandler func(op *SnapshotOperation) error, finishAllOperationsHandler func() error) error

func (*SnapshotOperationChannel) SaveOperationChannel

func (opChan *SnapshotOperationChannel) SaveOperationChannel() error

func (*SnapshotOperationChannel) SetFinishAllOperationsHandler

func (opChan *SnapshotOperationChannel) SetFinishAllOperationsHandler(handler func() error)

func (*SnapshotOperationChannel) SetStartOperationHandler

func (opChan *SnapshotOperationChannel) SetStartOperationHandler(handler func(op *SnapshotOperation) error)

type SnapshotOperationType

type SnapshotOperationType uint8

SnapshotOperationType define the different operations that can be enqueued to the snapshot's OperationChannel.

const (
	// SnapshotOperationFlush operation enqueues a flush to the ancestral records.
	SnapshotOperationFlush SnapshotOperationType = iota
	// SnapshotOperationProcessBlock operation signals that a new block has been added to the blockchain.
	SnapshotOperationProcessBlock
	// SnapshotOperationProcessChunk operation is enqueued when we receive a snapshot chunk during syncing.
	SnapshotOperationProcessChunk
	// SnapshotOperationChecksumAdd operation is enqueued when we want to add bytes to the state checksum.
	SnapshotOperationChecksumAdd
	// SnapshotOperationChecksumRemove operation is enqueued when we want to remove bytes to the state checksum.
	SnapshotOperationChecksumRemove
	// SnapshotOperationChecksumPrint is called when we want to print the state checksum.
	SnapshotOperationChecksumPrint
	// SnapshotOperationExit is used to quit the snapshot loop
	SnapshotOperationExit
)

type SnapshotStatus

type SnapshotStatus struct {
	// MainDBSemaphore and AncestralDBSemaphore are atomically accessed counter semaphores that will be
	// used to control race conditions between main db and ancestral records. They basically manage the concurrency
	// between writes to the main and ancestral dbs.
	//
	// See the comment at the top of snapshot.go for detailed information on how these semaphores work.
	MainDBSemaphore      uint64
	AncestralDBSemaphore uint64

	// CurrentBlockHeight is the blockheight of the blockchain tip.
	CurrentBlockHeight uint64
	// MemoryLock is held whenever we modify the MainDBSemaphore or AncestralDBSemaphore.
	MemoryLock sync.Mutex
	// contains filtered or unexported fields
}

func (*SnapshotStatus) FromBytes

func (status *SnapshotStatus) FromBytes(rr *bytes.Reader) error

func (*SnapshotStatus) GetSemaphores

func (status *SnapshotStatus) GetSemaphores() (_mainDbSemaphore uint64, _ancestralDBSemaphore uint64)

GetSemaphores retrieves main and ancestral db semaphores.

func (*SnapshotStatus) IncrementAncestralDBSemaphoreMemoryLockRequired

func (status *SnapshotStatus) IncrementAncestralDBSemaphoreMemoryLockRequired()

IncrementAncestralDBSemaphoreMemoryLockRequired increments the AncestralDBSemaphore by one, it should be called with MemoryLock.

func (*SnapshotStatus) IncrementMainDbSemaphoreMemoryLockRequired

func (status *SnapshotStatus) IncrementMainDbSemaphoreMemoryLockRequired()

IncrementMainDbSemaphoreMemoryLockRequired increments the MainDBSemaphore by one, it should be called with MemoryLock.

func (*SnapshotStatus) Initialize

func (status *SnapshotStatus) Initialize(snapshotDb *badger.DB, snapshotDbMutex *sync.Mutex) error

func (*SnapshotStatus) IsFlushing

func (status *SnapshotStatus) IsFlushing() bool

IsFlushing checks whether a main DB flush or ancestral record flush is taking place.

func (*SnapshotStatus) IsFlushingToAncestralMemoryLockRequired

func (status *SnapshotStatus) IsFlushingToAncestralMemoryLockRequired() bool

IsFlushingToAncestralMemoryLockRequired checks if a flush to AncestralDB takes place. This should be called with MemoryLock.

func (*SnapshotStatus) IsFlushingToMainDBMemoryLockRequired

func (status *SnapshotStatus) IsFlushingToMainDBMemoryLockRequired() bool

IsFlushingToMainDBMemoryLockRequired checks if a flush to MainDB takes place. This should be called with MemoryLock.

func (*SnapshotStatus) IsFlushingWithoutLock

func (status *SnapshotStatus) IsFlushingWithoutLock() bool

func (*SnapshotStatus) ReadStatus

func (status *SnapshotStatus) ReadStatus() error

func (*SnapshotStatus) SaveStatus

func (status *SnapshotStatus) SaveStatus()

func (*SnapshotStatus) ToBytes

func (status *SnapshotStatus) ToBytes() []byte

type StateChecksum

type StateChecksum struct {
	// contains filtered or unexported fields
}

StateChecksum is used to verify integrity of state data. When syncing state from peers, we need to ensure that we are receiving the same copy of the database. Traditionally, this has been done using Merkle trees; however, Merkle trees incur O(log n) computational complexity for updates and O(n) space complexity, where n is the number of leaves in the tree.

Instead, we use a structure that allows us to have an O(1) time and O(1) space complexity. We call our checksum construction EllipticSum, as the checksum of the data is represented by a sum of elliptic curve points. To verify integrity of the data, we only need a single ec point.

To put in layman's terms, the EllipticSum checksum works as follows: - Checksum = hash_to_curve(chunk_0) + hash_to_curve(chunk_1) + ... + hash_to_curve(chunk_n) where chunk_i is a chunk of bytes, and hash_to_curve(chunk_i) generates an elliptic curve point from the bytes deterministically, similar to hashing the bytes. The reason we sum elliptic curve points rather than hashes of the bytes is because summing hashes of the bytes would result in the checksum being vulnerable to attack, as discussed below.

EllipticSum is inspired by the generalized k-sum problem, where given a set of uniformly random numbers L, we want to find a subset of k elements in L that XORs to 0. This XOR problem can actually be solved efficiently with dynamic programming, so it's not useful to us as a checksum if we use the naive XOR version. However, if we extend it to using elliptic curve points, as we explain below, it becomes computationally infeasible to solve, which is what we need.

The reason this works is that k-sum can be generalized to any algebraic group. That is, given a group G, identity element 0, operation +, and some set L of random group elements, find a subset (a_0, a_1, ..., a_k) such that a_0 + a_1 + ... + a_k = 0.

It turns out that if this is a cyclic group, such as the group formed by elliptic curve points, then this problem is equivalent to the DLP in G, which is computationally infeasible for a sufficiently large group, and which has a computational lower bound of O(sqrt(p)) where p is the smallest prime dividing the order of G. https://link.springer.com/content/pdf/10.1007%2F3-540-45708-9_19.pdf

We use an elliptic curve group Ristretto255 and hash state data directly on the curve using the hash_to_curve primitive based on elligator2. The hash_to_curve mapping takes a byte array input and outputs a point via a mapping indistinguishable from a random function. Hash_to_curve does not reveal the discrete logarithm of the output points. According to the O(sqrt(p)) lower bound, Ristretto255 guarantees 126 bits of security.

To learn more about hash_to_curve, see this article: https://tools.ietf.org/id/draft-irtf-cfrg-hash-to-curve-06.html

func (*StateChecksum) AddBytes

func (sc *StateChecksum) AddBytes(bytes []byte) error

AddBytes adds record bytes to the checksum in parallel.

func (*StateChecksum) AddOrRemoveBytesWithMigrations

func (sc *StateChecksum) AddOrRemoveBytesWithMigrations(keyInput []byte, valueInput []byte, blockHeight uint64,
	encoderMigrationChecksums []*EncoderMigrationChecksum, addBytes bool) error

AddOrRemoveBytesWithMigrations is used to add or remove (key, value) bytes to the checksum and all encoder migration checksums. Depending on the blockHeight, the (key, value) pair might be encoded differently. This is due to encoder migrations, which allow for modifications to the encoder schemas that come into effect on pre-defined blockHeights. With migrations, nodes won't need to re-sync after a software upgrade. To make migrations work, we need a way to maintain a valid checksum across different encoder migration epochs. We do this by keeping a checksum copy for each migration epoch and add to it with the respective encoder version. This function is called in the context of the snapshot's epoch so that everything happens in sync with the main thread. The parameter addBytes determines if we want to add or remove bytes from the checksums.

func (*StateChecksum) AddToChecksum

func (sc *StateChecksum) AddToChecksum(elem group.Element)

func (*StateChecksum) FromBytes

func (sc *StateChecksum) FromBytes(checksumBytes []byte) error

func (*StateChecksum) GetChecksum

func (sc *StateChecksum) GetChecksum() (group.Element, error)

GetChecksum is used to get the checksum elliptic curve element.

func (*StateChecksum) HashToCurve

func (sc *StateChecksum) HashToCurve(bytes []byte) group.Element

func (*StateChecksum) Initialize

func (sc *StateChecksum) Initialize(snapshotDb *badger.DB, snapshotDbMutex *sync.Mutex) error

Initialize starts the state checksum by initializing it to the identity element.

func (*StateChecksum) RemoveBytes

func (sc *StateChecksum) RemoveBytes(bytes []byte) error

RemoveBytes works similarly to AddBytes.

func (*StateChecksum) ResetChecksum

func (sc *StateChecksum) ResetChecksum()

func (*StateChecksum) SaveChecksum

func (sc *StateChecksum) SaveChecksum() error

func (*StateChecksum) ToBytes

func (sc *StateChecksum) ToBytes() ([]byte, error)

ToBytes gets the checksum point encoded in compressed format as a 32 byte array. Note: Don't use this function to deep copy the checksum, use GetChecksum instead. ToBytes is doing an inverse square root, so it is slow.

func (*StateChecksum) Wait

func (sc *StateChecksum) Wait() error

Wait until there is no checksum workers holding the semaphore.

type SubmitPostMetadata

type SubmitPostMetadata struct {

	// When set, this transaction is treated as modifying an existing
	// post rather than creating a new post.
	PostHashToModify []byte

	// When a ParentStakeID is set, the post is actually a comment on
	// another entity (either a post or a profile depending on the
	// type of StakeID provided).
	ParentStakeID []byte
	Body          []byte

	// The amount the creator of the post gets when someone stakes
	// to the post.
	CreatorBasisPoints uint64
	// The multiple of the payout when a user stakes to a post.
	// 2x multiple = 200% = 20,000bps
	StakeMultipleBasisPoints uint64

	// A timestamp used for ordering messages when displaying them to
	// users. The timestamp must be unique. Note that we use a nanosecond
	// timestamp because it makes it easier to deal with the uniqueness
	// constraint technically (e.g. If one second spacing is required
	// as would be the case with a standard Unix timestamp then any code
	// that generates these transactions will need to potentially wait
	// or else risk a timestamp collision. This complexity is avoided
	// by just using a nanosecond timestamp). Note that the timestamp is
	// an unsigned int as opposed to a signed int, which means times
	// before the zero time are not represented which doesn't matter
	// for our purposes. Restricting the timestamp in this way makes
	// lexicographic sorting based on bytes easier in our database which
	// is one of the reasons we do it.
	TimestampNanos uint64

	// When set to true, indicates that the post should be deleted. This
	// value is only considered when PostHashToModify is set to a valid
	// pre-existing post.
	IsHidden bool
}

func (*SubmitPostMetadata) FromBytes

func (txnData *SubmitPostMetadata) FromBytes(data []byte) error

func (*SubmitPostMetadata) GetTxnType

func (txnData *SubmitPostMetadata) GetTxnType() TxnType

func (*SubmitPostMetadata) New

func (txnData *SubmitPostMetadata) New() DeSoTxnMetadata

func (*SubmitPostMetadata) ToBytes

func (txnData *SubmitPostMetadata) ToBytes(preSignature bool) ([]byte, error)

type SubmitPostTxindexMetadata

type SubmitPostTxindexMetadata struct {
	PostHashBeingModifiedHex string

	// If this is a reply to an existing post, then the ParentPostHashHex
	ParentPostHashHex string
}

func (*SubmitPostTxindexMetadata) GetEncoderType

func (txnMeta *SubmitPostTxindexMetadata) GetEncoderType() EncoderType

func (*SubmitPostTxindexMetadata) GetVersionByte

func (txnMeta *SubmitPostTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*SubmitPostTxindexMetadata) RawDecodeWithoutMetadata

func (txnMeta *SubmitPostTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*SubmitPostTxindexMetadata) RawEncodeWithoutMetadata

func (txnMeta *SubmitPostTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type SummaryStats

type SummaryStats struct {
	// Number of transactions of this type in the mempool.
	Count uint32

	// Number of bytes for transactions of this type in the mempool.
	TotalBytes uint64
}

Summary stats for a set of transactions of a specific type in the mempool.

type SwapIdentityMetadataa

type SwapIdentityMetadataa struct {

	// The public key that we are swapping *from*. Doesn't matter which public
	// key is *from* and which public key is *to* because it's just a swap.
	FromPublicKey []byte

	// The public key that we are swapping *to*. Doesn't matter which public
	// key is *from* and which public key is *to* because it's just a swap.
	ToPublicKey []byte
}

func (*SwapIdentityMetadataa) FromBytes

func (txnData *SwapIdentityMetadataa) FromBytes(dataa []byte) error

func (*SwapIdentityMetadataa) GetTxnType

func (txnData *SwapIdentityMetadataa) GetTxnType() TxnType

func (*SwapIdentityMetadataa) New

func (txnData *SwapIdentityMetadataa) New() DeSoTxnMetadata

func (*SwapIdentityMetadataa) ToBytes

func (txnData *SwapIdentityMetadataa) ToBytes(preSignature bool) ([]byte, error)

type SwapIdentityOperationType

type SwapIdentityOperationType uint8

type SwapIdentityTxindexMetadata

type SwapIdentityTxindexMetadata struct {
	FromPublicKeyBase58Check string
	ToPublicKeyBase58Check   string

	// Rosetta needs this information to track creator coin balances
	FromDeSoLockedNanos uint64
	ToDeSoLockedNanos   uint64
}

func (*SwapIdentityTxindexMetadata) GetEncoderType

func (txnMeta *SwapIdentityTxindexMetadata) GetEncoderType() EncoderType

func (*SwapIdentityTxindexMetadata) GetVersionByte

func (txnMeta *SwapIdentityTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*SwapIdentityTxindexMetadata) RawDecodeWithoutMetadata

func (txnMeta *SwapIdentityTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*SwapIdentityTxindexMetadata) RawEncodeWithoutMetadata

func (txnMeta *SwapIdentityTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type SyncPrefixProgress

type SyncPrefixProgress struct {
	// Peer assigned for retrieving this particular prefix.
	PrefixSyncPeer *Peer
	// DB prefix corresponding to this particular sync progress.
	Prefix []byte
	// LastReceivedKey is the last key that we've received from this peer.
	LastReceivedKey []byte

	// Completed indicates whether we've finished syncing this prefix.
	Completed bool
}

SyncPrefixProgress keeps track of sync progress on an individual prefix. It is used in hyper sync to determine which peer to query about each prefix and also what was the last db key that we've received from that peer. Peers will send us state by chunks. But first we need to tell the peer the starting key for the chunk we want to retrieve.

type SyncProgress

type SyncProgress struct {
	// PrefixProgress includes a list of SyncPrefixProgress objects, each of which represents a state prefix.
	PrefixProgress []*SyncPrefixProgress

	// SnapshotMetadata is the information about the snapshot we're downloading.
	SnapshotMetadata *SnapshotEpochMetadata

	// Completed indicates whether we've finished syncing state.
	Completed bool
	// contains filtered or unexported fields
}

SyncProgress is used to keep track of hyper sync progress. It stores a list of SyncPrefixProgress structs which are used to track progress on each individual prefix. It also has the snapshot block height and block hash of the current snapshot epoch.

func (*SyncProgress) PrintLoop

func (progress *SyncProgress) PrintLoop()

type SyncState

type SyncState uint8
const (
	// SyncStateSyncingHeaders indicates that our header chain is not current.
	// This is the state a node will start in when it hasn't downloaded
	// anything from its peers. Because we always download headers and
	// validate them before we download blocks, SyncingHeaders implies that
	// the block tip is also not current yet.
	SyncStateSyncingHeaders SyncState = iota
	// SyncStateSyncingSnapshot indicates that our header chain is current, and
	// we're syncing state from a snapshot. This is part of the hyper sync
	// protocol, where the node first downloads the header chain and then
	// proceeds to download state from some recent point in time. After we
	// download the snapshot, we will continue downloading blocks from the
	// snapshot height, rather than from genesis.
	SyncStateSyncingSnapshot
	// SyncStateSyncingBlocks indicates that our header chain is current but
	// that the block chain we have is not current yet. In particular, it
	// means, among other things, that the tip of the block chain is still
	// older than max tip age.
	SyncStateSyncingBlocks
	// SyncStateNeedBlocksss indicates that our header chain is current and our
	// block chain is current but that there are headers in our main chain for
	// which we have not yet processed blocks.
	SyncStateNeedBlocksss
	// SyncStateSyncingHistoricalBlocks indicates that our node was bootstrapped using
	// hypersync and that we're currently downloading historical blocks
	SyncStateSyncingHistoricalBlocks
	// SyncStateFullyCurrent indicates that our header chain is current and that
	// we've fetched all the blocks corresponding to this chain.
	SyncStateFullyCurrent
)

func (SyncState) String

func (ss SyncState) String() string

type TXIndex

type TXIndex struct {
	// TXIndexLock protects the transaction index.
	TXIndexLock deadlock.RWMutex

	// The txindex has it s own separate Blockchain object. This allows us to
	// capture more metadata when collecting transactions without interfering
	// with the goings-on of the main chain.
	TXIndexChain *Blockchain

	// Core objects from Server
	CoreChain *Blockchain

	// Core params object
	Params *DeSoParams
	// contains filtered or unexported fields
}

func NewTXIndex

func NewTXIndex(coreChain *Blockchain, params *DeSoParams, dataDirectory string) (
	_txindex *TXIndex, _error error)

func (*TXIndex) FinishedSyncing

func (txi *TXIndex) FinishedSyncing() bool

func (*TXIndex) GetTxindexUpdateBlockNodes

func (txi *TXIndex) GetTxindexUpdateBlockNodes() (
	_txindexTipNode *BlockNode, _blockTipNode *BlockNode, _commonAncestor *BlockNode,
	_detachBlocks []*BlockNode, _attachBlocks []*BlockNode)

GetTxindexUpdateBlockNodes ...

func (*TXIndex) Start

func (txi *TXIndex) Start()

func (*TXIndex) Stop

func (txi *TXIndex) Stop()

Stop TXIndex node. This method doesn't close the txindex db, make sure to call in the parent context:

txi.TXIndexChain.DB().Close()

It's important!!! Do it after the txi.updateWaitGroup.Wait().

func (*TXIndex) Update

func (txi *TXIndex) Update() error

Update syncs the transaction index with the blockchain. Specifically, it reads in all the blocks that have come in since the last time this function was called and adds the new transactions to the txindex. It also handles reorgs properly.

TODO(DELETEME, cleanup): This code is error-prone. Moving the transaction indexing code to block_view.go may be a clean way to refactor this.

type Timer

type Timer struct {
	// contains filtered or unexported fields
}

Timer is used for convenience to time certain events during development. NOTE: Timer uses maps and so doesn't support concurrent calls to Start() or End().

func (*Timer) End

func (t *Timer) End(eventName string)

func (*Timer) Initialize

func (t *Timer) Initialize()

func (*Timer) Print

func (t *Timer) Print(eventName string)

func (*Timer) Start

func (t *Timer) Start(eventName string)

type TransactionEvent

type TransactionEvent struct {
	Txn     *MsgDeSoTxn
	TxnHash *BlockHash

	// Optional
	UtxoView *UtxoView
	UtxoOps  []*UtxoOperation
}

type TransactionEventFunc

type TransactionEventFunc func(event *TransactionEvent)

type TransactionMetadata

type TransactionMetadata struct {
	BlockHashHex    string
	TxnIndexInBlock uint64
	TxnType         string
	// All transactions have a public key who executed the transaction and some
	// public keys that are affected by the transaction. Notifications are created
	// for the affected public keys. _getPublicKeysForTxn uses this to set entries in the
	// database.
	TransactorPublicKeyBase58Check string
	AffectedPublicKeys             []*AffectedPublicKey

	// We store these outputs so we don't have to load the full transaction from disk
	// when looking up output amounts
	TxnOutputs []*DeSoOutput

	BasicTransferTxindexMetadata         *BasicTransferTxindexMetadata         `json:",omitempty"`
	BitcoinExchangeTxindexMetadata       *BitcoinExchangeTxindexMetadata       `json:",omitempty"`
	CreatorCoinTxindexMetadata           *CreatorCoinTxindexMetadata           `json:",omitempty"`
	CreatorCoinTransferTxindexMetadata   *CreatorCoinTransferTxindexMetadata   `json:",omitempty"`
	UpdateProfileTxindexMetadata         *UpdateProfileTxindexMetadata         `json:",omitempty"`
	SubmitPostTxindexMetadata            *SubmitPostTxindexMetadata            `json:",omitempty"`
	LikeTxindexMetadata                  *LikeTxindexMetadata                  `json:",omitempty"`
	FollowTxindexMetadata                *FollowTxindexMetadata                `json:",omitempty"`
	PrivateMessageTxindexMetadata        *PrivateMessageTxindexMetadata        `json:",omitempty"`
	SwapIdentityTxindexMetadata          *SwapIdentityTxindexMetadata          `json:",omitempty"`
	NFTBidTxindexMetadata                *NFTBidTxindexMetadata                `json:",omitempty"`
	AcceptNFTBidTxindexMetadata          *AcceptNFTBidTxindexMetadata          `json:",omitempty"`
	NFTTransferTxindexMetadata           *NFTTransferTxindexMetadata           `json:",omitempty"`
	AcceptNFTTransferTxindexMetadata     *AcceptNFTTransferTxindexMetadata     `json:",omitempty"`
	BurnNFTTxindexMetadata               *BurnNFTTxindexMetadata               `json:",omitempty"`
	DAOCoinTxindexMetadata               *DAOCoinTxindexMetadata               `json:",omitempty"`
	DAOCoinTransferTxindexMetadata       *DAOCoinTransferTxindexMetadata       `json:",omitempty"`
	CreateNFTTxindexMetadata             *CreateNFTTxindexMetadata             `json:",omitempty"`
	UpdateNFTTxindexMetadata             *UpdateNFTTxindexMetadata             `json:",omitempty"`
	DAOCoinLimitOrderTxindexMetadata     *DAOCoinLimitOrderTxindexMetadata     `json:",omitempty"`
	CreateUserAssociationTxindexMetadata *CreateUserAssociationTxindexMetadata `json:",omitempty"`
	DeleteUserAssociationTxindexMetadata *DeleteUserAssociationTxindexMetadata `json:",omitempty"`
	CreatePostAssociationTxindexMetadata *CreatePostAssociationTxindexMetadata `json:",omitempty"`
	DeletePostAssociationTxindexMetadata *DeletePostAssociationTxindexMetadata `json:",omitempty"`
	AccessGroupTxindexMetadata           *AccessGroupTxindexMetadata           `json:",omitempty"`
	AccessGroupMembersTxindexMetadata    *AccessGroupMembersTxindexMetadata    `json:",omitempty"`
	NewMessageTxindexMetadata            *NewMessageTxindexMetadata            `json:",omitempty"`
}

func ComputeTransactionMetadata

func ComputeTransactionMetadata(txn *MsgDeSoTxn, utxoView *UtxoView, blockHash *BlockHash,
	totalNanosPurchasedBefore uint64, usdCentsPerBitcoinBefore uint64, totalInput uint64, totalOutput uint64,
	fees uint64, txnIndexInBlock uint64, utxoOps []*UtxoOperation, blockHeight uint64) *TransactionMetadata

func ConnectTxnAndComputeTransactionMetadata

func ConnectTxnAndComputeTransactionMetadata(
	txn *MsgDeSoTxn, utxoView *UtxoView, blockHash *BlockHash,
	blockHeight uint32, txnIndexInBlock uint64) (*TransactionMetadata, error)

func DbGetTxindexTransactionRefByTxID

func DbGetTxindexTransactionRefByTxID(handle *badger.DB, snap *Snapshot, txID *BlockHash) *TransactionMetadata

func DbGetTxindexTransactionRefByTxIDWithTxn

func DbGetTxindexTransactionRefByTxIDWithTxn(txn *badger.Txn, snap *Snapshot, txID *BlockHash) *TransactionMetadata

func (*TransactionMetadata) GetEncoderType

func (txnMeta *TransactionMetadata) GetEncoderType() EncoderType

func (*TransactionMetadata) GetVersionByte

func (txnMeta *TransactionMetadata) GetVersionByte(blockHeight uint64) byte

func (*TransactionMetadata) RawDecodeWithoutMetadata

func (txnMeta *TransactionMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*TransactionMetadata) RawEncodeWithoutMetadata

func (txnMeta *TransactionMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type TransactionSpendingLimit

type TransactionSpendingLimit struct {
	// This is the total amount the derived key can spend.
	GlobalDESOLimit uint64

	// TransactionCount
	// If a transaction type is not specified in the map, it is not allowed.
	// If the transaction type is in the map, the derived key is allowed to
	// perform the transaction up to the value to which it is mapped.
	TransactionCountLimitMap map[TxnType]uint64

	// CreatorCoinOperationLimitMap is a map with keys composed of
	// creator PKID || CreatorCoinLimitOperation to number
	// of transactions
	CreatorCoinOperationLimitMap map[CreatorCoinOperationLimitKey]uint64

	// DAOCoinOperationLimitMap is a map with keys composed of
	// creator PKID || DAOCoinLimitOperation to number of
	// transactions
	DAOCoinOperationLimitMap map[DAOCoinOperationLimitKey]uint64

	// NFTOperationLimitMap is a map with keys composed of
	// PostHash || Serial Num || NFTLimitOperation to number
	// of transactions
	NFTOperationLimitMap map[NFTOperationLimitKey]uint64

	// DAOCoinLimitOrderLimitMap is a map with keys composed of
	// BuyingCreatorPKID || SellingCreatorPKID to number of
	// transactions
	DAOCoinLimitOrderLimitMap map[DAOCoinLimitOrderLimitKey]uint64

	// AccessGroupMap is a map with keys composed of
	// AccessGroupOwnerPublicKey || AccessGroupKeyName || AccessGroupOperationType
	// to number of transactions.
	AccessGroupMap map[AccessGroupLimitKey]uint64

	// AccessGroupMemberMap is a map with keys composed of
	// AccessGroupOwnerPublicKey || AccessGroupKeyName || AccessGroupMemberOperationType
	// to number of transactions.
	AccessGroupMemberMap map[AccessGroupMemberLimitKey]uint64

	// ===== ENCODER MIGRATION UnlimitedDerivedKeysMigration =====
	// IsUnlimited field determines whether this derived key has no spending limit.
	IsUnlimited bool

	// ===== ENCODER MIGRATION AssociationsMigration =====
	// AssociationClass || AssociationType || AppPKID || AppScopeType || AssociationOperation
	// to number of transactions
	//   - AssociationClass: one of { User, Post }
	//   - AssociationType: a byte slice to scope by AssociationType or an empty byte slice to signify Any
	//   - AppPKID: a PKID to scope by App, if AppScopeType == Any then AppPKID has to be the ZeroPKID
	//   - AppScopeType: one of { Any, Scoped }
	//   - AssociationOperation: one of { Any, Create, Delete }
	AssociationLimitMap map[AssociationLimitKey]uint64
}

func (*TransactionSpendingLimit) Copy

func (*TransactionSpendingLimit) FromBytes

func (tsl *TransactionSpendingLimit) FromBytes(blockHeight uint64, rr *bytes.Reader) error

func (*TransactionSpendingLimit) ToBytes

func (tsl *TransactionSpendingLimit) ToBytes(blockHeight uint64) ([]byte, error)

func (*TransactionSpendingLimit) ToMetamaskString

func (tsl *TransactionSpendingLimit) ToMetamaskString(params *DeSoParams) string

ToMetamaskString encodes the TransactionSpendingLimit into a Metamask-compatible string. The encoded string will be a part of Access Bytes Encoding 2.0 for derived keys, which creates a human-readable string that MM can sign. The idea behind this function is to create an injective mapping from the TransactionSpendingLimit -> string. This mapping is not intended to be invertible, rather we would also call this function while verifying access bytes. Basically, to verify signature on a derived key, we will call this function as well, instead of attempting to revert the metamask string.

type TransferRestrictionStatus

type TransferRestrictionStatus uint8
const (
	TransferRestrictionStatusUnrestricted            TransferRestrictionStatus = 0
	TransferRestrictionStatusProfileOwnerOnly        TransferRestrictionStatus = 1
	TransferRestrictionStatusDAOMembersOnly          TransferRestrictionStatus = 2
	TransferRestrictionStatusPermanentlyUnrestricted TransferRestrictionStatus = 3
)

func (TransferRestrictionStatus) IsUnrestricted

func (transferRestrictionStatus TransferRestrictionStatus) IsUnrestricted() bool

func (TransferRestrictionStatus) String

func (transferRestrictionStatus TransferRestrictionStatus) String() string

type TxnString

type TxnString string
const (
	TxnStringUndefined                    TxnString = "TXN_UNDEFINED"
	TxnStringUnset                        TxnString = "UNSET"
	TxnStringBlockReward                  TxnString = "BLOCK_REWARD"
	TxnStringBasicTransfer                TxnString = "BASIC_TRANSFER"
	TxnStringBitcoinExchange              TxnString = "BITCOIN_EXCHANGE"
	TxnStringPrivateMessage               TxnString = "PRIVATE_MESSAGE"
	TxnStringSubmitPost                   TxnString = "SUBMIT_POST"
	TxnStringUpdateProfile                TxnString = "UPDATE_PROFILE"
	TxnStringUpdateBitcoinUSDExchangeRate TxnString = "UPDATE_BITCOIN_USD_EXCHANGE_RATE"
	TxnStringFollow                       TxnString = "FOLLOW"
	TxnStringLike                         TxnString = "LIKE"
	TxnStringCreatorCoin                  TxnString = "CREATOR_COIN"
	TxnStringSwapIdentity                 TxnString = "SWAP_IDENTITY"
	TxnStringUpdateGlobalParams           TxnString = "UPDATE_GLOBAL_PARAMS"
	TxnStringCreatorCoinTransfer          TxnString = "CREATOR_COIN_TRANSFER"
	TxnStringCreateNFT                    TxnString = "CREATE_NFT"
	TxnStringUpdateNFT                    TxnString = "UPDATE_NFT"
	TxnStringAcceptNFTBid                 TxnString = "ACCEPT_NFT_BID"
	TxnStringNFTBid                       TxnString = "NFT_BID"
	TxnStringNFTTransfer                  TxnString = "NFT_TRANSFER"
	TxnStringAcceptNFTTransfer            TxnString = "ACCEPT_NFT_TRANSFER"
	TxnStringBurnNFT                      TxnString = "BURN_NFT"
	TxnStringAuthorizeDerivedKey          TxnString = "AUTHORIZE_DERIVED_KEY"
	TxnStringMessagingGroup               TxnString = "MESSAGING_GROUP"
	TxnStringDAOCoin                      TxnString = "DAO_COIN"
	TxnStringDAOCoinTransfer              TxnString = "DAO_COIN_TRANSFER"
	TxnStringDAOCoinLimitOrder            TxnString = "DAO_COIN_LIMIT_ORDER"
	TxnStringCreateUserAssociation        TxnString = "CREATE_USER_ASSOCIATION"
	TxnStringDeleteUserAssociation        TxnString = "DELETE_USER_ASSOCIATION"
	TxnStringCreatePostAssociation        TxnString = "CREATE_POST_ASSOCIATION"
	TxnStringDeletePostAssociation        TxnString = "DELETE_POST_ASSOCIATION"
	TxnStringAccessGroup                  TxnString = "ACCESS_GROUP"
	TxnStringAccessGroupMembers           TxnString = "ACCESS_GROUP_MEMBERS"
	TxnStringNewMessage                   TxnString = "NEW_MESSAGE"
)

type TxnType

type TxnType uint8

TxnType specifies the type for a transaction message.

const (
	TxnTypeUnset                        TxnType = 0
	TxnTypeBlockReward                  TxnType = 1
	TxnTypeBasicTransfer                TxnType = 2
	TxnTypeBitcoinExchange              TxnType = 3
	TxnTypePrivateMessage               TxnType = 4
	TxnTypeSubmitPost                   TxnType = 5
	TxnTypeUpdateProfile                TxnType = 6
	TxnTypeUpdateBitcoinUSDExchangeRate TxnType = 8
	TxnTypeFollow                       TxnType = 9
	TxnTypeLike                         TxnType = 10
	TxnTypeCreatorCoin                  TxnType = 11
	TxnTypeSwapIdentity                 TxnType = 12
	TxnTypeUpdateGlobalParams           TxnType = 13
	TxnTypeCreatorCoinTransfer          TxnType = 14
	TxnTypeCreateNFT                    TxnType = 15
	TxnTypeUpdateNFT                    TxnType = 16
	TxnTypeAcceptNFTBid                 TxnType = 17
	TxnTypeNFTBid                       TxnType = 18
	TxnTypeNFTTransfer                  TxnType = 19
	TxnTypeAcceptNFTTransfer            TxnType = 20
	TxnTypeBurnNFT                      TxnType = 21
	TxnTypeAuthorizeDerivedKey          TxnType = 22
	TxnTypeMessagingGroup               TxnType = 23
	TxnTypeDAOCoin                      TxnType = 24
	TxnTypeDAOCoinTransfer              TxnType = 25
	TxnTypeDAOCoinLimitOrder            TxnType = 26
	TxnTypeCreateUserAssociation        TxnType = 27
	TxnTypeDeleteUserAssociation        TxnType = 28
	TxnTypeCreatePostAssociation        TxnType = 29
	TxnTypeDeletePostAssociation        TxnType = 30
	TxnTypeAccessGroup                  TxnType = 31
	TxnTypeAccessGroupMembers           TxnType = 32
	TxnTypeNewMessage                   TxnType = 33
)

func GetTxnTypeFromString

func GetTxnTypeFromString(txnString TxnString) TxnType

func (TxnType) GetTxnString

func (txnType TxnType) GetTxnString() TxnString

func (TxnType) String

func (txnType TxnType) String() string

type UnconnectedTx

type UnconnectedTx struct {
	// contains filtered or unexported fields
}

UnconnectedTx is a transaction that has dependencies that we haven't added yet.

type UpdateBitcoinUSDExchangeRateMetadataa

type UpdateBitcoinUSDExchangeRateMetadataa struct {
	// The new exchange rate to set.
	USDCentsPerBitcoin uint64
}

func (*UpdateBitcoinUSDExchangeRateMetadataa) FromBytes

func (txnData *UpdateBitcoinUSDExchangeRateMetadataa) FromBytes(dataa []byte) error

func (*UpdateBitcoinUSDExchangeRateMetadataa) GetTxnType

func (txnData *UpdateBitcoinUSDExchangeRateMetadataa) GetTxnType() TxnType

func (*UpdateBitcoinUSDExchangeRateMetadataa) New

func (*UpdateBitcoinUSDExchangeRateMetadataa) ToBytes

func (txnData *UpdateBitcoinUSDExchangeRateMetadataa) ToBytes(preSignature bool) ([]byte, error)

type UpdateGlobalParamsMetadata

type UpdateGlobalParamsMetadata struct {
}

================================================================== UpdateGlobalParamsMetadata ==================================================================

func (*UpdateGlobalParamsMetadata) FromBytes

func (txnData *UpdateGlobalParamsMetadata) FromBytes(data []byte) error

func (*UpdateGlobalParamsMetadata) GetTxnType

func (txnData *UpdateGlobalParamsMetadata) GetTxnType() TxnType

func (*UpdateGlobalParamsMetadata) New

func (*UpdateGlobalParamsMetadata) ToBytes

func (txnData *UpdateGlobalParamsMetadata) ToBytes(preSignature bool) ([]byte, error)

type UpdateNFTMetadata

type UpdateNFTMetadata struct {
	NFTPostHash       *BlockHash
	SerialNumber      uint64
	IsForSale         bool
	MinBidAmountNanos uint64
}

func (*UpdateNFTMetadata) FromBytes

func (txnData *UpdateNFTMetadata) FromBytes(dataa []byte) error

func (*UpdateNFTMetadata) GetTxnType

func (txnData *UpdateNFTMetadata) GetTxnType() TxnType

func (*UpdateNFTMetadata) New

func (txnData *UpdateNFTMetadata) New() DeSoTxnMetadata

func (*UpdateNFTMetadata) ToBytes

func (txnData *UpdateNFTMetadata) ToBytes(preSignature bool) ([]byte, error)

type UpdateNFTTxindexMetadata

type UpdateNFTTxindexMetadata struct {
	NFTPostHashHex string
	IsForSale      bool
}

func (*UpdateNFTTxindexMetadata) GetEncoderType

func (txnMeta *UpdateNFTTxindexMetadata) GetEncoderType() EncoderType

func (*UpdateNFTTxindexMetadata) GetVersionByte

func (txnMeta *UpdateNFTTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*UpdateNFTTxindexMetadata) RawDecodeWithoutMetadata

func (txnMeta *UpdateNFTTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*UpdateNFTTxindexMetadata) RawEncodeWithoutMetadata

func (txnMeta *UpdateNFTTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type UpdateProfileMetadata

type UpdateProfileMetadata struct {

	// The public key of the profile to update. When left unset, the public
	// key in the transaction is used.
	ProfilePublicKey []byte

	NewUsername    []byte
	NewDescription []byte
	NewProfilePic  []byte

	// This is the percentage of each "net buy" that a creator earns when
	// someone purchases her coin. For example, if this were set to 25%,
	// then every time their coin reaches a new high, they would get 25%
	// of the coins as they're being minted. More concretely, if someone
	// put in enough DeSo to buy 10 coins, the creator would get 2.5
	// and this person would get 7.5. However, if they sold 5 coins and
	// someone subsequently bought those same coins, the creator wouldn't
	// get any coins because no "net new" coins have been created.
	NewCreatorBasisPoints uint64

	// The multiple of the payout when a user stakes to this profile. If
	// unset, a sane default is set when the first person stakes to this
	// profile.
	// 2x multiple = 200% = 20,000bps
	//
	// TODO: This field is deprecated; delete it.
	NewStakeMultipleBasisPoints uint64

	// Profile is hidden from the UI when this field is true.
	// TODO: This field is deprecated; delete it.
	IsHidden bool
}

func (*UpdateProfileMetadata) FromBytes

func (txnData *UpdateProfileMetadata) FromBytes(data []byte) error

func (*UpdateProfileMetadata) GetTxnType

func (txnData *UpdateProfileMetadata) GetTxnType() TxnType

func (*UpdateProfileMetadata) New

func (txnData *UpdateProfileMetadata) New() DeSoTxnMetadata

func (*UpdateProfileMetadata) ToBytes

func (txnData *UpdateProfileMetadata) ToBytes(preSignature bool) ([]byte, error)

type UpdateProfileTxindexMetadata

type UpdateProfileTxindexMetadata struct {
	ProfilePublicKeyBase58Check string

	NewUsername    string
	NewDescription string
	NewProfilePic  string

	NewCreatorBasisPoints uint64

	NewStakeMultipleBasisPoints uint64

	IsHidden bool
}

func (*UpdateProfileTxindexMetadata) GetEncoderType

func (txnMeta *UpdateProfileTxindexMetadata) GetEncoderType() EncoderType

func (*UpdateProfileTxindexMetadata) GetVersionByte

func (txnMeta *UpdateProfileTxindexMetadata) GetVersionByte(blockHeight uint64) byte

func (*UpdateProfileTxindexMetadata) RawDecodeWithoutMetadata

func (txnMeta *UpdateProfileTxindexMetadata) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*UpdateProfileTxindexMetadata) RawEncodeWithoutMetadata

func (txnMeta *UpdateProfileTxindexMetadata) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type UserAssociationEntry added in v3.2.0

type UserAssociationEntry struct {
	AssociationID    *BlockHash
	TransactorPKID   *PKID
	TargetUserPKID   *PKID
	AppPKID          *PKID
	AssociationType  []byte
	AssociationValue []byte
	ExtraData        map[string][]byte
	BlockHeight      uint32
	// contains filtered or unexported fields
}

func DBGetUserAssociationByAttributes added in v3.2.0

func DBGetUserAssociationByAttributes(handle *badger.DB, snap *Snapshot, queryEntry *UserAssociationEntry) (*UserAssociationEntry, error)

func DBGetUserAssociationByAttributesWithTxn added in v3.2.0

func DBGetUserAssociationByAttributesWithTxn(txn *badger.Txn, snap *Snapshot, queryEntry *UserAssociationEntry) (*UserAssociationEntry, error)

func DBGetUserAssociationByID added in v3.2.0

func DBGetUserAssociationByID(handle *badger.DB, snap *Snapshot, associationID *BlockHash) (*UserAssociationEntry, error)

func DBGetUserAssociationByIDWithTxn added in v3.2.0

func DBGetUserAssociationByIDWithTxn(txn *badger.Txn, snap *Snapshot, associationID *BlockHash) (*UserAssociationEntry, error)

func DBGetUserAssociationsByAttributes added in v3.2.0

func DBGetUserAssociationsByAttributes(
	handle *badger.DB,
	snap *Snapshot,
	associationQuery *UserAssociationQuery,
	utxoViewAssociationIds *Set[BlockHash],
) ([]*UserAssociationEntry, []byte, error)

func (*UserAssociationEntry) Copy added in v3.2.0

func (associationEntry *UserAssociationEntry) Copy() *UserAssociationEntry

func (*UserAssociationEntry) Eq added in v3.2.0

func (associationEntry *UserAssociationEntry) Eq(other *UserAssociationEntry) bool

func (*UserAssociationEntry) GetEncoderType added in v3.2.0

func (associationEntry *UserAssociationEntry) GetEncoderType() EncoderType

func (*UserAssociationEntry) GetVersionByte added in v3.2.0

func (associationEntry *UserAssociationEntry) GetVersionByte(blockHeight uint64) byte

func (*UserAssociationEntry) RawDecodeWithoutMetadata added in v3.2.0

func (associationEntry *UserAssociationEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*UserAssociationEntry) RawEncodeWithoutMetadata added in v3.2.0

func (associationEntry *UserAssociationEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

func (*UserAssociationEntry) ToMapKey added in v3.2.0

func (associationEntry *UserAssociationEntry) ToMapKey() AssociationMapKey

type UserAssociationQuery added in v3.2.0

type UserAssociationQuery struct {
	TransactorPKID         *PKID
	TargetUserPKID         *PKID
	AppPKID                *PKID
	AssociationType        []byte
	AssociationTypePrefix  []byte
	AssociationValue       []byte
	AssociationValuePrefix []byte
	Limit                  int
	LastSeenAssociationID  *BlockHash
	SortDescending         bool
}

type UsernameMapKey

type UsernameMapKey [MaxUsernameLengthBytes]byte

Have to define these because Go doesn't let you use raw byte slices as map keys. This needs to be in-sync with DeSoMainnetParams.MaxUsernameLengthBytes

func MakeUsernameMapKey

func MakeUsernameMapKey(nonLowercaseUsername []byte) UsernameMapKey

type UtxoEntry

type UtxoEntry struct {
	AmountNanos uint64
	PublicKey   []byte
	BlockHeight uint32
	UtxoType    UtxoType

	// A back-reference to the utxo key associated with this entry.
	UtxoKey *UtxoKey
	// contains filtered or unexported fields
}

UtxoEntry identifies the data associated with a UTXO.

func DbGetUtxoEntryForUtxoKey

func DbGetUtxoEntryForUtxoKey(handle *badger.DB, snap *Snapshot, utxoKey *UtxoKey) *UtxoEntry

func DbGetUtxoEntryForUtxoKeyWithTxn

func DbGetUtxoEntryForUtxoKeyWithTxn(txn *badger.Txn, snap *Snapshot, utxoKey *UtxoKey) *UtxoEntry

func DbGetUtxosForPubKey

func DbGetUtxosForPubKey(publicKey []byte, handle *badger.DB, snap *Snapshot) ([]*UtxoEntry, error)

DbGetUtxosForPubKey finds the UtxoEntry's corresponding to the public key passed in. It also attaches the UtxoKeys to the UtxoEntry's it returns for easy access.

func (*UtxoEntry) GetEncoderType

func (utxo *UtxoEntry) GetEncoderType() EncoderType

func (*UtxoEntry) GetVersionByte

func (utxo *UtxoEntry) GetVersionByte(blockHeight uint64) byte

func (*UtxoEntry) RawDecodeWithoutMetadata

func (utxo *UtxoEntry) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*UtxoEntry) RawEncodeWithoutMetadata

func (utxo *UtxoEntry) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

func (*UtxoEntry) String

func (utxoEntry *UtxoEntry) String() string

type UtxoKey

type UtxoKey struct {
	// The 32-byte transaction id where the unspent output occurs.
	TxID BlockHash
	// The index within the txn where the unspent output occurs.
	Index uint32
}

UtxoKey is a 32-byte txid with a 4-byte uint32 index identifying the particular output in the transaction where this utxo occurs. When fetching from the db the txid and index are concatenated to form the key, with the index serialized as big-endian.

func (*UtxoKey) GetEncoderType

func (utxoKey *UtxoKey) GetEncoderType() EncoderType

func (*UtxoKey) GetVersionByte

func (utxoKey *UtxoKey) GetVersionByte(blockHeight uint64) byte

func (*UtxoKey) RawDecodeWithoutMetadata

func (utxoKey *UtxoKey) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*UtxoKey) RawEncodeWithoutMetadata

func (utxoKey *UtxoKey) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

func (*UtxoKey) String

func (utxoKey *UtxoKey) String() string

type UtxoOperation

type UtxoOperation struct {
	Type OperationType

	// Only set for OperationTypeSpendUtxo
	//
	// When we SPEND a UTXO entry we delete it from the utxo set but we still
	// store its info in case we want to reverse
	// it in the future. This information is not needed for ADD since
	// reversing an ADD just means deleting an entry from the end of our list.
	//
	// SPEND works by swapping the UTXO we want to spend with the UTXO at
	// the end of the list and then deleting from the end of the list. Obviously
	// this is more efficient than deleting the element in-place and then shifting
	// over everything after it. In order to be able to undo this operation,
	// however, we need to store the original index of the item we are
	// spending/deleting. Reversing the operation then amounts to adding a utxo entry
	// at the end of the list and swapping with this index. Given this, the entry
	// we store here has its position set to the position it was at right before the
	// SPEND operation was performed.
	Entry *UtxoEntry

	// Only set for OperationTypeSpendUtxo
	//
	// Store the UtxoKey as well. This isn't necessary but it helps
	// with error-checking during a roll-back so we just keep it.
	//
	// TODO: We can probably delete this at some point and save some space. UTXOs
	// are probably our biggest disk hog so getting rid of this should materially
	// improve disk usage.
	Key *UtxoKey

	// Used to revert BitcoinExchange transaction.
	PrevNanosPurchased uint64
	// Used to revert UpdateBitcoinUSDExchangeRate transaction.
	PrevUSDCentsPerBitcoin uint64

	// Save the previous post entry when making an update to a post.
	PrevPostEntry            *PostEntry
	PrevParentPostEntry      *PostEntry
	PrevGrandparentPostEntry *PostEntry
	PrevRepostedPostEntry    *PostEntry

	// Save the previous profile entry when making an update.
	PrevProfileEntry *ProfileEntry

	// Save the previous like entry and like count when making an update.
	PrevLikeEntry *LikeEntry
	PrevLikeCount uint64

	// For disconnecting diamonds.
	PrevDiamondEntry *DiamondEntry

	// For disconnecting NFTs.
	PrevNFTEntry              *NFTEntry
	PrevNFTBidEntry           *NFTBidEntry
	DeletedNFTBidEntries      []*NFTBidEntry
	NFTPaymentUtxoKeys        []*UtxoKey
	NFTSpentUtxoEntries       []*UtxoEntry
	PrevAcceptedNFTBidEntries *[]*NFTBidEntry

	// For disconnecting AuthorizeDerivedKey transactions.
	PrevDerivedKeyEntry *DerivedKeyEntry

	// For disconnecting MessagingGroupKey transactions.
	PrevMessagingKeyEntry *MessagingGroupEntry

	// Save the previous repost entry and repost count when making an update.
	PrevRepostEntry *RepostEntry
	PrevRepostCount uint64

	// Save the state of a creator coin prior to updating it due to a
	// buy/sell/add transaction.
	PrevCoinEntry *CoinEntry

	// Save the state of coin entries associated with a PKID prior to updating
	// it due to an additional coin royalty when an NFT is sold.
	PrevCoinRoyaltyCoinEntries map[PKID]CoinEntry

	// Save the creator coin balance of both the transactor and the creator.
	// We modify the transactor's balances when they buys/sell a creator coin
	// and we modify the creator's balance when we pay them a founder reward.
	PrevTransactorBalanceEntry *BalanceEntry
	PrevCreatorBalanceEntry    *BalanceEntry
	// We use this to revert founder's reward UTXOs created by creator coin buys.
	FounderRewardUtxoKey *UtxoKey

	// Save balance entries for the sender and receiver when creator coins are transferred.
	PrevSenderBalanceEntry   *BalanceEntry
	PrevReceiverBalanceEntry *BalanceEntry

	// Save the global params when making an update.
	PrevGlobalParamsEntry    *GlobalParamsEntry
	PrevForbiddenPubKeyEntry *ForbiddenPubKeyEntry

	// This value is used by Rosetta to adjust for a bug whereby a ParamUpdater
	// CoinEntry could get clobbered if updating a profile on someone else's
	// behalf. This is super confusing.
	ClobberedProfileBugDESOLockedNanos uint64

	// This value is used by Rosetta to return the amount of DESO that was added
	// or removed from a profile during a CreatorCoin transaction. It's needed
	// in order to avoid having to reconnect all transactions.
	CreatorCoinDESOLockedNanosDiff int64

	// This value is used by Rosetta to create a proper input/output when we
	// encounter a SwapIdentity txn. This makes it so that we don't have to
	// reconnect all txns in order to get these values.
	SwapIdentityFromDESOLockedNanos uint64
	SwapIdentityToDESOLockedNanos   uint64

	// These values are used by Rosetta in order to create input and output
	// operations. They make it so that we don't have to reconnect all txns
	// in order to get these values.
	AcceptNFTBidCreatorPublicKey        []byte
	AcceptNFTBidBidderPublicKey         []byte
	AcceptNFTBidCreatorRoyaltyNanos     uint64
	AcceptNFTBidCreatorDESORoyaltyNanos uint64
	AcceptNFTBidAdditionalCoinRoyalties []*PublicKeyRoyaltyPair
	AcceptNFTBidAdditionalDESORoyalties []*PublicKeyRoyaltyPair

	// These values are used by Rosetta in order to create input and output
	// operations. They make it so that we don't have to reconnect all txns
	// in order to get these values for NFT bid transactions on Buy Now NFTs.
	NFTBidCreatorPublicKey        []byte
	NFTBidBidderPublicKey         []byte
	NFTBidCreatorRoyaltyNanos     uint64
	NFTBidCreatorDESORoyaltyNanos uint64
	NFTBidAdditionalCoinRoyalties []*PublicKeyRoyaltyPair
	NFTBidAdditionalDESORoyalties []*PublicKeyRoyaltyPair

	// DAO coin limit order
	// PrevTransactorDAOCoinLimitOrderEntry is the previous version of the
	// transactor's DAO Coin Limit Order before this transaction was connected.
	// Note: This is only set if the transactor is cancelling an existing order.
	PrevTransactorDAOCoinLimitOrderEntry *DAOCoinLimitOrderEntry

	// PrevBalanceEntries is a map of User PKID, Creator PKID to DAO Coin Balance
	// Entry. When disconnecting a DAO Coin Limit Order, we will revert to these
	// BalanceEntries.
	PrevBalanceEntries map[PKID]map[PKID]*BalanceEntry

	// PrevMatchingOrder is a slice of DAOCoinLimitOrderEntries that were deleted
	// in the DAO Coin Limit Order Transaction. In order to revert the state in
	// the event of a disconnect, we restore all the deleted Order Entries
	PrevMatchingOrders []*DAOCoinLimitOrderEntry

	// FilledDAOCoinLimitOrder is a slice of FilledDAOCoinLimitOrder structs
	// that represent all orders fulfilled by the DAO Coin Limit Order transaction.
	// These are used to construct notifications for order fulfillment.
	FilledDAOCoinLimitOrders []*FilledDAOCoinLimitOrder

	// Save the state of any deleted associations, in case we need
	// to disconnect/revert and re-instate the prev association.
	PrevUserAssociationEntry *UserAssociationEntry
	PrevPostAssociationEntry *PostAssociationEntry

	// PrevAccessGroupEntry is the previous access group entry. It is used in
	// access group transactions to revert the access group after an update operation.
	PrevAccessGroupEntry *AccessGroupEntry

	// PrevAccessGroupMembersList is a list of previous access group member entries.
	// It is used in operations that modify existing access group members, such as
	// AccessGroupMemberOperationTypeRemove or AccessGroupMemberOperationTypeUpdate.
	PrevAccessGroupMembersList []*AccessGroupMemberEntry

	// PrevNewMessageEntry is the previous message entry, used for disconnecting NewMessage transactions.
	PrevNewMessageEntry *NewMessageEntry
	// PrevDmThreadEntry is used for disconnecting DM message threads.
	PrevDmThreadEntry *DmThreadEntry
}

func (*UtxoOperation) GetEncoderType

func (op *UtxoOperation) GetEncoderType() EncoderType

func (*UtxoOperation) GetVersionByte

func (op *UtxoOperation) GetVersionByte(blockHeight uint64) byte

func (*UtxoOperation) RawDecodeWithoutMetadata

func (op *UtxoOperation) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*UtxoOperation) RawEncodeWithoutMetadata

func (op *UtxoOperation) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type UtxoOperationBundle

type UtxoOperationBundle struct {
	UtxoOpBundle [][]*UtxoOperation
}

func (*UtxoOperationBundle) GetEncoderType

func (opBundle *UtxoOperationBundle) GetEncoderType() EncoderType

func (*UtxoOperationBundle) GetVersionByte

func (opBundle *UtxoOperationBundle) GetVersionByte(blockHeight uint64) byte

func (*UtxoOperationBundle) RawDecodeWithoutMetadata

func (opBundle *UtxoOperationBundle) RawDecodeWithoutMetadata(blockHeight uint64, rr *bytes.Reader) error

func (*UtxoOperationBundle) RawEncodeWithoutMetadata

func (opBundle *UtxoOperationBundle) RawEncodeWithoutMetadata(blockHeight uint64, skipMetadata ...bool) []byte

type UtxoType

type UtxoType uint8
const (
	// UTXOs can come from different sources. We document all of those sources
	// in the UTXOEntry using these types.
	UtxoTypeOutput      UtxoType = 0
	UtxoTypeBlockReward UtxoType = 1
	UtxoTypeBitcoinBurn UtxoType = 2
	// TODO(DELETEME): Remove the StakeReward txn type
	UtxoTypeStakeReward              UtxoType = 3
	UtxoTypeCreatorCoinSale          UtxoType = 4
	UtxoTypeCreatorCoinFounderReward UtxoType = 5
	UtxoTypeNFTSeller                UtxoType = 6
	UtxoTypeNFTBidderChange          UtxoType = 7
	UtxoTypeNFTCreatorRoyalty        UtxoType = 8
	UtxoTypeNFTAdditionalDESORoyalty UtxoType = 9
	UtxoTypeDAOCoinLimitOrderPayout  UtxoType = 10
)

func (UtxoType) String

func (mm UtxoType) String() string

type UtxoView

type UtxoView struct {
	// Utxo data
	NumUtxoEntries              uint64
	UtxoKeyToUtxoEntry          map[UtxoKey]*UtxoEntry
	PublicKeyToDeSoBalanceNanos map[PublicKey]uint64

	// BitcoinExchange data
	NanosPurchased     uint64
	USDCentsPerBitcoin uint64
	GlobalParamsEntry  *GlobalParamsEntry
	BitcoinBurnTxIDs   map[BlockHash]bool

	// Forbidden block signature pubkeys
	ForbiddenPubKeyToForbiddenPubKeyEntry map[PkMapKey]*ForbiddenPubKeyEntry

	// Messages data
	MessageKeyToMessageEntry map[MessageKey]*MessageEntry

	// Messaging group entries.
	MessagingGroupKeyToMessagingGroupEntry map[MessagingGroupKey]*MessagingGroupEntry

	// Access group entries.
	AccessGroupIdToAccessGroupEntry map[AccessGroupId]*AccessGroupEntry

	// Group Memberships
	AccessGroupMembershipKeyToAccessGroupMember map[AccessGroupMembershipKey]*AccessGroupMemberEntry

	// Postgres stores message data slightly differently
	MessageMap map[BlockHash]*PGMessage

	// Group Chat and Dm messages.
	GroupChatMessagesIndex map[GroupChatMessageKey]*NewMessageEntry
	DmMessagesIndex        map[DmMessageKey]*NewMessageEntry

	// Dm threads.
	DmThreadIndex map[DmThreadKey]*DmThreadEntry

	// Follow data
	FollowKeyToFollowEntry map[FollowKey]*FollowEntry

	// NFT data
	NFTKeyToNFTEntry              map[NFTKey]*NFTEntry
	NFTBidKeyToNFTBidEntry        map[NFTBidKey]*NFTBidEntry
	NFTKeyToAcceptedNFTBidHistory map[NFTKey]*[]*NFTBidEntry

	// Diamond data
	DiamondKeyToDiamondEntry map[DiamondKey]*DiamondEntry

	// Like data
	LikeKeyToLikeEntry map[LikeKey]*LikeEntry

	// Repost data
	RepostKeyToRepostEntry map[RepostKey]*RepostEntry

	// Post data
	PostHashToPostEntry map[BlockHash]*PostEntry

	// Profile data
	PublicKeyToPKIDEntry map[PkMapKey]*PKIDEntry
	// The PKIDEntry is only used here to store the public key.
	PKIDToPublicKey               map[PKID]*PKIDEntry
	ProfilePKIDToProfileEntry     map[PKID]*ProfileEntry
	ProfileUsernameToProfileEntry map[UsernameMapKey]*ProfileEntry

	// Creator coin balance entries
	HODLerPKIDCreatorPKIDToBalanceEntry map[BalanceEntryMapKey]*BalanceEntry

	// DAO coin balance entries
	HODLerPKIDCreatorPKIDToDAOCoinBalanceEntry map[BalanceEntryMapKey]*BalanceEntry

	// Derived Key entries. Map key is a combination of owner and derived public keys.
	DerivedKeyToDerivedEntry map[DerivedKeyMapKey]*DerivedKeyEntry

	// DAO coin limit order entry mapping.
	DAOCoinLimitOrderMapKeyToDAOCoinLimitOrderEntry map[DAOCoinLimitOrderMapKey]*DAOCoinLimitOrderEntry

	// Association mappings
	AssociationMapKeyToUserAssociationEntry map[AssociationMapKey]*UserAssociationEntry
	AssociationMapKeyToPostAssociationEntry map[AssociationMapKey]*PostAssociationEntry

	// The hash of the tip the view is currently referencing. Mainly used
	// for error-checking when doing a bulk operation on the view.
	TipHash *BlockHash

	Handle   *badger.DB
	Postgres *Postgres
	Params   *DeSoParams
	Snapshot *Snapshot
}

func NewUtxoView

func NewUtxoView(
	_handle *badger.DB,
	_params *DeSoParams,
	_postgres *Postgres,
	_snapshot *Snapshot,
) (*UtxoView, error)

func (*UtxoView) CheckIfValidUnlimitedSpendingLimit

func (bav *UtxoView) CheckIfValidUnlimitedSpendingLimit(tsl *TransactionSpendingLimit, blockHeight uint32) (_isUnlimited bool, _err error)

func (*UtxoView) ConnectBlock

func (bav *UtxoView) ConnectBlock(
	desoBlock *MsgDeSoBlock, txHashes []*BlockHash, verifySignatures bool, eventManager *EventManager, blockHeight uint64) (
	[][]*UtxoOperation, error)

func (*UtxoView) ConnectTransaction

func (bav *UtxoView) ConnectTransaction(txn *MsgDeSoTxn, txHash *BlockHash,
	txnSizeBytes int64,
	blockHeight uint32, verifySignatures bool, ignoreUtxos bool) (
	_utxoOps []*UtxoOperation, _totalInput uint64, _totalOutput uint64,
	_fees uint64, _err error)

func (*UtxoView) CopyUtxoView

func (bav *UtxoView) CopyUtxoView() (*UtxoView, error)

func (*UtxoView) CountPostAssociationsByAttributes added in v3.2.0

func (bav *UtxoView) CountPostAssociationsByAttributes(associationQuery *PostAssociationQuery) (uint64, error)

func (*UtxoView) CountUserAssociationsByAttributes added in v3.2.0

func (bav *UtxoView) CountUserAssociationsByAttributes(associationQuery *UserAssociationQuery) (uint64, error)

func (*UtxoView) DisconnectBlock

func (bav *UtxoView) DisconnectBlock(
	desoBlock *MsgDeSoBlock, txHashes []*BlockHash, utxoOps [][]*UtxoOperation, blockHeight uint64) error

func (*UtxoView) DisconnectTransaction

func (bav *UtxoView) DisconnectTransaction(currentTxn *MsgDeSoTxn, txnHash *BlockHash,
	utxoOpsForTxn []*UtxoOperation, blockHeight uint32) error

func (*UtxoView) FlushToDb

func (bav *UtxoView) FlushToDb(blockHeight uint64) error

func (*UtxoView) FlushToDbWithTxn

func (bav *UtxoView) FlushToDbWithTxn(txn *badger.Txn, blockHeight uint64) error

func (*UtxoView) GetAcceptNFTBidHistoryForNFTKey

func (bav *UtxoView) GetAcceptNFTBidHistoryForNFTKey(nftKey *NFTKey) *[]*NFTBidEntry

func (*UtxoView) GetAccessGroupEntry added in v3.2.0

func (bav *UtxoView) GetAccessGroupEntry(
	groupOwnerPublicKey *PublicKey, groupKeyName *GroupKeyName) (*AccessGroupEntry, error)

GetAccessGroupEntry will fetch an access group entry corresponding to the provided access group id: <groupOwnerPublicKey, groupKeyName>.

func (*UtxoView) GetAccessGroupEntryWithAccessGroupId added in v3.2.0

func (bav *UtxoView) GetAccessGroupEntryWithAccessGroupId(accessGroupId *AccessGroupId) (*AccessGroupEntry, error)

GetAccessGroupEntryWithAccessGroupId will fetch an access group entry corresponding to the provided access group id.

func (*UtxoView) GetAccessGroupExistenceWithAccessGroupId added in v3.2.0

func (bav *UtxoView) GetAccessGroupExistenceWithAccessGroupId(accessGroupId *AccessGroupId) (bool, error)

GetAccessGroupExistenceWithAccessGroupId will return true or false depending on whether the access group entry corresponding to the provided access group id exists.

func (*UtxoView) GetAccessGroupIdsForMember added in v3.2.0

func (bav *UtxoView) GetAccessGroupIdsForMember(memberPublicKey []byte) (_accessGroupIds []*AccessGroupId, _err error)

GetAccessGroupIdsForMember will return all access group ids in which the provided memberPublicKey was added as member. Returned accessGroupIds are sorted lexicographically for convenience.

func (*UtxoView) GetAccessGroupIdsForOwner added in v3.2.0

func (bav *UtxoView) GetAccessGroupIdsForOwner(ownerPublicKey []byte) (_accessGroupIdsOwned []*AccessGroupId, _err error)

GetAccessGroupIdsForOwner will return all access group ids that were registered for the provided owner public key. Note that this function will return the base group key for every user. Returned accessGroupIds are sorted lexicographically for convenience.

func (*UtxoView) GetAccessGroupMemberEntry added in v3.2.0

func (bav *UtxoView) GetAccessGroupMemberEntry(memberPublicKey *PublicKey, groupOwnerPublicKey *PublicKey,
	groupKeyName *GroupKeyName) (*AccessGroupMemberEntry, error)

GetAccessGroupMemberEntry will check the membership index for membership of memberPublicKey in the group <groupOwnerPublicKey, groupKeyName>.

func (*UtxoView) GetAllAccessGroupIdsForUser added in v3.2.0

func (bav *UtxoView) GetAllAccessGroupIdsForUser(ownerPublicKey []byte) (
	_accessGroupIdsOwned []*AccessGroupId, _accessGroupIdsMember []*AccessGroupId, _err error)

GetAllAccessGroupIdsForUser will return all access group ids for the provided owner public key. Note that this function will return the base group key for every user, and there are possible overlaps between the _accessGroupIdsOwned and _accessGroupIdsMember lists, if user adds themselves as member of an access group they own. Returned AccessGroupIds are in random order.

func (*UtxoView) GetAllDAOCoinLimitOrdersForThisDAOCoinPair

func (bav *UtxoView) GetAllDAOCoinLimitOrdersForThisDAOCoinPair(
	buyingDAOCoinCreatorPKID *PKID, sellingDAOCoinCreatorPKID *PKID) ([]*DAOCoinLimitOrderEntry, error)

func (*UtxoView) GetAllDAOCoinLimitOrdersForThisTransactor

func (bav *UtxoView) GetAllDAOCoinLimitOrdersForThisTransactor(transactorPKID *PKID) ([]*DAOCoinLimitOrderEntry, error)

func (*UtxoView) GetAllDerivedKeyMappingsForOwner

func (bav *UtxoView) GetAllDerivedKeyMappingsForOwner(ownerPublicKey []byte) (
	map[PublicKey]*DerivedKeyEntry, error)

GetAllDerivedKeyMappingsForOwner fetches all derived key mappings belonging to an owner.

func (*UtxoView) GetAllNFTBidEntries

func (bav *UtxoView) GetAllNFTBidEntries(nftPostHash *BlockHash, serialNumber uint64) []*NFTBidEntry

func (*UtxoView) GetAllPosts

func (bav *UtxoView) GetAllPosts() (_corePosts []*PostEntry, _commentsByPostHash map[BlockHash][]*PostEntry, _err error)

Just fetch all the posts from the db and join them with all the posts in the mempool. Then sort them by their timestamp. This can be called on an empty view or a view that already has a lot of transactions applied to it.

func (*UtxoView) GetAllProfiles

func (bav *UtxoView) GetAllProfiles(readerPK []byte) (
	_profiles map[PkMapKey]*ProfileEntry,
	_corePostsByProfilePublicKey map[PkMapKey][]*PostEntry,
	_commentsByProfilePublicKey map[PkMapKey][]*PostEntry,
	_postEntryReaderStates map[BlockHash]*PostEntryReaderState, _err error)

Just fetch all the profiles from the db and join them with all the profiles in the mempool. Then sort them by their DeSo. This can be called on an empty view or a view that already has a lot of transactions applied to it.

func (*UtxoView) GetAllUserDmThreads added in v3.2.0

func (bav *UtxoView) GetAllUserDmThreads(userAccessGroupOwnerPublicKey PublicKey) (_dmThreads []*DmThreadKey, _err error)

GetAllUserDmThreads returns all the DM threads that the user is a part of. This is done by looking up all of the DM threads that the user has in the db in DmThreadIndex.

func (*UtxoView) GetAllUserGroupChatThreads added in v3.2.0

func (bav *UtxoView) GetAllUserGroupChatThreads(userAccessGroupOwnerPublicKey PublicKey) (
	_groupChatThreads []*AccessGroupId, _err error)

GetAllUserGroupChatThreads returns all the group chat threads that the user is a participant of, this includes potentially both access group registered by the user, and access groups that the user is a member of.

func (*UtxoView) GetBalanceEntry

func (bav *UtxoView) GetBalanceEntry(holderPkid *PKID, creatorPkid *PKID, isDAOCoin bool) *BalanceEntry

func (*UtxoView) GetBalanceEntryForHODLerPubKeyAndCreatorPubKey

func (bav *UtxoView) GetBalanceEntryForHODLerPubKeyAndCreatorPubKey(
	hodlerPubKey []byte, creatorPubKey []byte, isDAOCoin bool) (
	_balanceEntry *BalanceEntry, _hodlerPKID *PKID, _creatorPKID *PKID)

func (*UtxoView) GetBalanceEntryHolders

func (bav *UtxoView) GetBalanceEntryHolders(pkid *PKID, isDAOCoin bool) []*BalanceEntry

func (*UtxoView) GetBalanceEntryHoldings

func (bav *UtxoView) GetBalanceEntryHoldings(pkid *PKID, isDAOCoin bool) []*BalanceEntry

func (*UtxoView) GetCommentEntriesForParentStakeID

func (bav *UtxoView) GetCommentEntriesForParentStakeID(parentStakeID []byte) ([]*PostEntry, error)

func (*UtxoView) GetCreatorCoinBalanceEntryForHODLerPubKeyAndCreatorPubKey

func (bav *UtxoView) GetCreatorCoinBalanceEntryForHODLerPubKeyAndCreatorPubKey(
	hodlerPubKey []byte, creatorPubKey []byte) (
	_balanceEntry *BalanceEntry, _hodlerPKID *PKID, _creatorPKID *PKID)

func (*UtxoView) GetCurrentUSDCentsPerBitcoin

func (bav *UtxoView) GetCurrentUSDCentsPerBitcoin() uint64

The blockchain used to store the USD to BTC exchange rate in bav.USDCentsPerBitcoin, which was set by a UPDATE_BITCOIN_USD_EXCHANGE_RATE txn, but has since moved to the GlobalParamsEntry, which is set by a UPDATE_GLOBAL_PARAMS txn.

func (*UtxoView) GetDAOCoinBalanceEntryForHODLerPubKeyAndCreatorPubKey

func (bav *UtxoView) GetDAOCoinBalanceEntryForHODLerPubKeyAndCreatorPubKey(
	hodlerPubKey []byte, creatorPubKey []byte) (
	_balanceEntry *BalanceEntry, _hodlerPKID *PKID, _creatorPKID *PKID)

func (*UtxoView) GetDAOCoinHolders

func (bav *UtxoView) GetDAOCoinHolders(pkid *PKID, fetchProfiles bool) (
	[]*BalanceEntry, []*ProfileEntry, error)

func (*UtxoView) GetDAOCoinHoldings

func (bav *UtxoView) GetDAOCoinHoldings(pkid *PKID, fetchProfiles bool) (
	[]*BalanceEntry, []*ProfileEntry, error)

func (*UtxoView) GetDBHighAndLowBidEntriesForNFT

func (bav *UtxoView) GetDBHighAndLowBidEntriesForNFT(
	nftHash *BlockHash, serialNumber uint64,
) (_highBidEntry *NFTBidEntry, _lowBidEntry *NFTBidEntry)

This function gets the highest and lowest bids for a specific NFT that have not been deleted in the view. TODO: Postgres

func (*UtxoView) GetDBHighAndLowBidsForNFT

func (bav *UtxoView) GetDBHighAndLowBidsForNFT(nftHash *BlockHash, serialNumber uint64) (_highBid uint64, _lowBid uint64)

TODO: Postgres

func (*UtxoView) GetDbAdapter

func (bav *UtxoView) GetDbAdapter() *DbAdapter

func (*UtxoView) GetDeSoBalanceNanosForPublicKey

func (bav *UtxoView) GetDeSoBalanceNanosForPublicKey(publicKeyArg []byte) (uint64, error)

func (*UtxoView) GetDerivedKeyMappingForOwner

func (bav *UtxoView) GetDerivedKeyMappingForOwner(ownerPublicKey []byte, derivedPublicKey []byte) *DerivedKeyEntry

GetDerivedKeyMappingForOwner fetches the derived key mapping from the utxoView

func (*UtxoView) GetDiamondEntriesForSenderToReceiver

func (bav *UtxoView) GetDiamondEntriesForSenderToReceiver(receiverPublicKey []byte, senderPublicKey []byte,
) (_diamondEntries []*DiamondEntry, _err error)

func (*UtxoView) GetDiamondEntryForDiamondKey

func (bav *UtxoView) GetDiamondEntryForDiamondKey(diamondKey *DiamondKey) *DiamondEntry

func (*UtxoView) GetDiamondEntryMapForPublicKey

func (bav *UtxoView) GetDiamondEntryMapForPublicKey(publicKey []byte, fetchYouDiamonded bool,
) (_pkidToDiamondsMap map[PKID][]*DiamondEntry, _err error)

func (*UtxoView) GetDiamondSendersForPostHash

func (bav *UtxoView) GetDiamondSendersForPostHash(postHash *BlockHash) (_pkidToDiamondLevel map[PKID]int64, _err error)

func (*UtxoView) GetFollowEntriesForPublicKey

func (bav *UtxoView) GetFollowEntriesForPublicKey(publicKey []byte, getEntriesFollowingPublicKey bool) (
	_followEntries []*FollowEntry, _err error)

getEntriesFollowingPublicKey == true => Returns FollowEntries for people that follow publicKey getEntriesFollowingPublicKey == false => Returns FollowEntries for people that publicKey follows

func (*UtxoView) GetFollowEntryForFollowerPublicKeyCreatorPublicKey

func (bav *UtxoView) GetFollowEntryForFollowerPublicKeyCreatorPublicKey(followerPublicKey []byte, creatorPublicKey []byte) *FollowEntry

func (*UtxoView) GetHODLerPKIDCreatorPKIDToBalanceEntryMap

func (bav *UtxoView) GetHODLerPKIDCreatorPKIDToBalanceEntryMap(isDAOCoin bool) map[BalanceEntryMapKey]*BalanceEntry

func (*UtxoView) GetHighAndLowBidsForNFTCollection

func (bav *UtxoView) GetHighAndLowBidsForNFTCollection(
	nftHash *BlockHash,
) (_highBid uint64, _lowBid uint64)

TODO: Postgres

func (*UtxoView) GetHighAndLowBidsForNFTSerialNumber

func (bav *UtxoView) GetHighAndLowBidsForNFTSerialNumber(nftHash *BlockHash, serialNumber uint64) (_highBid uint64, _lowBid uint64)

TODO: Postgres

func (*UtxoView) GetHolders

func (bav *UtxoView) GetHolders(pkid *PKID, fetchProfiles bool, isDAOCoin bool) (
	[]*BalanceEntry, []*ProfileEntry, error)

func (*UtxoView) GetHoldings

func (bav *UtxoView) GetHoldings(pkid *PKID, fetchProfiles bool, isDAOCoin bool) (
	[]*BalanceEntry, []*ProfileEntry, error)

func (*UtxoView) GetLikedByReader

func (bav *UtxoView) GetLikedByReader(readerPK []byte, postHash *BlockHash) bool

func (*UtxoView) GetLikesForPostHash

func (bav *UtxoView) GetLikesForPostHash(postHash *BlockHash) (_likerPubKeys [][]byte, _err error)

func (*UtxoView) GetLimitedMessagesForUser

func (bav *UtxoView) GetLimitedMessagesForUser(ownerPublicKey []byte, limit uint64) (
	_messageEntries []*MessageEntry, _messagingGroupEntries []*MessagingGroupEntry, _err error)

TODO: Update for Postgres

func (*UtxoView) GetMessagesForUser

func (bav *UtxoView) GetMessagesForUser(publicKey []byte) (
	_messageEntries []*MessageEntry, _messagingKeyEntries []*MessagingGroupEntry, _err error)

TODO: Update for Postgres

func (*UtxoView) GetMessagingGroupEntriesForUser

func (bav *UtxoView) GetMessagingGroupEntriesForUser(ownerPublicKey []byte) (
	_messagingGroupEntries []*MessagingGroupEntry, _err error)

func (*UtxoView) GetMessagingGroupKeyToMessagingGroupEntryMapping

func (bav *UtxoView) GetMessagingGroupKeyToMessagingGroupEntryMapping(
	messagingGroupKey *MessagingGroupKey) *MessagingGroupEntry

func (*UtxoView) GetNFTBidEntriesForPKID

func (bav *UtxoView) GetNFTBidEntriesForPKID(bidderPKID *PKID) (_nftBidEntries []*NFTBidEntry)

func (*UtxoView) GetNFTBidEntryForNFTBidKey

func (bav *UtxoView) GetNFTBidEntryForNFTBidKey(nftBidKey *NFTBidKey) *NFTBidEntry

func (*UtxoView) GetNFTEntriesForPKID

func (bav *UtxoView) GetNFTEntriesForPKID(ownerPKID *PKID) []*NFTEntry

func (*UtxoView) GetNFTEntriesForPostHash

func (bav *UtxoView) GetNFTEntriesForPostHash(nftPostHash *BlockHash) []*NFTEntry

func (*UtxoView) GetNFTEntryForNFTKey

func (bav *UtxoView) GetNFTEntryForNFTKey(nftKey *NFTKey) *NFTEntry

func (*UtxoView) GetNextLimitOrdersToFill

func (bav *UtxoView) GetNextLimitOrdersToFill(
	transactorOrder *DAOCoinLimitOrderEntry, lastSeenOrder *DAOCoinLimitOrderEntry, blockHeight uint32) (
	[]*DAOCoinLimitOrderEntry, error)

GetNextLimitOrdersToFill retrieves the next set of candidate DAOCoinLimitOrderEntries to fulfill the quantity specified by the transactorOrder. If lastSeenOrder is specified we will exclude lastSeenOrder and all BETTER orders from the result set.

func (*UtxoView) GetPKIDForPublicKey

func (bav *UtxoView) GetPKIDForPublicKey(publicKeyArg []byte) *PKIDEntry

func (*UtxoView) GetPaginatedAccessGroupMembersEnumerationEntries added in v3.2.0

func (bav *UtxoView) GetPaginatedAccessGroupMembersEnumerationEntries(groupOwnerPublicKey *PublicKey, groupKeyName *GroupKeyName,
	startingAccessGroupMemberPublicKey []byte, maxMembersToFetch uint32) (
	_accessGroupMembers []*PublicKey, _err error)

GetPaginatedAccessGroupMembersEnumerationEntries returns a list of public keys of members of a provided access group. The member public keys will be sorted lexicographically and paginated according to the provided startingAccessGroupMemberPublicKey and maxMembersToFetch. In other words, the returned _accessGroupMembers will follow these constraints:

  1. len(_accessGroupMembers) <= maxMembersToFetch
  2. _accessGroupMembers[0] > startingAccessGroupMemberPublicKey
  3. \forall i, j: i < j => _accessGroupMembers[i] < _accessGroupMembers[j]

func (*UtxoView) GetPaginatedMessageEntriesForDmThread added in v3.2.0

func (bav *UtxoView) GetPaginatedMessageEntriesForDmThread(dmThread DmThreadKey, startingTimestamp uint64,
	maxMessagesToFetch uint64) (_messageEntries []*NewMessageEntry, _err error)

GetPaginatedMessageEntriesForDmThread returns a list of paginated message entries for a given dm thread. The following constraints are applied: (1.) The startingTimestamp is the largest timestamp that we want to include in the results (2.) Fetch at most maxMessagesToFetch messages. (3.) _messageEntries are sorted by timestamp in descending order. That is, the most recent message is at index [0].

In other words, the returned _messageEntries will follow these constraints: 1. _messageEntries[0].TimestampNanos <= startingMaxTimestamp 2. len(_messageEntries) <= maxMessagesToFetch 3. _messageEntries[i].TimestampNanos > _messageEntries[i+1].TimestampNanos

func (*UtxoView) GetPaginatedMessageEntriesForGroupChatThread added in v3.2.0

func (bav *UtxoView) GetPaginatedMessageEntriesForGroupChatThread(groupChatThread AccessGroupId, startingMaxTimestamp uint64,
	maxMessagesToFetch uint64) (_messageEntries []*NewMessageEntry, _err error)

GetPaginatedMessageEntriesForGroupChatThread returns a list of paginated message entries for a given group chat thread. The following constraints are applied: (1.) The startingTimestamp is the largest timestamp that we want to include in the results (2.) Fetch at most maxMessagesToFetch messages. (3.) _messageEntries are sorted by timestamp in descending order. That is, the most recent message is at index [0].

In other words, the returned _messageEntries will follow these constraints: 1. _messageEntries[0].TimestampNanos <= startingMaxTimestamp 2. len(_messageEntries) <= maxMessagesToFetch 3. _messageEntries[i].TimestampNanos > _messageEntries[i+1].TimestampNanos

func (*UtxoView) GetParentPostEntriesForPostEntry

func (bav *UtxoView) GetParentPostEntriesForPostEntry(postEntry *PostEntry, maxDepth uint32, rootFirst bool,
) (_parentPostEntries []*PostEntry, _truncatedTree bool)

Accepts a postEntry and returns as many parent posts as it can find up to maxDepth. This function never returns an error, only an empty list if it hits a non-post parentStakeID. If "rootFirst" is passed, the root of the tree will be returned first, not the 1st parent. _truncatedTree is a flag that is true when the root post was not reached before the maxDepth was hit.

func (*UtxoView) GetPostAssociationByAttributes added in v3.2.0

func (bav *UtxoView) GetPostAssociationByAttributes(transactorPK []byte, metadata *CreatePostAssociationMetadata) (*PostAssociationEntry, error)

func (*UtxoView) GetPostAssociationByID added in v3.2.0

func (bav *UtxoView) GetPostAssociationByID(associationID *BlockHash) (*PostAssociationEntry, error)

func (*UtxoView) GetPostAssociationsByAttributes added in v3.2.0

func (bav *UtxoView) GetPostAssociationsByAttributes(associationQuery *PostAssociationQuery) ([]*PostAssociationEntry, error)

func (*UtxoView) GetPostEntryForPostHash

func (bav *UtxoView) GetPostEntryForPostHash(postHash *BlockHash) *PostEntry

func (*UtxoView) GetPostEntryReaderState

func (bav *UtxoView) GetPostEntryReaderState(
	readerPK []byte, postEntry *PostEntry) *PostEntryReaderState

func (*UtxoView) GetPostsPaginatedForPublicKeyOrderedByTimestamp

func (bav *UtxoView) GetPostsPaginatedForPublicKeyOrderedByTimestamp(publicKey []byte, startPostHash *BlockHash, limit uint64, mediaRequired bool, onlyNFTs bool, onlyPosts bool) (_posts []*PostEntry, _err error)

func (*UtxoView) GetProfileEntryForPKID

func (bav *UtxoView) GetProfileEntryForPKID(pkid *PKID) *ProfileEntry

func (*UtxoView) GetProfileEntryForPublicKey

func (bav *UtxoView) GetProfileEntryForPublicKey(publicKey []byte) *ProfileEntry

func (*UtxoView) GetProfileEntryForUsername

func (bav *UtxoView) GetProfileEntryForUsername(nonLowercaseUsername []byte) *ProfileEntry

func (*UtxoView) GetProfilesByCoinValue

func (bav *UtxoView) GetProfilesByCoinValue(startLockedNanos uint64, limit int) []*ProfileEntry

func (*UtxoView) GetProfilesForUsernamePrefixByCoinValue

func (bav *UtxoView) GetProfilesForUsernamePrefixByCoinValue(usernamePrefix string) []*ProfileEntry

func (*UtxoView) GetPublicKeyForPKID

func (bav *UtxoView) GetPublicKeyForPKID(pkidArg *PKID) []byte

func (*UtxoView) GetQuoteRepostsForPostHash

func (bav *UtxoView) GetQuoteRepostsForPostHash(postHash *BlockHash,
) (_quoteReposterPubKeys [][]byte, _quoteReposterPubKeyToPosts map[PkMapKey][]*PostEntry, _err error)

func (*UtxoView) GetRepostPostEntryStateForReader

func (bav *UtxoView) GetRepostPostEntryStateForReader(readerPK []byte, postHash *BlockHash) (string, bool)

func (*UtxoView) GetRepostsForPostHash

func (bav *UtxoView) GetRepostsForPostHash(postHash *BlockHash) (_reposterPubKeys [][]byte, _err error)

func (*UtxoView) GetSpendableDeSoBalanceNanosForPublicKey

func (bav *UtxoView) GetSpendableDeSoBalanceNanosForPublicKey(pkBytes []byte,
	tipHeight uint32) (_spendableBalance uint64, _err error)

func (*UtxoView) GetUnspentUtxoEntrysForPublicKey

func (bav *UtxoView) GetUnspentUtxoEntrysForPublicKey(pkBytes []byte) ([]*UtxoEntry, error)

GetUnspentUtxoEntrysForPublicKey returns the UtxoEntrys corresponding to the passed-in public key that are currently unspent. It does this while factoring in any transactions that have already been connected to it. This is useful, as an example, when one whats to see what UtxoEntrys are available for spending after factoring in (i.e. connecting) all of the transactions currently in the mempool that are related to this public key.

At a high level, this function allows one to get the utxos that are the union of: - utxos in the db - utxos in the view from previously-connected transactions

func (*UtxoView) GetUserAssociationByAttributes added in v3.2.0

func (bav *UtxoView) GetUserAssociationByAttributes(transactorPK []byte, metadata *CreateUserAssociationMetadata) (*UserAssociationEntry, error)

func (*UtxoView) GetUserAssociationByID added in v3.2.0

func (bav *UtxoView) GetUserAssociationByID(associationID *BlockHash) (*UserAssociationEntry, error)

func (*UtxoView) GetUserAssociationsByAttributes added in v3.2.0

func (bav *UtxoView) GetUserAssociationsByAttributes(associationQuery *UserAssociationQuery) ([]*UserAssociationEntry, error)

func (*UtxoView) GetUtxoEntryForUtxoKey

func (bav *UtxoView) GetUtxoEntryForUtxoKey(utxoKeyArg *UtxoKey) *UtxoEntry

func (*UtxoView) HelpConnectCoinTransfer

func (bav *UtxoView) HelpConnectCoinTransfer(
	txn *MsgDeSoTxn, txHash *BlockHash, blockHeight uint32, verifySignatures bool, isDAOCoin bool) (
	_totalInput uint64, _totalOutput uint64, _utxoOps []*UtxoOperation, _err error)

This function is the workhorse for both _connectCreatorCoinTransfer and _connectDAOCoinTransfer. We consolidated the code because they're very similar.

func (*UtxoView) HelpConnectCreatorCoinBuy

func (bav *UtxoView) HelpConnectCreatorCoinBuy(
	txn *MsgDeSoTxn, txHash *BlockHash, blockHeight uint32, verifySignatures bool) (
	_totalInput uint64, _totalOutput uint64, _creatorCoinReturnedNanos uint64, _founderRewardNanos uint64,
	_utxoOps []*UtxoOperation, _err error)

TODO: A lot of duplicate code between buy and sell. Consider factoring out the common code.

func (*UtxoView) HelpConnectCreatorCoinSell

func (bav *UtxoView) HelpConnectCreatorCoinSell(
	txn *MsgDeSoTxn, txHash *BlockHash, blockHeight uint32, verifySignatures bool) (
	_totalInput uint64, _totalOutput uint64, _desoReturnedNanos uint64,
	_utxoOps []*UtxoOperation, _err error)

TODO: A lot of duplicate code between buy and sell. Consider factoring out the common code.

func (*UtxoView) HelpConnectDAOCoinBurn

func (bav *UtxoView) HelpConnectDAOCoinBurn(
	txn *MsgDeSoTxn, txHash *BlockHash, blockHeight uint32, verifySignatures bool) (
	_totalInput uint64, _totalOutput uint64, _utxoOps []*UtxoOperation, _err error)

func (*UtxoView) HelpConnectDAOCoinDisableMinting

func (bav *UtxoView) HelpConnectDAOCoinDisableMinting(
	txn *MsgDeSoTxn, txHash *BlockHash, blockHeight uint32, verifySignatures bool) (
	_totalInput uint64, _totalOutput uint64, _utxoOps []*UtxoOperation, _err error)

func (*UtxoView) HelpConnectDAOCoinInitialization

func (bav *UtxoView) HelpConnectDAOCoinInitialization(txn *MsgDeSoTxn, txHash *BlockHash, blockHeight uint32,
	verifySignatures bool) (_totalInput uint64, _totalOutput uint64, _utxoOps []*UtxoOperation,
	_creatorProfileEntry *ProfileEntry, _err error)

func (*UtxoView) HelpConnectDAOCoinMint

func (bav *UtxoView) HelpConnectDAOCoinMint(
	txn *MsgDeSoTxn, txHash *BlockHash, blockHeight uint32, verifySignatures bool) (
	_totalInput uint64, _totalOutput uint64, _utxoOps []*UtxoOperation, _err error)

func (*UtxoView) HelpConnectUpdateTransferRestrictionStatus

func (bav *UtxoView) HelpConnectUpdateTransferRestrictionStatus(
	txn *MsgDeSoTxn, txHash *BlockHash, blockHeight uint32, verifySignatures bool) (
	_totalInput uint64, _totalOutput uint64, _utxoOps []*UtxoOperation, _err error)

func (*UtxoView) IsValidCreatePostAssociationMetadata added in v3.2.0

func (bav *UtxoView) IsValidCreatePostAssociationMetadata(transactorPK []byte, metadata *CreatePostAssociationMetadata) error

func (*UtxoView) IsValidCreateUserAssociationMetadata added in v3.2.0

func (bav *UtxoView) IsValidCreateUserAssociationMetadata(transactorPK []byte, metadata *CreateUserAssociationMetadata) error

func (*UtxoView) IsValidDAOCoinLimitOrder

func (bav *UtxoView) IsValidDAOCoinLimitOrder(order *DAOCoinLimitOrderEntry) error

func (*UtxoView) IsValidDAOCoinLimitOrderMatch

func (bav *UtxoView) IsValidDAOCoinLimitOrderMatch(
	transactorOrder *DAOCoinLimitOrderEntry, matchingOrder *DAOCoinLimitOrderEntry) error

func (*UtxoView) IsValidDAOCoinLimitOrderMetadata

func (bav *UtxoView) IsValidDAOCoinLimitOrderMetadata(transactorPK []byte, metadata *DAOCoinLimitOrderMetadata) error

func (*UtxoView) IsValidDAOCoinTransfer

func (bav *UtxoView) IsValidDAOCoinTransfer(
	creatorProfileEntry *ProfileEntry, senderPublicKey []byte, receiverPublicKey []byte) error

func (*UtxoView) IsValidDeletePostAssociationMetadata added in v3.2.0

func (bav *UtxoView) IsValidDeletePostAssociationMetadata(transactorPK []byte, metadata *DeletePostAssociationMetadata) error

func (*UtxoView) IsValidDeleteUserAssociationMetadata added in v3.2.0

func (bav *UtxoView) IsValidDeleteUserAssociationMetadata(transactorPK []byte, metadata *DeleteUserAssociationMetadata) error

func (*UtxoView) Preload

func (bav *UtxoView) Preload(desoBlock *MsgDeSoBlock, blockHeight uint64) error

Preload tries to fetch all the relevant data needed to connect a block in batches from Postgres. It marks many objects as "nil" in the respective data structures and then fills in the objects it is able to retrieve from the database. It's much faster to fetch data in bulk and cache "nil" values then to query individual records when connecting every transaction. If something is not preloaded the view falls back to individual queries.

func (*UtxoView) ValidateAccessGroupPublicKeyAndNameWithUtxoView added in v3.2.0

func (bav *UtxoView) ValidateAccessGroupPublicKeyAndNameWithUtxoView(
	groupOwnerPublicKey, groupKeyName []byte, blockHeight uint32) error

ValidateAccessGroupPublicKeyAndNameWithUtxoView validates that the provided access group public key and name are correctly formatted. It also checks that the access group exists based on the UtxoView.

func (*UtxoView) ValidateDerivedKey

func (bav *UtxoView) ValidateDerivedKey(ownerPkBytes []byte, derivedPkBytes []byte, blockHeight uint64) error

ValidateDerivedKey checks if a derived key is authorized and valid.

func (*UtxoView) ValidateDiamondsAndGetNumCreatorCoinNanos

func (bav *UtxoView) ValidateDiamondsAndGetNumCreatorCoinNanos(
	senderPublicKey []byte,
	receiverPublicKey []byte,
	diamondPostHash *BlockHash,
	diamondLevel int64,
	blockHeight uint32,
) (_numCreatorCoinNanos uint64, _netNewDiamonds int64, _err error)

func (*UtxoView) ValidateDiamondsAndGetNumDeSoNanos

func (bav *UtxoView) ValidateDiamondsAndGetNumDeSoNanos(
	senderPublicKey []byte,
	receiverPublicKey []byte,
	diamondPostHash *BlockHash,
	diamondLevel int64,
	blockHeight uint32,
) (_numDeSoNanos uint64, _netNewDiamonds int64, _err error)

func (*UtxoView) ValidateKeyAndNameWithUtxo

func (bav *UtxoView) ValidateKeyAndNameWithUtxo(ownerPublicKey, messagingPublicKey, keyName []byte) error

ValidateKeyAndNameWithUtxo validates public key and key name, which are used in DeSo V3 Messages protocol. The function first checks that the key and name are valid and then fetches an entry from UtxoView or DB to check if the key has been previously saved. This is particularly useful for connecting V3 messages.

Jump to

Keyboard shortcuts

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