swarm/api: add default ENS tld registrar deployed on the toynet

This commit is contained in:
zelig 2016-07-18 04:29:53 +02:00
parent 14ac2cba72
commit 2ef669bcc4
3 changed files with 14 additions and 4 deletions

View file

@ -8,17 +8,22 @@ import (
"os"
"path/filepath"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/swarm/network"
"github.com/ethereum/go-ethereum/swarm/services/swap"
"github.com/ethereum/go-ethereum/swarm/storage"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
)
const (
port = "8500"
)
// by default ens root is north internal
var (
toyNetEnsRoot = common.HexToAddress("0xd422f059c2ea8e423a55b043ba427f43bf50a139")
)
// separate bzz directories
// allow several bzz nodes running in parallel
type Config struct {
@ -61,6 +66,7 @@ func NewConfig(path string, contract common.Address, prvKey *ecdsa.PrivateKey) (
Swap: swap.DefaultSwapParams(contract, prvKey),
PublicKey: pubkeyhex,
BzzKey: keyhex,
EnsRoot: toyNetEnsRoot,
}
data, err = ioutil.ReadFile(confpath)
if err != nil {
@ -89,6 +95,10 @@ func NewConfig(path string, contract common.Address, prvKey *ecdsa.PrivateKey) (
}
self.Swap.SetKey(prvKey)
if (self.EnsRoot == common.Address{}) {
self.EnsRoot = toyNetEnsRoot
}
return
}

View file

@ -67,7 +67,7 @@ var (
"Port": "8500",
"PublicKey": "0x045f5cfd26692e48d0017d380349bcf50982488bc11b5145f3ddf88b24924299048450542d43527fbe29a5cb32f38d62755393ac002e6bfdd71b8d7ba725ecd7a3",
"BzzKey": "0xe861964402c0b78e2d44098329b8545726f215afa737d803714a4338552fcb81",
"EnsRoot": "0x0000000000000000000000000000000000000000"
"EnsRoot": "0xd422f059c2ea8e423a55b043ba427f43bf50a139"
}`
)

View file

@ -140,7 +140,7 @@ func NewSwarm(ctx *node.ServiceContext, config *api.Config, swapEnabled, syncEna
transactOpts := bind.NewKeyedTransactor(self.privateKey)
// backend := ethereum.ContractBackend()
self.dns = ens.NewENS(transactOpts, config.EnsRoot, self.backend)
glog.V(logger.Debug).Infof("[BZZ] -> Swarm Domain Name Registrar @ address %v", config.EnsRoot)
glog.V(logger.Debug).Infof("[BZZ] -> Swarm Domain Name Registrar @ address %v", config.EnsRoot.Hex())
self.api = api.NewApi(self.dpa, self.dns)
// Manifests for Smart Hosting