fix private key constant

pull/504/head
Minh Doan 6 years ago committed by Minh Doan
parent 93c94c4bd9
commit 269e4f6119
  1. 23
      internal/utils/contract/constants.go
  2. 3
      node/contract.go

@ -1,7 +1,9 @@
package contract
import (
"github.com/ethereum/go-ethereum/common"
"crypto/ecdsa"
"strings"
"github.com/ethereum/go-ethereum/crypto"
)
@ -12,15 +14,22 @@ type DeployAccount struct {
Public string
}
// GenesisBeaconAccount is the account which creates contract account.
var GenesisBeaconAccount = DeployAccount{
Address: "0x4e464afF0aB44780fC9A008AC890047BcbDf376f",
Private: "b167c74da42202fc2093f8e2ed8171b4ad67d095595ac655fc56df236cad9714",
Public: "0x4e464afF0aB44780fC9A008AC890047BcbDf376f",
// // GenesisBeaconAccount is the account which creates contract account.
// var GenesisBeaconAccount = DeployAccount{
// Address: "0x4e464afF0aB44780fC9A008AC890047BcbDf376f",
// Private: "b167c74da42202fc2093f8e2ed8171b4ad67d095595ac655fc56df236cad9714",
// Public: "0x4e464afF0aB44780fC9A008AC890047BcbDf376f",
// }
func BeaconAccountPriKey() *ecdsa.PrivateKey {
prikey, _ := ecdsa.GenerateKey(crypto.S256(), strings.NewReader("Deposit Smart Contract Key"))
return prikey
}
var GenesisBeaconAccountPriKey = BeaconAccountPriKey()
// DeployedContractAddress is the deployed contract address of the staking smart contract in beacon chain.
var DeployedContractAddress = crypto.CreateAddress(common.HexToAddress(GenesisBeaconAccount.Address), uint64(0))
var DeployedContractAddress = crypto.CreateAddress(crypto.PubkeyToAddress(GenesisBeaconAccountPriKey.PublicKey), uint64(0))
// FakeAccounts is the accounts only used for development purpose.
var FakeAccounts = [...]DeployAccount{

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/params"
"github.com/harmony-one/harmony/core/types"
"github.com/harmony-one/harmony/internal/utils/contract"
contract_constants "github.com/harmony-one/harmony/internal/utils/contract"
"golang.org/x/crypto/sha3"
)
@ -27,7 +28,7 @@ const (
func (node *Node) AddStakingContractToPendingTransactions() {
// Add a contract deployment transaction
//Generate contract key and associate funds with the smart contract
priKey, _ := ecdsa.GenerateKey(crypto.S256(), strings.NewReader("Deposit Smart Contract Key"))
priKey := contract_constants.GenesisBeaconAccountPriKey
contractAddress := crypto.PubkeyToAddress(priKey.PublicKey)
//Initially the smart contract should have minimal funds.
contractFunds := big.NewInt(0)

Loading…
Cancel
Save