Documentation
¶
Index ¶
- Constants
- func CloseGlobalDAService()
- func GenerateKey() string
- func InitializeMasterIndex() error
- func ListOffchainData(chainID string) ([]string, error)
- func SaveOffchainData(data OffchainData) (string, error)
- func SetupGlobalDAService(natsURL string) error
- func StoreBlobReference(ref BlobReference) error
- type BlobReference
- type ChainIndex
- type DataAvailabilityService
- func (s *DataAvailabilityService) GetBlobStatus(dataID string) (interface{}, error)
- func (s *DataAvailabilityService) RetrieveData(dataID string) (map[string]interface{}, error)
- func (s *DataAvailabilityService) SetupSubscriptions(dataStoredHandler, dataRetrievedHandler func(dataID string)) error
- func (s *DataAvailabilityService) StoreData(data map[string]interface{}) (string, error)
- type MasterIndex
- type MasterIndexConfig
- type OffchainData
- type Vote
Constants ¶
const ( MASTER_INDEX_FILE = "eigenda_master_index.json" CONFIG_DIR = ".chaoschain" )
Constants for local storage
const ( // Updated EigenDA URLs for Holesky MAX_RETRIES = 3 // NATS subjects SUBJECT_DATA_STORED = "data.stored" SUBJECT_DATA_RETRIEVED = "data.retrieved" // EigenDA configuration EIGENDA_HOST = "disperser-holesky.eigenda.xyz" EIGENDA_PORT = "443" EIGENDA_REQUEST_TIMEOUT = 30 * time.Second EIGENDA_POLL_INTERVAL = 5 * time.Second EIGENDA_MAX_WAIT_TIME = 30 * time.Minute // EigenDA API endpoints EIGENDA_DISPERSE_URL = "https://disperser-holesky.eigenda.xyz:443/v1/blob" EIGENDA_STATUS_URL = "https://disperser-holesky.eigenda.xyz:443/v1/blob/status" EIGENDA_RETRIEVE_URL = "https://disperser-holesky.eigenda.xyz:443/v1/blob" )
Variables ¶
This section is empty.
Functions ¶
func CloseGlobalDAService ¶
func CloseGlobalDAService()
CloseGlobalDAService closes the global DataAvailabilityService instance
func GenerateKey ¶
func GenerateKey() string
func InitializeMasterIndex ¶
func InitializeMasterIndex() error
InitializeMasterIndex loads the master index from EigenDA or creates a new one
func ListOffchainData ¶
ListOffchainData lists all off-chain data for a specific chain. This is a placeholder function that would need to be implemented with a proper indexing mechanism, as EigenDA doesn't provide a native way to list or query data.
func SaveOffchainData ¶
func SaveOffchainData(data OffchainData) (string, error)
SaveOffchainData stores off-chain data into EigenDA using the global DataAvailabilityService. It marshals the off-chain data into a map and then stores it via StoreData.
func SetupGlobalDAService ¶
SetupGlobalDAService initializes the global DataAvailabilityService instance
func StoreBlobReference ¶
func StoreBlobReference(ref BlobReference) error
StoreBlobReference stores a reference to an EigenDA blob
Types ¶
type BlobReference ¶
type BlobReference struct {
BlobID string `json:"blobId"` // EigenDA blob ID
ChainID string `json:"chainId"` // Chain ID
BlockHash string `json:"blockHash"` // Block hash (used as thread ID)
BlockHeight int `json:"blockHeight"` // Block height
Timestamp int64 `json:"timestamp"` // When the blob was stored
Outcome string `json:"outcome"` // Outcome of the consensus (accepted/rejected)
}
BlobReference stores the mapping between EigenDA blob ID, chain ID, and block information
func GetBlobReferenceByBlobID ¶
func GetBlobReferenceByBlobID(blobID string) (BlobReference, bool)
GetBlobReferenceByBlobID returns the blob reference for a specific blob ID
func GetBlobReferenceByBlockHash ¶
func GetBlobReferenceByBlockHash(chainID, blockHash string) (BlobReference, bool)
GetBlobReferenceByBlockHash returns the blob reference for a specific block hash
func GetBlobReferenceByHeight ¶
func GetBlobReferenceByHeight(chainID string, height int) (BlobReference, bool)
GetBlobReferenceByHeight returns the blob reference for a specific block height
func GetBlobReferencesForChain ¶
func GetBlobReferencesForChain(chainID string) []BlobReference
GetBlobReferencesForChain returns all blob references for a specific chain
type ChainIndex ¶
type ChainIndex struct {
BlobReferences map[string]BlobReference `json:"blobReferences"` // blockHash -> BlobReference
LastUpdated int64 `json:"lastUpdated"` // Timestamp of last update
}
ChainIndex represents the index of blob references for a specific chain
type DataAvailabilityService ¶
type DataAvailabilityService struct {
// contains filtered or unexported fields
}
DataAvailabilityService handles interactions with EigenDA
var (
GlobalDAService *DataAvailabilityService
)
Global instance of the DataAvailabilityService
func GetGlobalDAService ¶
func GetGlobalDAService() *DataAvailabilityService
GetGlobalDAService returns the global DataAvailabilityService instance
func NewDataAvailabilityService ¶
func NewDataAvailabilityService(natsURL string) (*DataAvailabilityService, error)
NewDataAvailabilityService creates a new DA service
func (*DataAvailabilityService) GetBlobStatus ¶
func (s *DataAvailabilityService) GetBlobStatus(dataID string) (interface{}, error)
GetBlobStatus retrieves the current status of a blob from EigenDA
func (*DataAvailabilityService) RetrieveData ¶
func (s *DataAvailabilityService) RetrieveData(dataID string) (map[string]interface{}, error)
RetrieveData retrieves data from EigenDA using dataID
func (*DataAvailabilityService) SetupSubscriptions ¶
func (s *DataAvailabilityService) SetupSubscriptions(dataStoredHandler, dataRetrievedHandler func(dataID string)) error
SetupSubscriptions sets up NATS subscriptions for DA events
type MasterIndex ¶
type MasterIndex struct {
ChainIndices map[string]ChainIndex `json:"chainIndices"` // chainID -> ChainIndex
LastUpdated int64 `json:"lastUpdated"` // Timestamp of last update
}
MasterIndex represents the master index of all blob references
type MasterIndexConfig ¶
type MasterIndexConfig struct {
MasterIndexID string `json:"masterIndexId"`
LastUpdated int64 `json:"lastUpdated"`
}
MasterIndexConfig stores the configuration for the master index
type OffchainData ¶
type OffchainData struct {
ChainID string `json:"chainId"`
BlockHash string `json:"blockHash"` // Block hash (used as thread ID)
BlockHeight int `json:"blockHeight"` // Block height
Discussions []consensus.Discussion `json:"discussions"`
Votes []Vote `json:"votes"`
Outcome string `json:"outcome"`
AgentIdentities map[string]string `json:"agentIdentities"`
Timestamp int64 `json:"timestamp"` // When the data was created
}
OffchainData represents the off-chain data stored in EigenDA for a specific chain.
func GetOffchainData ¶
func GetOffchainData(dataID string) (*OffchainData, error)
GetOffchainData retrieves off-chain data from EigenDA using the global DataAvailabilityService. It takes a dataID and returns the corresponding OffchainData.