aboutsummaryrefslogblamecommitdiff
path: root/plugin/evm/service.go
blob: 9f2e61adffc026c16b3cf467d2c458dd9fe2411d (plain) (tree)
1
2
3
4
5
6
7
8
9







                                                     
                

                  

                  


                                    
                                             
                                             



                                                          
                                               


                                                          
                                             




















                                                                                              

                                                       
 


















                                                                                                              
                                                                                               



















                                                                                              
                                                                                                        








                                                                                          
                                        




                                          
                                                                      






















                                                                                               
                                       


                                   













                                                                             
                                                                                                      
                                         





                                                                                        



                                                                                         

                        
                            

                                       
                                                                            
         

                                                                                                  








                                                    
                                                                                                       
                                                                                   
 


                                                                                             
 





                                                                                           
                                             
                                                                      
                       
                                                                         
         
                                                   
 
                                        
                                                                           


                                                                        










                                                                                    


                  

                                                 
                    



                                               



                                                           

                                                                            
                                                                                                         
                                          




                                                                                          
 




                                                                                        




                                                                                    
                        
 
                            




                                                                                      
                                                                






                                     




                                                 


                                       








                                                                                  
                                                                                                         
                                          














                                                                                         

                        





                                                                                           



                                             

                                          
                                               











                                                                            
// (c) 2019-2020, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

package evm

import (
	"context"
	"crypto/rand"
	"errors"
	"fmt"
	"math/big"
	"net/http"
	"strings"

	"github.com/ava-labs/coreth"

	"github.com/ava-labs/avalanchego/api"
	"github.com/ava-labs/avalanchego/ids"
	"github.com/ava-labs/avalanchego/utils/constants"
	"github.com/ava-labs/avalanchego/utils/crypto"
	"github.com/ava-labs/avalanchego/utils/formatting"
	"github.com/ava-labs/avalanchego/utils/json"
	"github.com/ava-labs/coreth/core/types"
	"github.com/ethereum/go-ethereum/common"
	"github.com/ethereum/go-ethereum/common/hexutil"
	ethcrypto "github.com/ethereum/go-ethereum/crypto"
	"github.com/ethereum/go-ethereum/log"
)

const (
	version = "Athereum 1.0"
)

// test constants
const (
	GenesisTestAddr = "0x751a0b96e1042bee789452ecb20253fba40dbe85"
	GenesisTestKey  = "0xabd71b35d559563fea757f0f5edbde286fb8c043105b15abb7cd57189306d7d1"
)

// DebugAPI introduces helper functions for debuging
type DebugAPI struct{ vm *VM }

// SnowmanAPI introduces snowman specific functionality to the evm
type SnowmanAPI struct{ vm *VM }

// NetAPI offers network related API methods
type NetAPI struct{ vm *VM }

// AvaxAPI offers Avalanche network related API methods
type AvaxAPI struct{ vm *VM }

// NewNetAPI creates a new net API instance.
func NewNetAPI(vm *VM) *NetAPI { return &NetAPI{vm} }

// Listening returns an indication if the node is listening for network connections.
func (s *NetAPI) Listening() bool { return true } // always listening

// PeerCount returns the number of connected peers
func (s *NetAPI) PeerCount() hexutil.Uint { return<