aboutsummaryrefslogblamecommitdiff
path: root/coreth.go
blob: 351a14d88d36672d117bf7d6d2abadac645e82f4 (plain) (tree)
1
2
3
4
5
6
7
8
9


              



                      
                                                    
                                         

                                               
                                        
                                          
                                         
                                        


                                                
                                               
                                             
                                              
                                    

 
     

                                             



                                             




                           

                                         
                                     
                                     

 
                                            
                    

 
                                                                     
                                                                                                                         


                                           


                                        

                                      


                          


                                                                    
                                           
                                        
                                        
                                                                  
                                                                        
                             
                                          


                                        


                               
                                   
 

                              
                               

 
                                  
                                       

 



                                                                                       



                                                     
                                                            
                                                                        







                                                                            








                                                       
                                                                      
                                                    


                                                                     
                                                   
 
 
                                                              
                           

 













                                                                    

 











                                                                                            



                                                                              



                                                                       














                                                                              
                                                                     
                                                 
                                                       
                                                         

 



                                                                          



                                                      



                                                                      















                                                                                  
                                   



                                                       



                                                
                 
                                 



                                                              




                                                                              


                                           




                                                                      
 

             


                                                                                                                                 
 
package coreth

import (
	"crypto/ecdsa"
	"io"
	"os"

	"github.com/ava-labs/coreth/consensus/dummy"
	"github.com/ava-labs/coreth/core"
	"github.com/ava-labs/coreth/core/state"
	"github.com/ava-labs/coreth/core/types"
	"github.com/ava-labs/coreth/eth"
	"github.com/ava-labs/coreth/miner"
	"github.com/ava-labs/coreth/node"
	"github.com/ava-labs/coreth/rpc"
	"github.com/ethereum/go-ethereum/common"
	"github.com/ethereum/go-ethereum/crypto"
	"github.com/ethereum/go-ethereum/ethdb"
	"github.com/ethereum/go-ethereum/event"
	"github.com/ethereum/go-ethereum/log"
	"github.com/ethereum/go-ethereum/trie"
	"github.com/mattn/go-isatty"
)

var (
	BlackholeAddr = common.Address{
		1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
	}
)

type Tx = types.Transaction
type Block = types.Block
type Hash = common.Hash

type ETHChain struct {
	backend *eth.Ethereum
	cb      *dummy.ConsensusCallbacks
	mcb     *miner.MinerCallbacks
	bcb     *eth.BackendCallbacks
}

func isLocalBlock(block *types.Block) bool {
	return false
}

// NewETHChain creates an Ethereum blockchain with the given configs.
func NewETHChain(config *eth.Config, nodecfg *node.Config, etherBase *common.Address, chainDB ethdb.Database) *ETHChain {
	if config == nil {
		config = &eth.DefaultConfig
	}
	if nodecfg == nil {
		nodecfg = &node.Config{}
	}
	//mux := new(event.TypeMux)
	node, err := node.New(nodecfg)
	if err != nil {
		panic(err)
	}