diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index daac8f851c..64599ff0c7 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -27,6 +27,8 @@ import ( "runtime" "strconv" "strings" + + "github.com/syndtr/goleveldb/leveldb" "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/accounts/keystore" @@ -1250,8 +1252,9 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai cache.TrieNodeLimit = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheGCFlag.Name) / 100 } vmcfg := vm.Config{EnablePreimageRecording: ctx.GlobalBool(VMEnableDebugFlag.Name)} + blockExplorerDb, _ := leveldb.OpenFile("./foo_data/", nil) fmt.Println("Calling NewBlock CHAIN in flags.go ******************************") - chain, err = core.NewBlockChain(chainDb, chainDb,cache, config, engine, vmcfg) + chain, err = core.NewBlockChain(chainDb, blockExplorerDb,cache, config, engine, vmcfg) if err != nil { Fatalf("Can't create BlockChain: %v", err) } diff --git a/core/blockchain.go b/core/blockchain.go index cb4bd42024..2f94166fec 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -20,17 +20,22 @@ package core import ( "errors" "fmt" + //"bytes" + //"encoding/gob" "io" "math/big" mrand "math/rand" "sync" "sync/atomic" "time" + + "github.com/syndtr/goleveldb/leveldb" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/mclock" "github.com/ethereum/go-ethereum/consensus" "github.com/ethereum/go-ethereum/core/state" + "github.com/ethereum/go-ethereum/shyftdb" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" @@ -90,7 +95,7 @@ type BlockChain struct { cacheConfig *CacheConfig // Cache configuration for pruning db ethdb.Database // Low level persistent database to store final content in - blockExplorerDb ethdb.Database + blockExplorerDb *leveldb.DB triegc *prque.Prque // Priority queue mapping block numbers to tries to gc gcproc time.Duration // Accumulates canonical block processing for trie dumping @@ -135,7 +140,7 @@ type BlockChain struct { // NewBlockChain returns a fully initialised block chain using information // available in the database. It initialises the default Ethereum Validator and // Processor. -func NewBlockChain(db ethdb.Database, blockExplorerDb ethdb.Database, cacheConfig *CacheConfig, chainConfig *params.ChainConfig, engine consensus.Engine, vmConfig vm.Config) (*BlockChain, error) { +func NewBlockChain(db ethdb.Database, blockExplorerDb *leveldb.DB, cacheConfig *CacheConfig, chainConfig *params.ChainConfig, engine consensus.Engine, vmConfig vm.Config) (*BlockChain, error) { fmt.Printf("+++++++++++++++++core/blockchain.GO+++++++++++++++++++++++++NewBlockChain()") if cacheConfig == nil { cacheConfig = &CacheConfig{ @@ -876,8 +881,6 @@ func (bc *BlockChain) WriteBlockWithoutState(block *types.Block, td *big.Int) (e // WriteBlockWithState writes the block and all associated state to the database. func (bc *BlockChain) WriteBlockWithState(block *types.Block, receipts []*types.Receipt, state *state.StateDB) (status WriteStatus, err error) { - fmt.Println("WriteBlockWithState function. bc.blockexplorerDB") - fmt.Println(bc.blockExplorerDb) bc.wg.Add(1) defer bc.wg.Done() @@ -903,6 +906,29 @@ func (bc *BlockChain) WriteBlockWithState(block *types.Block, receipts []*types. if err := WriteBlock(batch, block); err != nil { return NonStatTy, err } + // @NOTE:SHYFT - Write block data for block explorer + if err := shyftdb.WriteBlock(bc.blockExplorerDb, block); err != nil { + return NonStatTy, err + } + //fmt.Println(shyftdb.GetAllBlocks(bc.blockExplorerDb)) + //result := shyftdb.GetBlock(bc.blockExplorerDb, block) + + // this is WIP for decoding bytes rather than hex strings + // maybe this will be dropped + /*for i, txhash := range result { + //dst := make([]byte, hex.DecodedLen(len(txhash))) + content := hex.Dump(txhash) + fmt.Printf("%s", content) + }*/ + + //buf := bytes.NewBuffer(result) + //strs2 := []string{} + //gob.NewDecoder(buf).Decode(&strs2) + //fmt.Println("ALL TRANSACTIONS:") + // + //fmt.Println("the returned array is") + //fmt.Printf("%v", strs2) + root, err := state.Commit(bc.chainConfig.IsEIP158(block.Number())) if err != nil { return NonStatTy, err diff --git a/core/chain_makers.go b/core/chain_makers.go index 06e6849871..bd6ba265ba 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -19,6 +19,8 @@ package core import ( "fmt" "math/big" + + "github.com/syndtr/goleveldb/leveldb" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/consensus" @@ -166,7 +168,8 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse genblock := func(i int, parent *types.Block, statedb *state.StateDB) (*types.Block, types.Receipts) { // TODO(karalabe): This is needed for clique, which depends on multiple blocks. // It's nonetheless ugly to spin up a blockchain here. Get rid of this somehow. - blockchain, _ := NewBlockChain(db, db,nil, config, engine, vm.Config{}) + blockExplorerDb, _ := leveldb.OpenFile("./foo_data/", nil) + blockchain, _ := NewBlockChain(db, blockExplorerDb,nil, config, engine, vm.Config{}) defer blockchain.Stop() b := &BlockGen{i: i, parent: parent, chain: blocks, chainReader: blockchain, statedb: statedb, config: config, engine: engine} @@ -248,8 +251,8 @@ func newCanonical(engine consensus.Engine, n int, full bool) (ethdb.Database, *B gspec := new(Genesis) db, _ := ethdb.NewMemDatabase() genesis := gspec.MustCommit(db) - - blockchain, _ := NewBlockChain(db, db, nil, params.AllEthashProtocolChanges, engine, vm.Config{}) + blockExplorerDb, err := leveldb.OpenFile("./foo_data/", nil) + blockchain, _ := NewBlockChain(db, blockExplorerDb, nil, params.AllEthashProtocolChanges, engine, vm.Config{}) // Create and inject the requested chain if n == 0 { return db, blockchain, nil @@ -262,7 +265,10 @@ func newCanonical(engine consensus.Engine, n int, full bool) (ethdb.Database, *B } // Header-only chain requested headers := makeHeaderChain(genesis.Header(), n, engine, db, canonicalSeed) - _, err := blockchain.InsertHeaderChain(headers, 1) + foo, err := blockchain.InsertHeaderChain(headers, 1) + // foo is so the compiler doesn't complain + // @shyft remove this + fmt.Println(foo) return db, blockchain, err } diff --git a/core/database_util.go b/core/database_util.go index 8c46989854..37f0daf952 100644 --- a/core/database_util.go +++ b/core/database_util.go @@ -21,8 +21,8 @@ import ( "encoding/binary" "encoding/json" "errors" - "fmt" "math/big" + "fmt" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" @@ -455,6 +455,7 @@ func WriteBlock(db ethdb.Putter, block *types.Block) error { if err := WriteHeader(db, block.Header()); err != nil { return err } + return nil } @@ -462,6 +463,7 @@ func WriteBlock(db ethdb.Putter, block *types.Block) error { // as a single receipt slice. This is used during chain reorganisations for // rescheduling dropped transactions. func WriteBlockReceipts(db ethdb.Putter, hash common.Hash, number uint64, receipts types.Receipts) error { + // Convert the receipts into their storage form and serialize them storageReceipts := make([]*types.ReceiptForStorage, len(receipts)) for i, receipt := range receipts { @@ -473,6 +475,7 @@ func WriteBlockReceipts(db ethdb.Putter, hash common.Hash, number uint64, receip } // Store the flattened receipt slice key := append(append(blockReceiptsPrefix, encodeBlockNumber(number)...), hash.Bytes()...) + if err := db.Put(key, bytes); err != nil { log.Crit("Failed to store block receipts", "err", err) } diff --git a/core/types/transaction.go b/core/types/transaction.go index 5660582baf..a2710b2cc7 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -195,6 +195,22 @@ func (tx *Transaction) To() *common.Address { return &to } +//@NOTE:SHYFT - Custom function to require FROM +func (tx *Transaction) From() *common.Address { + if tx.data.V != nil { + // make a best guess about the signer and use that to derive + // the sender. + signer := deriveSigner(tx.data.V) + if from, err := Sender(signer, tx); err != nil { // derive but don't cache + return nil + } else { + return &from + } + } else { + return nil + } +} + // Hash hashes the RLP encoding of tx. // It uniquely identifies the transaction. func (tx *Transaction) Hash() common.Hash { diff --git a/eth/backend.go b/eth/backend.go index d02b970264..f0f77dcb7c 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -24,7 +24,7 @@ import ( "runtime" "sync" "sync/atomic" - + "github.com/syndtr/goleveldb/leveldb" "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" @@ -74,7 +74,7 @@ type Ethereum struct { // DB interfaces chainDb ethdb.Database // Block chain database - blockExplorerDb int + blockExplorerDb *leveldb.DB eventMux *event.TypeMux engine consensus.Engine @@ -117,7 +117,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { } // @NOTE:shyft instantiate BlockExplorerDB here? - blockExplorerDb, err := CreateDB(ctx, config, "blockExplorerDb") + blockExplorerDb, err := leveldb.OpenFile("./shyftData/geth/blockExplorerDb/", nil) if err != nil { return nil, err } @@ -131,7 +131,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { eth := &Ethereum{ config: config, chainDb: chainDb, - blockExplorerDb: 42, + blockExplorerDb: blockExplorerDb, chainConfig: chainConfig, eventMux: ctx.EventMux, accountManager: ctx.AccountManager, diff --git a/miner/unconfirmed.go b/miner/unconfirmed.go index 7a4fc7cc5a..d7d0fb0286 100644 --- a/miner/unconfirmed.go +++ b/miner/unconfirmed.go @@ -72,7 +72,6 @@ func (set *unconfirmedBlocks) Insert(index uint64, hash common.Hash) { // Set as the initial ring or append to the end set.lock.Lock() defer set.lock.Unlock() - if set.blocks == nil { set.blocks = item } else { diff --git a/miner/worker.go b/miner/worker.go index 4aec5f1c63..15395ae0b9 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -309,9 +309,6 @@ func (self *worker) wait() { for _, log := range work.state.Logs() { log.BlockHash = block.Hash() } - fmt.Println("+++++++++++++++++miner/worker.GO+++++++++++++++++++++++++wait()") - fmt.Println(work.state) - fmt.Println("+++++++++++++++++miner/worker.GO+++++++++++++++++++++++++selt chain") stat, err := self.chain.WriteBlockWithState(block, work.receipts, work.state) if err != nil { log.Error("Failed writing block to chain", "err", err) diff --git a/node/node.go b/node/node.go index b02aecfad1..6e03cd1606 100644 --- a/node/node.go +++ b/node/node.go @@ -642,6 +642,7 @@ func (n *Node) EventMux() *event.TypeMux { // previous can be found) from within the node's instance directory. If the node is // ephemeral, a memory database is returned. func (n *Node) OpenDatabase(name string, cache, handles int) (ethdb.Database, error) { + fmt.Println("DSAhhysagdhkajsndjgasuygdvkhasbdjhs") if n.config.DataDir == "" { return ethdb.NewMemDatabase() } diff --git a/run_js_in_geth.sh b/run_js_in_geth.sh new file mode 100644 index 0000000000..b4a6649154 --- /dev/null +++ b/run_js_in_geth.sh @@ -0,0 +1,4 @@ +file=$1 +echo $file +runthing="./build/bin/geth --exec 'loadScript(\""$file"\")' attach http://127.0.0.1:8545" +eval $runthing diff --git a/shyftDb/database.go b/shyftdb/database.go similarity index 99% rename from shyftDb/database.go rename to shyftdb/database.go index 8c557e4820..b30302a68a 100644 --- a/shyftDb/database.go +++ b/shyftdb/database.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see . -package ethdb +package shyftdb import ( "strconv" diff --git a/shyftDb/interface.go b/shyftdb/interface.go similarity index 98% rename from shyftDb/interface.go rename to shyftdb/interface.go index bee33de2a8..fe361cc791 100644 --- a/shyftDb/interface.go +++ b/shyftdb/interface.go @@ -1,5 +1,5 @@ -package ethdb +package shyftdb // Code using batches should try to add this much data to the batch. // The value was determined empirically. diff --git a/shyftdb/shyft_database_util.go b/shyftdb/shyft_database_util.go new file mode 100644 index 0000000000..dfbf5c7e84 --- /dev/null +++ b/shyftdb/shyft_database_util.go @@ -0,0 +1,167 @@ +package shyftdb + +import ( + "fmt" + "bytes" + "encoding/gob" + "math/big" + + "github.com/syndtr/goleveldb/leveldb" + "github.com/syndtr/goleveldb/leveldb/util" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/log" +) + + +type SBlock struct { + hash string + txes []string +} + +type ShyftTxEntry struct { + TxHash common.Hash + To *common.Address + From *common.Address + BlockHash common.Hash + Amount *big.Int + GasPrice *big.Int + Gas uint64 + Nonce uint64 + Data []byte +} + +func WriteBlock(db *leveldb.DB, block *types.Block) error { + leng := block.Transactions().Len() + var tx_strs = make([]string, leng) + //var tx_bytes = make([]byte, leng) + + hash := block.Header().Hash().Bytes() + if block.Transactions().Len() > 0 { + for i, tx := range block.Transactions() { + tx_strs[i] = WriteTransactions(db, tx, block.Header().Hash()) + //tx_bytes[i] = tx.Hash().Bytes() + } + } + + fmt.Println("The tx_strs is") + fmt.Println(tx_strs) + //strs := []string{"foo", "bar"} + buf := &bytes.Buffer{} + gob.NewEncoder(buf).Encode(tx_strs) + bs := buf.Bytes() + + key := append([]byte("bk-")[:], hash[:]...) + if err := db.Put(key, bs, nil); err != nil { + log.Crit("Failed to store block", "err", err) + return nil // Do we want to force an exit here? + } + return nil +} + +func WriteTransactions(db *leveldb.DB, tx *types.Transaction, blockHash common.Hash) string { + txData := ShyftTxEntry{ + TxHash: tx.Hash(), + To: tx.To(), + From: tx.From(), + BlockHash: blockHash, + Amount: tx.Value(), + GasPrice: tx.GasPrice(), + Gas: tx.Gas(), + Nonce: tx.Nonce(), + Data: tx.Data(), + } + var encodedData bytes.Buffer + encoder := gob.NewEncoder(&encodedData) + if err := encoder.Encode(txData); err != nil { + log.Crit("Faild to encode TX data", "err", err) + } + key := append([]byte("tx-")[:], tx.Hash().Bytes()[:]...) + if err := db.Put(key, encodedData.Bytes(), nil); err != nil { + log.Crit("Failed to store TX", "err", err) + } + GetTransaction(db, tx) + GetAllTransactions(db) + return tx.Hash().String() +} + +// Meant for internal tests +func GetAllBlocks(db *leveldb.DB) []SBlock{ + var arr []SBlock + iter := db.NewIterator(util.BytesPrefix([]byte("bk-")), nil) + for iter.Next() { + result := iter.Value() + buf := bytes.NewBuffer(result) + strs2 := []string{} + gob.NewDecoder(buf).Decode(&strs2) + //fmt.Println("the key is") + hash := common.BytesToHash(iter.Key()) + hex := hash.Hex() + //fmt.Println(hex) + sblock := SBlock{hex, strs2} + arr = append(arr, sblock) + + //fmt.Println("\n ALL BK BK VALUE" + string(result)) + } + + iter.Release() + return arr +} + +func GetBlock(db *leveldb.DB, block *types.Block) []byte { + hash := block.Header().Hash().Bytes() + key := append([]byte("bk-")[:], hash[:]...) + data, err := db.Get(key, nil) + if err != nil { + log.Crit("Could not retrieve block", "err", err) + } + fmt.Println("\nBLOCK Value: " + string(data)) + return data +} + +func GetAllTransactions(db *leveldb.DB) { + iter := db.NewIterator(util.BytesPrefix([]byte("tx-")), nil) + for iter.Next() { + var txData ShyftTxEntry + d := gob.NewDecoder(bytes.NewBuffer(iter.Value())) + if err := d.Decode(&txData); err != nil { + log.Crit("Failed to decode tx:", "err", err) + } + fmt.Println("DECODED TX") + fmt.Println("Tx Hash: ", txData.TxHash.Hex()) + fmt.Println("From: ", txData.From.Hex()) + fmt.Println("To: ", txData.To.Hex()) + fmt.Println("BlockHash: ", txData.BlockHash.Hex()) + fmt.Println("Amount: ", txData.Amount) + fmt.Println("Gas: ", txData.Gas) + fmt.Println("GasPrice: ", txData.GasPrice) + fmt.Println("Nonce: ", txData.Nonce) + fmt.Println("Data: ", txData.Data) + } + iter.Release() +} + +func GetTransaction (db *leveldb.DB, tx *types.Transaction) { + key := append([]byte("tx-")[:], tx.Hash().Bytes()[:]...) + data, err := db.Get(key, nil) + if err != nil { + log.Crit("Could not retrieve TX", "err", err) + } + if len(data) > 0 { + var txData ShyftTxEntry + d := gob.NewDecoder(bytes.NewBuffer(data)) + if err := d.Decode(&txData); err != nil { + log.Crit("Failed to decode tx:", "err", err) + } + fmt.Println("DECODED TX") + fmt.Println("Tx Hash: ", txData.TxHash.Hex()) + fmt.Println("From: ", txData.From.Hex()) + fmt.Println("To: ", txData.To.Hex()) + fmt.Println("BlockHash: ", txData.BlockHash.Hex()) + fmt.Println("Amount: ", txData.Amount) + fmt.Println("Gas: ", txData.Gas) + fmt.Println("GasPrice: ", txData.GasPrice) + fmt.Println("Nonce: ", txData.Nonce) + fmt.Println("Data: ", txData.Data) + } +} \ No newline at end of file diff --git a/simulations/checkbalances.js b/simulations/checkbalances.js new file mode 100644 index 0000000000..7719e5f24f --- /dev/null +++ b/simulations/checkbalances.js @@ -0,0 +1,4 @@ +console.log("Checking balances...") +for(i = 0; i < web3.eth.accounts.length; i++){ + console.log(web3.eth.accounts[i] + ":" + web3.eth.getBalance(web3.eth.accounts[i])) +} diff --git a/simulations/deployContract.js b/simulations/deployContract.js new file mode 100644 index 0000000000..109a58febf --- /dev/null +++ b/simulations/deployContract.js @@ -0,0 +1,27 @@ +// using contract from https://www.ethereum.org/greeter +// compiled on remix + +var _greeting = "Greeter Contract" ; +var greeterContract = web3.eth.contract([{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_greeting","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}]); +var greeter = greeterContract.new( + _greeting, + { + from: web3.eth.accounts[0], + data: '0x6060604052341561000f57600080fd5b6040516103a93803806103a983398101604052808051820191905050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508060019080519060200190610081929190610088565b505061012d565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100c957805160ff19168380011785556100f7565b828001600101855582156100f7579182015b828111156100f65782518255916020019190600101906100db565b5b5090506101049190610108565b5090565b61012a91905b8082111561012657600081600090555060010161010e565b5090565b90565b61026d8061013c6000396000f30060606040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806341c0e1b514610051578063cfae321714610066575b600080fd5b341561005c57600080fd5b6100646100f4565b005b341561007157600080fd5b610079610185565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100b957808201518184015260208101905061009e565b50505050905090810190601f1680156100e65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610183576000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b565b61018d61022d565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102235780601f106101f857610100808354040283529160200191610223565b820191906000526020600020905b81548152906001019060200180831161020657829003601f168201915b5050505050905090565b6020604051908101604052806000815250905600a165627a7a7230582015882dcaabcda0ebdb1b26a10e36f26a424e148671f4703dde3c1956ebaa67830029', + gas: '4700000' + }, function (e, contract){ + if(!e) { + // NOTE: The callback will fire twice! + // Once the contract has the transactionHash property set and once its deployed on an address. + // e.g. check tx hash on the first call (transaction send) + if(!contract.address) { + console.log("TX hash:") + console.log(contract.transactionHash) // The hash of the transaction, which deploys the contract + + } else { + console.log("Contract address:") + console.log(contract.address) // the contract address + } + + } + }) diff --git a/simulations/getGreeting.js b/simulations/getGreeting.js new file mode 100644 index 0000000000..7cc8986c2e --- /dev/null +++ b/simulations/getGreeting.js @@ -0,0 +1,7 @@ +var abi = [{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_greeting","type":"string"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}] + +function getGreeting(address){ + var MyContract = web3.eth.contract(abi); + var myContractInstance = MyContract.at(address); + console.log(myContractInstance.greet()) +} diff --git a/simulations/sendTransactions.js b/simulations/sendTransactions.js new file mode 100644 index 0000000000..9f01473ee7 --- /dev/null +++ b/simulations/sendTransactions.js @@ -0,0 +1,30 @@ +var firstAccount = web3.eth.accounts[0] +var secondAccount = web3.eth.accounts[1] +var thirdAccount = web3.eth.accounts[2] + +for (var i = 0; i < 1; i++) { + console.log('\t\t' + (i + 1) + ' - Transactions') + web3.eth.sendTransaction({ + from: web3.eth.accounts[0], + to: web3.eth.accounts[1], + value: 623, + gas: 50000, + gasPrice: 20 + }); + + web3.eth.sendTransaction({ + from: web3.eth.accounts[0], + to: web3.eth.accounts[2], + value: 291, + gas: 50000, + gasPrice: 20 + }); + + web3.eth.sendTransaction({ + from: web3.eth.accounts[1], + to: web3.eth.accounts[3], + value: 53039, + gas: 50000, + gasPrice: 20 + }); +} \ No newline at end of file