aboutsummaryrefslogblamecommitdiff
path: root/examples/multicoin/main.go
blob: 35158a88a102abd5aaa7e76ca54ac057b01ccb9f (plain) (tree)
1
2
3
4
5
6
7
8
9



                     
                       
              


                                         
                                               
                                            
                                        
                                           


                                                         
                                                        

                                                
                                             



                   
                       
                 



                 






                            












                                                                                                                                           














                                                                                                                            
                                                   



                                         
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
                                                                                          
 

                                               
                                                               
                       

                                                  
 
                                     


                                                     








                                                                      




                                                                                                                  










                                                                  


                                                            
                                                          





                                                                       
                                       

                                                  
                                                        


                                                                                                       



                                                                                                                            
                                                                                          

                                   
                                    




                                                                                          
                                                                                          
 
                                   

                                                                                                                                                  





                                                                                                                    




                                                                                                                                     
 

                                                                 
                                                                                                                                                             
                                               
                                                                                                                                                                


                                                        

                                                                                                                                                      



                                                                                                                            
 

                                                                                                                                                          



                                                                                                                           
                                 




                                                                                                                                       




                                                                                                                   

                                                                                                                                
                                                                                                                   
                                               

                                                                                  



























                                                                  
                                                   
 

                                                                                               





                                                                                                               

                                                          
               







                                                       
package main

import (
	"crypto/rand"
	"encoding/json"
	"flag"
	"fmt"
	"github.com/ava-labs/coreth"
	"github.com/ava-labs/coreth/core"
	"github.com/ava-labs/coreth/core/types"
	"github.com/ava-labs/coreth/core/vm"
	"github.com/ava-labs/coreth/eth"
	"github.com/ava-labs/coreth/params"
	"github.com/ethereum/go-ethereum/accounts/abi"
	"github.com/ethereum/go-ethereum/common"
	"github.com/ethereum/go-ethereum/common/compiler"
	"github.com/ethereum/go-ethereum/common/hexutil"
	"github.com/ethereum/go-ethereum/crypto"
	"github.com/ethereum/go-ethereum/log"
	"github.com/ethereum/go-ethereum/rlp"
	"go/build"
	"math/big"
	"os"
	"os/signal"
	"path/filepath"
	"strings"
	"syscall"
	"time"
)

func checkError(err error) {
	if err != nil {
		panic(err)
	}
}

func main() {
	var fChainID int64
	var fNonce uint64
	var fKey string
	flag.Int64Var(&fChainID, "chainid", 43112, "tx.chainId")
	flag.Uint64Var(&fNonce, "nonce", 0, "tx.nonce")
	flag.StringVar(&fKey, "key", "0x56289e99c94b6912bfc12adc093c9b51124f0dc54ac7a766b2bc5ccf558d8027", "private key (hex with \"0x\")")
	nonce2 := fNonce
	chainID2 := big.NewInt(fChainID)
	_pkey, err := crypto.HexToECDSA(fKey[2:])
	checkError(err)
	pkey := coreth.NewKeyFromECDSA(_pkey)
	flag.Parse()

	// configure the chain
	config := eth.DefaultConfig
	config.ManualCanonical = true
	chainConfig := &params.ChainConfig{
		ChainID:             big.NewInt(1),
		HomesteadBlock:      big.NewInt(0),
		DAOForkBlock:        big.NewInt(0),
		DAOForkSupport:      true,
		EIP150Block:         big.NewInt(0),
		EIP150Hash:          common.HexToHash("0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0"),
		EIP155Block:         big.NewInt(0),
		EIP158Block:         big.NewInt(0),
		ByzantiumBlock:      big.NewInt(0),
		ConstantinopleBlock: big.NewInt(0),
		PetersburgBlock:     big.NewInt(0),