mirror of https://github.com/poanetwork/quorum.git
merge with node key changes
This commit is contained in:
commit
2363ef5769
|
@ -26,7 +26,8 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
)
|
"github.com/ethereum/go-ethereum/accounts"
|
||||||
|
)
|
||||||
|
|
||||||
// NewTransactor is a utility method to easily create a transaction signer from
|
// NewTransactor is a utility method to easily create a transaction signer from
|
||||||
// an encrypted json key stream and the associated passphrase.
|
// an encrypted json key stream and the associated passphrase.
|
||||||
|
@ -60,3 +61,17 @@ func NewKeyedTransactor(key *ecdsa.PrivateKey) *TransactOpts {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func NewWalletTransactor(w accounts.Wallet, from accounts.Account) *TransactOpts {
|
||||||
|
return &TransactOpts{
|
||||||
|
From: from.Address,
|
||||||
|
Signer: func(signer types.Signer, address common.Address, tx *types.Transaction) (*types.Transaction, error) {
|
||||||
|
signature, err := w.SignHash(from, signer.Hash(tx).Bytes())
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return tx.WithSignature(signer, signature)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
// Code generated - DO NOT EDIT.
|
// Code generated - DO NOT EDIT.
|
||||||
// This file is a generated binding and any manual changes will be lost.
|
// This file is a generated binding and any manual changes will be lost.
|
||||||
|
|
||||||
package cluster
|
package bind
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
File diff suppressed because one or more lines are too long
|
@ -8,6 +8,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
"github.com/ethereum/go-ethereum/node"
|
"github.com/ethereum/go-ethereum/node"
|
||||||
"github.com/ethereum/go-ethereum/controls"
|
"github.com/ethereum/go-ethereum/controls"
|
||||||
|
pbind "github.com/ethereum/go-ethereum/controls/bind"
|
||||||
)
|
)
|
||||||
|
|
||||||
type OrgKeyCtrl struct {
|
type OrgKeyCtrl struct {
|
||||||
|
@ -27,7 +28,7 @@ func NewOrgKeyCtrl(node *node.Node) (*OrgKeyCtrl, error) {
|
||||||
// the permissiones contract deployed as a precompile via genesis.json
|
// the permissiones contract deployed as a precompile via genesis.json
|
||||||
func (k *OrgKeyCtrl) Start() error {
|
func (k *OrgKeyCtrl) Start() error {
|
||||||
|
|
||||||
_, err := NewClusterFilterer(params.PrivateKeyManagementContract, k.ethClient)
|
_, err := pbind.NewClusterFilterer(params.QuorumPrivateKeyManagementContract, k.ethClient)
|
||||||
// check if permissioning contract is there at address. If not return from here
|
// check if permissioning contract is there at address. If not return from here
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Cluster not enabled for the network : ", "err", err)
|
log.Error("Cluster not enabled for the network : ", "err", err)
|
||||||
|
@ -49,7 +50,7 @@ func (k *OrgKeyCtrl) manageClusterKeys() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (k *OrgKeyCtrl) populatePrivateKeys() error {
|
func (k *OrgKeyCtrl) populatePrivateKeys() error {
|
||||||
cluster, err := NewClusterFilterer(params.PrivateKeyManagementContract, k.ethClient)
|
cluster, err := pbind.NewClusterFilterer(params.QuorumPrivateKeyManagementContract, k.ethClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to monitor node delete: ", "err", err)
|
log.Error("Failed to monitor node delete: ", "err", err)
|
||||||
return err
|
return err
|
||||||
|
@ -86,16 +87,16 @@ func (k *OrgKeyCtrl) monitorKeyChanges() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (k *OrgKeyCtrl) monitorKeyAdd() {
|
func (k *OrgKeyCtrl) monitorKeyAdd() {
|
||||||
cluster, err := NewClusterFilterer(params.PrivateKeyManagementContract, k.ethClient)
|
cluster, err := pbind.NewClusterFilterer(params.QuorumPrivateKeyManagementContract, k.ethClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to monitor Account cluster : ", "err", err)
|
log.Error("Failed to monitor Account cluster : ", "err", err)
|
||||||
}
|
}
|
||||||
ch := make(chan *ClusterOrgKeyAdded)
|
ch := make(chan *pbind.ClusterOrgKeyAdded)
|
||||||
|
|
||||||
opts := &bind.WatchOpts{}
|
opts := &bind.WatchOpts{}
|
||||||
var blockNumber uint64 = 1
|
var blockNumber uint64 = 1
|
||||||
opts.Start = &blockNumber
|
opts.Start = &blockNumber
|
||||||
var newEvent *ClusterOrgKeyAdded
|
var newEvent *pbind.ClusterOrgKeyAdded
|
||||||
|
|
||||||
_, err = cluster.WatchOrgKeyAdded(opts, ch)
|
_, err = cluster.WatchOrgKeyAdded(opts, ch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -111,16 +112,16 @@ func (k *OrgKeyCtrl) monitorKeyAdd() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (k *OrgKeyCtrl) monitorKeyDelete() {
|
func (k *OrgKeyCtrl) monitorKeyDelete() {
|
||||||
cluster, err := NewClusterFilterer(params.PrivateKeyManagementContract, k.ethClient)
|
cluster, err := pbind.NewClusterFilterer(params.QuorumPrivateKeyManagementContract, k.ethClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to monitor Account cluster : ", "err", err)
|
log.Error("Failed to monitor Account cluster : ", "err", err)
|
||||||
}
|
}
|
||||||
ch := make(chan *ClusterOrgKeyDeleted)
|
ch := make(chan *pbind.ClusterOrgKeyDeleted)
|
||||||
|
|
||||||
opts := &bind.WatchOpts{}
|
opts := &bind.WatchOpts{}
|
||||||
var blockNumber uint64 = 1
|
var blockNumber uint64 = 1
|
||||||
opts.Start = &blockNumber
|
opts.Start = &blockNumber
|
||||||
var newEvent *ClusterOrgKeyDeleted
|
var newEvent *pbind.ClusterOrgKeyDeleted
|
||||||
|
|
||||||
_, err = cluster.WatchOrgKeyDeleted(opts, ch)
|
_, err = cluster.WatchOrgKeyDeleted(opts, ch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -87,6 +87,11 @@ contract Permissions {
|
||||||
/* public and external functions */
|
/* public and external functions */
|
||||||
// view functions
|
// view functions
|
||||||
|
|
||||||
|
// Get number of nodes
|
||||||
|
function getNumberofVoters() public view returns (uint)
|
||||||
|
{
|
||||||
|
return accountList.length;
|
||||||
|
}
|
||||||
// Get number of nodes
|
// Get number of nodes
|
||||||
function getNetworkBootStatus() public view returns (bool)
|
function getNetworkBootStatus() public view returns (bool)
|
||||||
{
|
{
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -22,7 +22,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/controls"
|
"github.com/ethereum/go-ethereum/controls"
|
||||||
"github.com/ethereum/go-ethereum/cmd/utils"
|
"github.com/ethereum/go-ethereum/cmd/utils"
|
||||||
"github.com/ethereum/go-ethereum/raft"
|
"github.com/ethereum/go-ethereum/raft"
|
||||||
"github.com/ethereum/go-ethereum/controls/permbind"
|
pbind "github.com/ethereum/go-ethereum/controls/bind"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -63,7 +63,7 @@ func NewQuorumPermissionCtrl(stack *node.Node, isRaft bool) (*PermissionCtrl, er
|
||||||
func (p *PermissionCtrl) Start() error {
|
func (p *PermissionCtrl) Start() error {
|
||||||
|
|
||||||
// check if permissioning contract is there at address. If not return from here
|
// check if permissioning contract is there at address. If not return from here
|
||||||
if _, err := permbind.NewPermissionsFilterer(params.QuorumPermissionsContract, p.ethClnt); err != nil {
|
if _, err := pbind.NewPermissionsFilterer(params.QuorumPermissionsContract, p.ethClnt); err != nil {
|
||||||
log.Error("Permissions not enabled for the network : ", "err", err)
|
log.Error("Permissions not enabled for the network : ", "err", err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -117,17 +117,17 @@ func (p *PermissionCtrl) manageNodePermissions() {
|
||||||
// This functions listens on the channel for new node approval via smart contract and
|
// This functions listens on the channel for new node approval via smart contract and
|
||||||
// adds the same into permissioned-nodes.json
|
// adds the same into permissioned-nodes.json
|
||||||
func (p *PermissionCtrl) monitorNewNodeAdd() {
|
func (p *PermissionCtrl) monitorNewNodeAdd() {
|
||||||
permissions, err := permbind.NewPermissionsFilterer(params.QuorumPermissionsContract, p.ethClnt)
|
permissions, err := pbind.NewPermissionsFilterer(params.QuorumPermissionsContract, p.ethClnt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("failed to monitor new node add : ", "err", err)
|
log.Error("failed to monitor new node add : ", "err", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ch := make(chan *permbind.PermissionsNodeApproved, 1)
|
ch := make(chan *pbind.PermissionsNodeApproved, 1)
|
||||||
|
|
||||||
opts := &bind.WatchOpts{}
|
opts := &bind.WatchOpts{}
|
||||||
var blockNumber uint64 = 1
|
var blockNumber uint64 = 1
|
||||||
opts.Start = &blockNumber
|
opts.Start = &blockNumber
|
||||||
var nodeAddEvent *permbind.PermissionsNodeApproved
|
var nodeAddEvent *pbind.PermissionsNodeApproved
|
||||||
|
|
||||||
_, err = permissions.WatchNodeApproved(opts, ch)
|
_, err = permissions.WatchNodeApproved(opts, ch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -145,17 +145,17 @@ func (p *PermissionCtrl) monitorNewNodeAdd() {
|
||||||
// This functions listens on the channel for new node approval via smart contract and
|
// This functions listens on the channel for new node approval via smart contract and
|
||||||
// adds the same into permissioned-nodes.json
|
// adds the same into permissioned-nodes.json
|
||||||
func (p *PermissionCtrl) monitorNodeDeactivation() {
|
func (p *PermissionCtrl) monitorNodeDeactivation() {
|
||||||
permissions, err := permbind.NewPermissionsFilterer(params.QuorumPermissionsContract, p.ethClnt)
|
permissions, err := pbind.NewPermissionsFilterer(params.QuorumPermissionsContract, p.ethClnt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to monitor node delete: ", "err", err)
|
log.Error("Failed to monitor node delete: ", "err", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ch := make(chan *permbind.PermissionsNodeDeactivated)
|
ch := make(chan *pbind.PermissionsNodeDeactivated)
|
||||||
|
|
||||||
opts := &bind.WatchOpts{}
|
opts := &bind.WatchOpts{}
|
||||||
var blockNumber uint64 = 1
|
var blockNumber uint64 = 1
|
||||||
opts.Start = &blockNumber
|
opts.Start = &blockNumber
|
||||||
var newNodeDeleteEvent *permbind.PermissionsNodeDeactivated
|
var newNodeDeleteEvent *pbind.PermissionsNodeDeactivated
|
||||||
|
|
||||||
_, err = permissions.WatchNodeDeactivated(opts, ch)
|
_, err = permissions.WatchNodeDeactivated(opts, ch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -174,16 +174,16 @@ func (p *PermissionCtrl) monitorNodeDeactivation() {
|
||||||
// This function listnes on the channel for any node blacklisting event via smart contract
|
// This function listnes on the channel for any node blacklisting event via smart contract
|
||||||
// and adds the same disallowed-nodes.json
|
// and adds the same disallowed-nodes.json
|
||||||
func (p *PermissionCtrl) monitorNodeBlacklisting() {
|
func (p *PermissionCtrl) monitorNodeBlacklisting() {
|
||||||
permissions, err := permbind.NewPermissionsFilterer(params.QuorumPermissionsContract, p.ethClnt)
|
permissions, err := pbind.NewPermissionsFilterer(params.QuorumPermissionsContract, p.ethClnt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("failed to monitor new node add : ", "err", err)
|
log.Error("failed to monitor new node add : ", "err", err)
|
||||||
}
|
}
|
||||||
ch := make(chan *permbind.PermissionsNodeBlacklisted, 1)
|
ch := make(chan *pbind.PermissionsNodeBlacklisted, 1)
|
||||||
|
|
||||||
opts := &bind.WatchOpts{}
|
opts := &bind.WatchOpts{}
|
||||||
var blockNumber uint64 = 1
|
var blockNumber uint64 = 1
|
||||||
opts.Start = &blockNumber
|
opts.Start = &blockNumber
|
||||||
var nodeBlacklistEvent *permbind.PermissionsNodeBlacklisted
|
var nodeBlacklistEvent *pbind.PermissionsNodeBlacklisted
|
||||||
|
|
||||||
_, err = permissions.WatchNodeBlacklisted(opts, ch)
|
_, err = permissions.WatchNodeBlacklisted(opts, ch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -227,7 +227,7 @@ func (p *PermissionCtrl) updatePermissionedNodes(enodeId, ipAddrPort, discPort,
|
||||||
}
|
}
|
||||||
|
|
||||||
//this function populates the new node information into the permissioned-nodes.json file
|
//this function populates the new node information into the permissioned-nodes.json file
|
||||||
func (p *PermissionCtrl) updateDisallowedNodes(nodeBlacklistEvent *permbind.PermissionsNodeBlacklisted) {
|
func (p *PermissionCtrl) updateDisallowedNodes(nodeBlacklistEvent *pbind.PermissionsNodeBlacklisted) {
|
||||||
dataDir := p.node.InstanceDir()
|
dataDir := p.node.InstanceDir()
|
||||||
log.Debug("updateDisallowedNodes", "DataDir", dataDir, "file", BLACKLIST_CONFIG)
|
log.Debug("updateDisallowedNodes", "DataDir", dataDir, "file", BLACKLIST_CONFIG)
|
||||||
|
|
||||||
|
@ -283,7 +283,7 @@ func (p *PermissionCtrl) manageAccountPermissions() error {
|
||||||
// populates the nodes list from permissioned-nodes.json into the permissions
|
// populates the nodes list from permissioned-nodes.json into the permissions
|
||||||
// smart contract
|
// smart contract
|
||||||
func (p *PermissionCtrl) populatePermissionedNodes() error {
|
func (p *PermissionCtrl) populatePermissionedNodes() error {
|
||||||
permissions, err := permbind.NewPermissionsFilterer(params.QuorumPermissionsContract, p.ethClnt)
|
permissions, err := pbind.NewPermissionsFilterer(params.QuorumPermissionsContract, p.ethClnt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to monitor node delete: ", "err", err)
|
log.Error("Failed to monitor node delete: ", "err", err)
|
||||||
return err
|
return err
|
||||||
|
@ -316,7 +316,7 @@ func (p *PermissionCtrl) populatePermissionedNodes() error {
|
||||||
// populates the nodes list from permissioned-nodes.json into the permissions
|
// populates the nodes list from permissioned-nodes.json into the permissions
|
||||||
// smart contract
|
// smart contract
|
||||||
func (p *PermissionCtrl) populateAcctPermissions() error {
|
func (p *PermissionCtrl) populateAcctPermissions() error {
|
||||||
permissions, err := permbind.NewPermissionsFilterer(params.QuorumPermissionsContract, p.ethClnt)
|
permissions, err := pbind.NewPermissionsFilterer(params.QuorumPermissionsContract, p.ethClnt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to monitor node delete: ", "err", err)
|
log.Error("Failed to monitor node delete: ", "err", err)
|
||||||
return err
|
return err
|
||||||
|
@ -338,16 +338,16 @@ func (p *PermissionCtrl) populateAcctPermissions() error {
|
||||||
// Monitors permissions changes at acount level and uodate the global permissions
|
// Monitors permissions changes at acount level and uodate the global permissions
|
||||||
// map with the same
|
// map with the same
|
||||||
func (p *PermissionCtrl) monitorAccountPermissions() {
|
func (p *PermissionCtrl) monitorAccountPermissions() {
|
||||||
permissions, err := permbind.NewPermissionsFilterer(params.QuorumPermissionsContract, p.ethClnt)
|
permissions, err := pbind.NewPermissionsFilterer(params.QuorumPermissionsContract, p.ethClnt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to monitor Account permissions : ", "err", err)
|
log.Error("Failed to monitor Account permissions : ", "err", err)
|
||||||
}
|
}
|
||||||
ch := make(chan *permbind.PermissionsAccountAccessModified)
|
ch := make(chan *pbind.PermissionsAccountAccessModified)
|
||||||
|
|
||||||
opts := &bind.WatchOpts{}
|
opts := &bind.WatchOpts{}
|
||||||
var blockNumber uint64 = 1
|
var blockNumber uint64 = 1
|
||||||
opts.Start = &blockNumber
|
opts.Start = &blockNumber
|
||||||
var newEvent *permbind.PermissionsAccountAccessModified
|
var newEvent *pbind.PermissionsAccountAccessModified
|
||||||
|
|
||||||
_, err = permissions.WatchAccountAccessModified(opts, ch)
|
_, err = permissions.WatchAccountAccessModified(opts, ch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -401,7 +401,7 @@ func formatEnodeId(enodeId, ipAddrPort, discPort, raftPort string, isRaft bool)
|
||||||
//smart contract
|
//smart contract
|
||||||
func (p *PermissionCtrl) populateStaticNodesToContract() {
|
func (p *PermissionCtrl) populateStaticNodesToContract() {
|
||||||
|
|
||||||
permissionsContract, err := permbind.NewPermissions(params.QuorumPermissionsContract, p.ethClnt)
|
permissionsContract, err := pbind.NewPermissions(params.QuorumPermissionsContract, p.ethClnt)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utils.Fatalf("Failed to instantiate a Permissions contract: %v", err)
|
utils.Fatalf("Failed to instantiate a Permissions contract: %v", err)
|
||||||
|
@ -411,7 +411,7 @@ func (p *PermissionCtrl) populateStaticNodesToContract() {
|
||||||
utils.Fatalf("Failed to create authorized transactor: %v", err)
|
utils.Fatalf("Failed to create authorized transactor: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
permissionsSession := &permbind.PermissionsSession{
|
permissionsSession := &pbind.PermissionsSession{
|
||||||
Contract: permissionsContract,
|
Contract: permissionsContract,
|
||||||
CallOpts: bind.CallOpts{
|
CallOpts: bind.CallOpts{
|
||||||
Pending: true,
|
Pending: true,
|
||||||
|
|
|
@ -1,143 +0,0 @@
|
||||||
package permission
|
|
||||||
/*
|
|
||||||
import (
|
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
|
||||||
"github.com/ethereum/go-ethereum/log"
|
|
||||||
"github.com/ethereum/go-ethereum/ethclient"
|
|
||||||
"github.com/ethereum/go-ethereum/eth"
|
|
||||||
"github.com/ethereum/go-ethereum/cmd/utils"
|
|
||||||
"github.com/ethereum/go-ethereum/params"
|
|
||||||
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
|
||||||
"strings"
|
|
||||||
"math/big"
|
|
||||||
"github.com/ethereum/go-ethereum/p2p/discover"
|
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"path/filepath"
|
|
||||||
"github.com/ethereum/go-ethereum/controls/permbind"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
func APIs(ec *ethclient.Client, e *eth.Ethereum, datadir string) []rpc.API {
|
|
||||||
return []rpc.API{
|
|
||||||
{
|
|
||||||
Namespace: "permnode",
|
|
||||||
Version: "1.0",
|
|
||||||
Service: NewPermissionAPI(ec, e, datadir),
|
|
||||||
Public: true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type PermissionAPI struct {
|
|
||||||
ethClient *ethclient.Client
|
|
||||||
eth *eth.Ethereum
|
|
||||||
permissionsContr *permbind.Permissions
|
|
||||||
transOpts *bind.TransactOpts
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func getKeyFromKeyStore(datadir string) string {
|
|
||||||
|
|
||||||
files, err := ioutil.ReadDir(filepath.Join(datadir, "keystore"))
|
|
||||||
if err != nil {
|
|
||||||
utils.Fatalf("Failed to read keystore directory: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// HACK: here we always use the first key as transactor
|
|
||||||
var keyPath string
|
|
||||||
for _, f := range files {
|
|
||||||
keyPath = filepath.Join(datadir, "keystore", f.Name())
|
|
||||||
break
|
|
||||||
}
|
|
||||||
keyBlob, err := ioutil.ReadFile(keyPath)
|
|
||||||
if err != nil {
|
|
||||||
utils.Fatalf("Failed to read key file: %v", err)
|
|
||||||
}
|
|
||||||
// n := bytes.IndexByte(keyBlob, 0)
|
|
||||||
n := len(keyBlob)
|
|
||||||
|
|
||||||
return string(keyBlob[:n])
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewPermissionAPI(ec *ethclient.Client, e *eth.Ethereum, datadir string) *PermissionAPI {
|
|
||||||
permissionsContract, err := permbind.NewPermissions(params.QuorumPermissionsContract, ec)
|
|
||||||
if err != nil {
|
|
||||||
utils.Fatalf("Failed to instantiate a Permissions contract: %v", err)
|
|
||||||
}
|
|
||||||
//TODO check if reading from keystore is correct approach
|
|
||||||
key := getKeyFromKeyStore(datadir)
|
|
||||||
auth, err := bind.NewTransactor(strings.NewReader(key), "")
|
|
||||||
if err != nil {
|
|
||||||
utils.Fatalf("Failed to create authorized transactor: %v", err)
|
|
||||||
}
|
|
||||||
return &PermissionAPI{ec, e, permissionsContract, auth}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *PermissionAPI) AddVoter(addr string) string {
|
|
||||||
log.Info("AJ-called1")
|
|
||||||
return "added voter " + addr
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *PermissionAPI) ProposeNode(enodeId string) string {
|
|
||||||
node, err := discover.ParseNode(enodeId)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Sprintf("invalid node id: %v", err)
|
|
||||||
}
|
|
||||||
enodeID := node.ID.String()
|
|
||||||
ipAddr := node.IP.String()
|
|
||||||
port := fmt.Sprintf("%v", node.TCP)
|
|
||||||
discPort := fmt.Sprintf("%v", node.UDP)
|
|
||||||
raftPort := fmt.Sprintf("%v", node.RaftPort)
|
|
||||||
ipAddrPort := ipAddr + ":" + port
|
|
||||||
|
|
||||||
log.Trace("AJ-Adding node to permissions contract", "enodeID", enodeID)
|
|
||||||
|
|
||||||
nonce := s.eth.TxPool().Nonce(s.transOpts.From)
|
|
||||||
s.transOpts.Nonce = new(big.Int).SetUint64(nonce)
|
|
||||||
|
|
||||||
permissionsSession := &permbind.PermissionsSession{
|
|
||||||
Contract: s.permissionsContr,
|
|
||||||
CallOpts: bind.CallOpts{
|
|
||||||
Pending: true,
|
|
||||||
},
|
|
||||||
TransactOpts: bind.TransactOpts{
|
|
||||||
From: s.transOpts.From,
|
|
||||||
Signer: s.transOpts.Signer,
|
|
||||||
GasLimit: 4700000,
|
|
||||||
GasPrice: big.NewInt(0),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
tx, err := permissionsSession.ProposeNode(enodeID, ipAddrPort, discPort, raftPort)
|
|
||||||
if err != nil {
|
|
||||||
log.Warn("AJ-Failed to propose node", "err", err)
|
|
||||||
}
|
|
||||||
statusMsg := fmt.Sprintf("Transaction pending tx hash %s", tx.Hash())
|
|
||||||
log.Debug(statusMsg)
|
|
||||||
return statusMsg
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *PermissionAPI) BlacklistNode(enodeId string) string {
|
|
||||||
log.Info("AJ-called3")
|
|
||||||
return "blacklisted node " + enodeId
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *PermissionAPI) RemoveNode(enodeId string) string {
|
|
||||||
log.Info("AJ-called4")
|
|
||||||
return "removed node " + enodeId
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *PermissionAPI) ApproveNode(enodeId string) string {
|
|
||||||
log.Info("AJ-called5")
|
|
||||||
return "approved node " + enodeId
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *PermissionAPI) ValidNodes() []string {
|
|
||||||
log.Info("AJ-called6")
|
|
||||||
return []string{"n1", "n2"}
|
|
||||||
}
|
|
||||||
*/
|
|
|
@ -0,0 +1,276 @@
|
||||||
|
package quorum
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/ethereum/go-ethereum/core"
|
||||||
|
"github.com/ethereum/go-ethereum/ethclient"
|
||||||
|
"io/ioutil"
|
||||||
|
"path/filepath"
|
||||||
|
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
||||||
|
"github.com/ethereum/go-ethereum/params"
|
||||||
|
"github.com/ethereum/go-ethereum/p2p/discover"
|
||||||
|
"fmt"
|
||||||
|
"math/big"
|
||||||
|
"github.com/ethereum/go-ethereum/log"
|
||||||
|
pbind "github.com/ethereum/go-ethereum/controls/bind"
|
||||||
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
"github.com/ethereum/go-ethereum/accounts"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
var defaultGasLimit = uint64(4700000)
|
||||||
|
var defaultGasPrice = big.NewInt(0)
|
||||||
|
|
||||||
|
type PermissionAPI struct {
|
||||||
|
txPool *core.TxPool
|
||||||
|
ethClnt *ethclient.Client
|
||||||
|
am *accounts.Manager
|
||||||
|
trnOpt *bind.TransactOpts
|
||||||
|
permContr *pbind.Permissions
|
||||||
|
clustContr *pbind.Cluster
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewPermissionAPI(tp *core.TxPool, am *accounts.Manager) *PermissionAPI {
|
||||||
|
pa := &PermissionAPI{tp, nil, am, nil, nil, nil}
|
||||||
|
return pa
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *PermissionAPI) Init(ethClnt *ethclient.Client, datadir string) error {
|
||||||
|
p.ethClnt = ethClnt
|
||||||
|
key, kerr := getKeyFromKeyStore(datadir)
|
||||||
|
if kerr != nil {
|
||||||
|
log.Error("error reading key file", "err", kerr)
|
||||||
|
return kerr
|
||||||
|
}
|
||||||
|
permContr, err := pbind.NewPermissions(params.QuorumPermissionsContract, p.ethClnt)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
p.permContr = permContr
|
||||||
|
clustContr, err := pbind.NewCluster(params.QuorumPrivateKeyManagementContract, p.ethClnt)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
p.clustContr = clustContr
|
||||||
|
auth, err := bind.NewTransactor(strings.NewReader(key), "")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
p.trnOpt = auth
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *PermissionAPI) AddVoter(addr common.Address) bool {
|
||||||
|
acct := accounts.Account{Address: addr}
|
||||||
|
w, err := s.am.Find(acct)
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
ps := s.newPermSession1(w, acct)
|
||||||
|
nonce := s.txPool.Nonce(acct.Address)
|
||||||
|
ps.TransactOpts.Nonce = new(big.Int).SetUint64(nonce)
|
||||||
|
|
||||||
|
tx, err := ps.AddVoter(addr)
|
||||||
|
if err != nil {
|
||||||
|
log.Warn("Failed to add voter", "err", err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
txHash := tx.Hash()
|
||||||
|
log.Info("Transaction pending", "tx hash", string(txHash[:]))
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *PermissionAPI) RemoveVoter(addr common.Address) bool {
|
||||||
|
ps := s.newPermSession()
|
||||||
|
tx, err := ps.RemoveVoter(addr)
|
||||||
|
if err != nil {
|
||||||
|
log.Warn("Failed to remove voter", "err", err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
txHash := tx.Hash()
|
||||||
|
log.Info("Transaction pending", "tx hash", string(txHash[:]))
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *PermissionAPI) ProposeNode(from common.Address, nodeId string) bool {
|
||||||
|
acct := accounts.Account{Address: from}
|
||||||
|
w, err := s.am.Find(acct)
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
ps := s.newPermSession1(w, acct)
|
||||||
|
nonce := s.txPool.Nonce(acct.Address)
|
||||||
|
ps.TransactOpts.Nonce = new(big.Int).SetUint64(nonce)
|
||||||
|
|
||||||
|
node, err := discover.ParseNode(nodeId)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("invalid node id: %v", err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
enodeID := node.ID.String()
|
||||||
|
ipAddr := node.IP.String()
|
||||||
|
port := fmt.Sprintf("%v", node.TCP)
|
||||||
|
discPort := fmt.Sprintf("%v", node.UDP)
|
||||||
|
raftPort := fmt.Sprintf("%v", node.RaftPort)
|
||||||
|
ipAddrPort := ipAddr + ":" + port
|
||||||
|
|
||||||
|
tx, err := ps.ProposeNode(enodeID, ipAddrPort, discPort, raftPort)
|
||||||
|
if err != nil {
|
||||||
|
log.Warn("Failed to propose node", "err", err)
|
||||||
|
log.Error("Failed to propose node: %v", err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
txHash := tx.Hash()
|
||||||
|
statusMsg := fmt.Sprintf("Transaction pending tx hash %s", string(txHash[:]))
|
||||||
|
log.Debug(statusMsg)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *PermissionAPI) ApproveNode(nodeId string) bool {
|
||||||
|
node, err := discover.ParseNode(nodeId)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("invalid node id: %v", err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
enodeID := node.ID.String()
|
||||||
|
|
||||||
|
ps := s.newPermSession()
|
||||||
|
tx, err := ps.ApproveNode(enodeID)
|
||||||
|
if err != nil {
|
||||||
|
log.Warn("Failed to propose node", "err", err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
txHash := tx.Hash()
|
||||||
|
log.Debug("Transaction pending", "tx hash", string(txHash[:]))
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *PermissionAPI) DeactivateNode(nodeId string) bool {
|
||||||
|
node, err := discover.ParseNode(nodeId)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("invalid node id: %v", err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
enodeID := node.ID.String()
|
||||||
|
|
||||||
|
ps := s.newPermSession()
|
||||||
|
tx, err := ps.DeactivateNode(enodeID)
|
||||||
|
if err != nil {
|
||||||
|
log.Warn("Failed to propose node", "err", err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
txHash := tx.Hash()
|
||||||
|
log.Debug("Transaction pending", "tx hash", string(txHash[:]))
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *PermissionAPI) ApproveDeactivateNode(nodeId string) bool {
|
||||||
|
node, err := discover.ParseNode(nodeId)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("invalid node id: %v", err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
enodeID := node.ID.String()
|
||||||
|
|
||||||
|
ps := s.newPermSession()
|
||||||
|
//TODO change it to approveDeactivate node once contract is updated
|
||||||
|
tx, err := ps.DeactivateNode(enodeID)
|
||||||
|
if err != nil {
|
||||||
|
log.Warn("Failed to propose node", "err", err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
txHash := tx.Hash()
|
||||||
|
log.Debug("Transaction pending", "tx hash", string(txHash[:]))
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *PermissionAPI) newPermSession() *pbind.PermissionsSession {
|
||||||
|
return &pbind.PermissionsSession{
|
||||||
|
Contract: s.permContr,
|
||||||
|
CallOpts: bind.CallOpts{
|
||||||
|
Pending: true,
|
||||||
|
},
|
||||||
|
TransactOpts: bind.TransactOpts{
|
||||||
|
From: s.trnOpt.From,
|
||||||
|
Signer: s.trnOpt.Signer,
|
||||||
|
GasLimit: defaultGasLimit,
|
||||||
|
GasPrice: defaultGasPrice,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *PermissionAPI) newPermSession1(w accounts.Wallet, acct accounts.Account) *pbind.PermissionsSession {
|
||||||
|
auth := bind.NewWalletTransactor(w, acct)
|
||||||
|
return &pbind.PermissionsSession{
|
||||||
|
Contract: s.permContr,
|
||||||
|
CallOpts: bind.CallOpts{
|
||||||
|
Pending: true,
|
||||||
|
},
|
||||||
|
TransactOpts: bind.TransactOpts{
|
||||||
|
From: acct.Address,
|
||||||
|
GasLimit: defaultGasLimit,
|
||||||
|
GasPrice: defaultGasPrice,
|
||||||
|
Signer: auth.Signer,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *PermissionAPI) newClusterSession() *pbind.ClusterSession {
|
||||||
|
return &pbind.ClusterSession{
|
||||||
|
Contract: s.clustContr,
|
||||||
|
CallOpts: bind.CallOpts{
|
||||||
|
Pending: true,
|
||||||
|
},
|
||||||
|
TransactOpts: bind.TransactOpts{
|
||||||
|
GasLimit: defaultGasLimit,
|
||||||
|
GasPrice: defaultGasPrice,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *PermissionAPI) AddOrgKey(orgId string, pvtKey string) bool {
|
||||||
|
cs := s.newClusterSession()
|
||||||
|
tx, err := cs.AddOrgKey(orgId, pvtKey)
|
||||||
|
if err != nil {
|
||||||
|
log.Warn("Failed to add org key", "err", err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
txHash := tx.Hash()
|
||||||
|
log.Info("Transaction pending", "tx hash", string(txHash[:]))
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *PermissionAPI) RemoveOrgKey(orgId string, pvtKey string) bool {
|
||||||
|
cs := s.newClusterSession()
|
||||||
|
tx, err := cs.DeleteOrgKey(orgId, pvtKey)
|
||||||
|
if err != nil {
|
||||||
|
log.Warn("Failed to remove org key", "err", err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
txHash := tx.Hash()
|
||||||
|
log.Info("Transaction pending", "tx hash", string(txHash[:]))
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func getKeyFromKeyStore(datadir string) (string, error) {
|
||||||
|
|
||||||
|
files, err := ioutil.ReadDir(filepath.Join(datadir, "keystore"))
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
// HACK: here we always use the first key as transactor
|
||||||
|
var keyPath string
|
||||||
|
for _, f := range files {
|
||||||
|
keyPath = filepath.Join(datadir, "keystore", f.Name())
|
||||||
|
break
|
||||||
|
}
|
||||||
|
keyBlob, err := ioutil.ReadFile(keyPath)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
n := len(keyBlob)
|
||||||
|
|
||||||
|
return string(keyBlob[:n]), nil
|
||||||
|
}
|
|
@ -1,111 +0,0 @@
|
||||||
package quorum
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/ethereum/go-ethereum/core"
|
|
||||||
"github.com/ethereum/go-ethereum/ethclient"
|
|
||||||
"io/ioutil"
|
|
||||||
"path/filepath"
|
|
||||||
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
|
||||||
"github.com/ethereum/go-ethereum/params"
|
|
||||||
"strings"
|
|
||||||
"github.com/ethereum/go-ethereum/p2p/discover"
|
|
||||||
"fmt"
|
|
||||||
"math/big"
|
|
||||||
"github.com/ethereum/go-ethereum/log"
|
|
||||||
"github.com/ethereum/go-ethereum/controls/permbind"
|
|
||||||
)
|
|
||||||
|
|
||||||
type PermissionAPI struct {
|
|
||||||
txPool *core.TxPool
|
|
||||||
ethClnt *ethclient.Client
|
|
||||||
permContr *permbind.Permissions
|
|
||||||
transOpts *bind.TransactOpts
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewPermissionAPI(e *core.TxPool) *PermissionAPI {
|
|
||||||
pa := &PermissionAPI{e, nil, nil, nil}
|
|
||||||
return pa
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *PermissionAPI) Init(ethClnt *ethclient.Client, datadir string) error {
|
|
||||||
p.ethClnt = ethClnt
|
|
||||||
key, kerr := getKeyFromKeyStore(datadir)
|
|
||||||
if kerr != nil {
|
|
||||||
log.Error("error reading key file", "err", kerr)
|
|
||||||
return kerr
|
|
||||||
}
|
|
||||||
|
|
||||||
permContr, err := permbind.NewPermissions(params.QuorumPermissionsContract, p.ethClnt)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
p.permContr = permContr
|
|
||||||
auth, err := bind.NewTransactor(strings.NewReader(key), "")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
p.transOpts = auth
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *PermissionAPI) ProposeNode(enodeId string) string {
|
|
||||||
node, err := discover.ParseNode(enodeId)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Sprintf("invalid node id: %v", err)
|
|
||||||
}
|
|
||||||
enodeID := node.ID.String()
|
|
||||||
ipAddr := node.IP.String()
|
|
||||||
port := fmt.Sprintf("%v", node.TCP)
|
|
||||||
discPort := fmt.Sprintf("%v", node.UDP)
|
|
||||||
raftPort := fmt.Sprintf("%v", node.RaftPort)
|
|
||||||
ipAddrPort := ipAddr + ":" + port
|
|
||||||
|
|
||||||
log.Trace("AJ-Adding node to permissions contract", "enodeID", enodeID)
|
|
||||||
|
|
||||||
nonce := s.txPool.Nonce(s.transOpts.From)
|
|
||||||
s.transOpts.Nonce = new(big.Int).SetUint64(nonce)
|
|
||||||
|
|
||||||
permissionsSession := &permbind.PermissionsSession{
|
|
||||||
Contract: s.permContr,
|
|
||||||
CallOpts: bind.CallOpts{
|
|
||||||
Pending: true,
|
|
||||||
},
|
|
||||||
TransactOpts: bind.TransactOpts{
|
|
||||||
From: s.transOpts.From,
|
|
||||||
Signer: s.transOpts.Signer,
|
|
||||||
GasLimit: 4700000,
|
|
||||||
GasPrice: big.NewInt(0),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
tx, err := permissionsSession.ProposeNode(enodeID, ipAddrPort, discPort, raftPort)
|
|
||||||
if err != nil {
|
|
||||||
log.Warn("AJ-Failed to propose node", "err", err)
|
|
||||||
}
|
|
||||||
statusMsg := fmt.Sprintf("Transaction pending tx hash %s", tx.Hash())
|
|
||||||
log.Debug(statusMsg)
|
|
||||||
return statusMsg
|
|
||||||
}
|
|
||||||
|
|
||||||
func getKeyFromKeyStore(datadir string) (string, error) {
|
|
||||||
|
|
||||||
files, err := ioutil.ReadDir(filepath.Join(datadir, "keystore"))
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
// HACK: here we always use the first key as transactor
|
|
||||||
var keyPath string
|
|
||||||
for _, f := range files {
|
|
||||||
keyPath = filepath.Join(datadir, "keystore", f.Name())
|
|
||||||
break
|
|
||||||
}
|
|
||||||
keyBlob, err := ioutil.ReadFile(keyPath)
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
n := len(keyBlob)
|
|
||||||
|
|
||||||
return string(keyBlob[:n]), nil
|
|
||||||
}
|
|
|
@ -328,9 +328,9 @@ func (s *Ethereum) APIs() []rpc.API {
|
||||||
Public: true,
|
Public: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Namespace: "permnode",
|
Namespace: "quorum",
|
||||||
Version: "1.0",
|
Version: "1.0",
|
||||||
Service: quorum.NewPermissionAPI(s.txPool),
|
Service: quorum.NewPermissionAPI(s.txPool, s.accountManager),
|
||||||
Public: true,
|
Public: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ var Modules = map[string]string{
|
||||||
"txpool": TxPool_JS,
|
"txpool": TxPool_JS,
|
||||||
"raft": Raft_JS,
|
"raft": Raft_JS,
|
||||||
"istanbul": Istanbul_JS,
|
"istanbul": Istanbul_JS,
|
||||||
"permnode": PermissionsNode_JS,
|
"quorum": QUORUM_JS,
|
||||||
}
|
}
|
||||||
|
|
||||||
const Chequebook_JS = `
|
const Chequebook_JS = `
|
||||||
|
@ -675,43 +675,56 @@ web3._extend({
|
||||||
})
|
})
|
||||||
`
|
`
|
||||||
|
|
||||||
const PermissionsNode_JS = `
|
const QUORUM_JS = `
|
||||||
web3._extend({
|
web3._extend({
|
||||||
property: 'permnode',
|
property: 'quorum',
|
||||||
methods:
|
methods:
|
||||||
[
|
[
|
||||||
],
|
],
|
||||||
properties:
|
properties:
|
||||||
[
|
[
|
||||||
new web3._extend.Method({
|
new web3._extend.Method({
|
||||||
name: 'blacklistNode',
|
name: 'addVoter',
|
||||||
call: 'permnode_blacklistNode',
|
call: 'quorum_addVoter',
|
||||||
params: 1
|
params: 1,
|
||||||
|
inputFormatter: [web3._extend.formatters.inputAddressFormatter]
|
||||||
}),
|
}),
|
||||||
new web3._extend.Method({
|
new web3._extend.Method({
|
||||||
name: 'addVoter',
|
name: 'removeVoter',
|
||||||
call: 'permnode_addVoter',
|
call: 'quorum_removeVoter',
|
||||||
params: 1
|
params: 1,
|
||||||
|
inputFormatter: [web3._extend.formatters.inputAddressFormatter]
|
||||||
}),
|
}),
|
||||||
new web3._extend.Method({
|
new web3._extend.Method({
|
||||||
name: 'proposeNode',
|
name: 'proposeNode',
|
||||||
call: 'permnode_proposeNode',
|
call: 'quorum_proposeNode',
|
||||||
params: 1
|
params: 2,
|
||||||
}),
|
inputFormatter: [web3._extend.formatters.inputAddressFormatter,null]
|
||||||
new web3._extend.Method({
|
|
||||||
name: 'removeNode',
|
|
||||||
call: 'permnode_removeNode',
|
|
||||||
params: 1
|
|
||||||
}),
|
}),
|
||||||
new web3._extend.Method({
|
new web3._extend.Method({
|
||||||
name: 'approveNode',
|
name: 'approveNode',
|
||||||
call: 'permnode_approveNode',
|
call: 'quorum_approveNode',
|
||||||
params: 1
|
params: 1
|
||||||
}),
|
}),
|
||||||
new web3._extend.Property({
|
new web3._extend.Method({
|
||||||
name: 'ValidNodes',
|
name: 'deactivateNode',
|
||||||
getter: 'permnode_validNodes',
|
call: 'quorum_deactivateNode',
|
||||||
params: 1
|
params: 1
|
||||||
|
}),
|
||||||
|
new web3._extend.Method({
|
||||||
|
name: 'approveDeactivateNode',
|
||||||
|
call: 'quorum_approveDeactivateNode',
|
||||||
|
params: 1
|
||||||
|
}),
|
||||||
|
new web3._extend.Method({
|
||||||
|
name: 'addOrgKey',
|
||||||
|
call: 'quorum_addOrgKey',
|
||||||
|
params: 2
|
||||||
|
}),
|
||||||
|
new web3._extend.Method({
|
||||||
|
name: 'removeOrgKey',
|
||||||
|
call: 'quorum_removeOrgKey',
|
||||||
|
params: 2
|
||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
|
@ -3,6 +3,6 @@ package params
|
||||||
import "github.com/ethereum/go-ethereum/common"
|
import "github.com/ethereum/go-ethereum/common"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
QuorumPermissionsContract = common.Address{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32}
|
QuorumPermissionsContract = common.Address{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32}
|
||||||
PrivateKeyManagementContract = common.Address{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34}
|
QuorumPrivateKeyManagementContract = common.Address{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue