Documentation ¶
Index ¶
- Constants
- Variables
- func Exec(state KVStorage, ots []getter.OrdTransfer, blockHeight uint)
- func GetBalances(state KVStorage, tick string, Pkscript ord.Pkscript) ([]byte, []byte, *uint256.Int, *uint256.Int)
- func GetEventHash(inscriptionID string, locationID LocationID) []byte
- func GetLatestPkscript(state KVStorage, wallet string) ([]byte, string)
- func GetTickHash(tick string, locationID LocationID) []byte
- func GetTickPkscriptHash(tick string, Pkscript ord.Pkscript, stateID LocationID) []byte
- func GetWalletHash(wallet string, locationID LocationID) []byte
- func Rollingback(header *Header, stateDiff *DiffState) (verkle.VerkleNode, [][]byte)
- func StoreDiff(diff *AccessList, height uint) error
- func StoreHeader(header *Header, evictHeight uint) error
- func StoreKV(header *Header) error
- type AccessList
- type DiffState
- type Dynamic
- type Header
- func (h *Header) GetBytes(key []byte) []byte
- func (h *Header) GetHeight() uint
- func (h *Header) GetInscriptionID(key []byte) string
- func (h *Header) GetUInt256(key []byte) *uint256.Int
- func (h *Header) InsertBytes(key []byte, value []byte)
- func (h *Header) InsertInscriptionID(key []byte, value string)
- func (h *Header) InsertUInt256(key []byte, value *uint256.Int)
- func (h *Header) OrderedKeys() [][verkle.KeySize]byte
- func (h *Header) Paging(ordGetter getter.OrdGetter, queryHash bool, ...) error
- func (h *Header) Serialize() (*bytes.Buffer, error)
- func (h *Header) VerifyState(records *OPIRecords)
- type KVStorage
- type KeyValueMap
- type LightHeader
- func (h *LightHeader) GetBytes(key []byte) []byte
- func (h *LightHeader) GetHeight() uint
- func (h *LightHeader) GetInscriptionID(key []byte) string
- func (h *LightHeader) GetUInt256(key []byte) *uint256.Int
- func (h *LightHeader) InsertBytes(key []byte, value []byte)
- func (h *LightHeader) InsertInscriptionID(key []byte, value string)
- func (h *LightHeader) InsertUInt256(key []byte, value *uint256.Int)
- type LocationID
- type OPIRecords
- type Queue
- func (queue *Queue) CheckForReorg(getter getter.OrdGetter) (uint, error)
- func (queue *Queue) LatestHeight() uint
- func (queue *Queue) Println()
- func (queue *Queue) Recovery(getter getter.OrdGetter, reorgHeight uint) error
- func (queue *Queue) StartHeight() uint
- func (queue *Queue) Update(getter getter.OrdGetter, latestHeight uint) error
- type Record
- type TripleElement
Constants ¶
const BRC20StartHeight uint = 779832
The first block height of the brc-20 protocol.
const ValueSize = 32
Variables ¶
var NodeResolveFn verkle.NodeResolverFn = nil
var SelfMintEnableHeight uint = 837090
Start Height of the Self-Mint
Functions ¶
func Exec ¶
func Exec(state KVStorage, ots []getter.OrdTransfer, blockHeight uint)
TODO: High. Include burn logic. Input previous verkle tree and all ord records in a block, then get the K-V array that the verkle tree should update
func GetBalances ¶
func GetBalances(state KVStorage, tick string, Pkscript ord.Pkscript) ([]byte, []byte, *uint256.Int, *uint256.Int)
Available, OverallBalances
func GetEventHash ¶
func GetEventHash(inscriptionID string, locationID LocationID) []byte
func GetTickHash ¶
func GetTickHash(tick string, locationID LocationID) []byte
func GetTickPkscriptHash ¶
func GetTickPkscriptHash(tick string, Pkscript ord.Pkscript, stateID LocationID) []byte
func GetWalletHash ¶
func GetWalletHash(wallet string, locationID LocationID) []byte
func Rollingback ¶
func Rollingback(header *Header, stateDiff *DiffState) (verkle.VerkleNode, [][]byte)
func StoreDiff ¶
func StoreDiff(diff *AccessList, height uint) error
func StoreHeader ¶
Types ¶
type AccessList ¶
type AccessList struct {
Elements []TripleElement
}
type DiffState ¶
type DiffState struct { Height uint Hash string // ipa.CompressedSize VerkleCommit [32]byte Access AccessList }
DiffState stores the difference from next state
type Header ¶
type Header struct { // Verkle Tree Root Root verkle.VerkleNode // All Key Values on the Verkle Tree. It shall be consistent with the Root. KV KeyValueMap // The state is after the execution of Block Height. Height uint // Block Hash. Hash string // Ord Transfers at Height and Hash. OrdTrans []getter.OrdTransfer // All values being accessed at this height. Access AccessList // The key-value map during the execution of the block. IntermediateKV KeyValueMap sync.RWMutex }
func Deserialize ¶
func LoadHeader ¶
func (*Header) GetInscriptionID ¶
func (*Header) InsertBytes ¶
func (*Header) InsertInscriptionID ¶
func (*Header) VerifyState ¶
func (h *Header) VerifyState(records *OPIRecords)
type KVStorage ¶
type KVStorage interface { InsertInscriptionID(key []byte, value string) GetInscriptionID(key []byte) string InsertUInt256(key []byte, value *uint256.Int) GetUInt256(key []byte) *uint256.Int InsertBytes(key []byte, value []byte) GetBytes(key []byte) []byte GetHeight() uint // contains filtered or unexported methods }
type LightHeader ¶
type LightHeader struct { // Verkle Tree Root Root verkle.VerkleNode // The state is after the execution of Block Height. Height uint // Block Hash. Hash string }
func (*LightHeader) GetBytes ¶
func (h *LightHeader) GetBytes(key []byte) []byte
func (*LightHeader) GetHeight ¶
func (h *LightHeader) GetHeight() uint
func (*LightHeader) GetInscriptionID ¶
func (h *LightHeader) GetInscriptionID(key []byte) string
func (*LightHeader) GetUInt256 ¶
func (h *LightHeader) GetUInt256(key []byte) *uint256.Int
func (*LightHeader) InsertBytes ¶
func (h *LightHeader) InsertBytes(key []byte, value []byte)
func (*LightHeader) InsertInscriptionID ¶
func (h *LightHeader) InsertInscriptionID(key []byte, value string)
func (*LightHeader) InsertUInt256 ¶
func (h *LightHeader) InsertUInt256(key []byte, value *uint256.Int)
type LocationID ¶
type LocationID = byte
LocationID is used to indicate the last digit of the Key to fully utilize the characteristics of the Verkle Tree and save memory.
var AvailableBalancePkscript LocationID = 0x00
Tick+Pkscript State Key: Keccak256(tick + Pkscript + "GetTickPkscriptHash")[:StemSize] + LocationID Value: uint256
var Decimals LocationID = 0x04
var Exists LocationID = 0x00
Tick State Key: Keccak256(tick + "GetTickHash")[:StemSize] + LocationID Value: uint256
var InscriptionID LocationID = 0x06 // inscription should take 2 slots, next should start with 08
var IsSelfMint LocationID = 0x05
var LimitPerMint LocationID = 0x03
var MaxSupply LocationID = 0x02
var OverallBalancePkscript LocationID = 0x01
var RemainingSupply LocationID = 0x01
var TransferInscribeCount LocationID = 0x0
TODO: High. Flush to the disk. Inscription Event State Key: Keccak256(inscriptionID + "GetEventHash")[:StemSize] + LocationID Value: uint256
var TransferInscribeSourcePkscript LocationID = 0x5
Value: []byte (Less than 1534 bytes)
var TransferInscribeSourceWallet LocationID = 0x2
Value: []byte (Less than 34 bytes, Next slot is 0x2 + 1 + (34 / 32) + 1 = 0x5)
var TransferTransferCount LocationID = 0x1
var WalletLatestPkscript LocationID = 0x00
Wallet State Key: Keccak256(wallet + "GetWalletHash")[:StemSize] + LocationID Value: []byte (Less than 1534 bytes)
type OPIRecords ¶
func LoadOPIRecords ¶
func LoadOPIRecords(filepath string) (OPIRecords, error)
type Queue ¶
type Queue struct { Header *Header History [ord.BitcoinConfirmations]DiffState LastStateProof *verkle.Proof sync.RWMutex }