You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some plugins would like to be able to get information from the blockchain or even add blocks to the blockchain.
Implementation
The core.Blockchain object is pretty tightly coupled with the Geth codebase, so it will require a wrapper / interface.
In PluGeth utils, create an object with the following interface:
type Blockchain interface{
func SetHead(head uint64) error
func SnapSyncCommitHead(hash core.Hash) error
func Reset() error
func ResetWithGenesisBlock(genesis []byte) error // RLP encoded *types.Block
func Export(w io.Writer) error
func ExportN(w io.Writer, first uint64, last uint64) error
func Stop()
func StopInsert()
func InsertReceiptChain(blockChain [][]byte, receiptChain [][]byte, ancientLimit uint64) (int, error) // List of RLP encoded blocks, list of RLP encoded receipts
func InsertChain(chain [][]byte) (int, error) // List of RLP encoded blocks
func InsertBlockWithoutSetHead(block []byte) error // RLP encoded *types.BLock
func SetChainHead(head []byte) error // RLP encoded *types.Block
func InsertHeaderChain(chain [][]byte, checkFreq int) (int, error) // List of rlp encoded *types.Header
}
(Comments indicate when []bytes are RLP encoded values)
Then we would need to implement a wrapper object to translate between the types in the above interface and the types required by the *core.BlockChain object. We would then need to expose this to the plugeth backend by way of the Ethereum object in eth/backend.go
The text was updated successfully, but these errors were encountered:
heiningair
added a commit
to heiningair/plugeth
that referenced
this issue
Aug 9, 2022
Rationale
Some plugins would like to be able to get information from the blockchain or even add blocks to the blockchain.
Implementation
The core.Blockchain object is pretty tightly coupled with the Geth codebase, so it will require a wrapper / interface.
In PluGeth utils, create an object with the following interface:
(Comments indicate when []bytes are RLP encoded values)
Then we would need to implement a wrapper object to translate between the types in the above interface and the types required by the *core.BlockChain object. We would then need to expose this to the plugeth backend by way of the
Ethereum
object ineth/backend.go
The text was updated successfully, but these errors were encountered: