Skip to content

Commit 2ef669b

Browse files
committed
swarm/api: add default ENS tld registrar deployed on the toynet
1 parent 14ac2cb commit 2ef669b

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

swarm/api/config.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,22 @@ import (
88
"os"
99
"path/filepath"
1010

11+
"github.com/ethereum/go-ethereum/common"
12+
"github.com/ethereum/go-ethereum/crypto"
1113
"github.com/ethereum/go-ethereum/swarm/network"
1214
"github.com/ethereum/go-ethereum/swarm/services/swap"
1315
"github.com/ethereum/go-ethereum/swarm/storage"
14-
"github.com/ethereum/go-ethereum/common"
15-
"github.com/ethereum/go-ethereum/crypto"
1616
)
1717

1818
const (
1919
port = "8500"
2020
)
2121

22+
// by default ens root is north internal
23+
var (
24+
toyNetEnsRoot = common.HexToAddress("0xd422f059c2ea8e423a55b043ba427f43bf50a139")
25+
)
26+
2227
// separate bzz directories
2328
// allow several bzz nodes running in parallel
2429
type Config struct {
@@ -61,6 +66,7 @@ func NewConfig(path string, contract common.Address, prvKey *ecdsa.PrivateKey) (
6166
Swap: swap.DefaultSwapParams(contract, prvKey),
6267
PublicKey: pubkeyhex,
6368
BzzKey: keyhex,
69+
EnsRoot: toyNetEnsRoot,
6470
}
6571
data, err = ioutil.ReadFile(confpath)
6672
if err != nil {
@@ -89,6 +95,10 @@ func NewConfig(path string, contract common.Address, prvKey *ecdsa.PrivateKey) (
8995
}
9096
self.Swap.SetKey(prvKey)
9197

98+
if (self.EnsRoot == common.Address{}) {
99+
self.EnsRoot = toyNetEnsRoot
100+
}
101+
92102
return
93103
}
94104

swarm/api/config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ var (
6767
"Port": "8500",
6868
"PublicKey": "0x045f5cfd26692e48d0017d380349bcf50982488bc11b5145f3ddf88b24924299048450542d43527fbe29a5cb32f38d62755393ac002e6bfdd71b8d7ba725ecd7a3",
6969
"BzzKey": "0xe861964402c0b78e2d44098329b8545726f215afa737d803714a4338552fcb81",
70-
"EnsRoot": "0x0000000000000000000000000000000000000000"
70+
"EnsRoot": "0xd422f059c2ea8e423a55b043ba427f43bf50a139"
7171
}`
7272
)
7373

swarm/swarm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func NewSwarm(ctx *node.ServiceContext, config *api.Config, swapEnabled, syncEna
140140
transactOpts := bind.NewKeyedTransactor(self.privateKey)
141141
// backend := ethereum.ContractBackend()
142142
self.dns = ens.NewENS(transactOpts, config.EnsRoot, self.backend)
143-
glog.V(logger.Debug).Infof("[BZZ] -> Swarm Domain Name Registrar @ address %v", config.EnsRoot)
143+
glog.V(logger.Debug).Infof("[BZZ] -> Swarm Domain Name Registrar @ address %v", config.EnsRoot.Hex())
144144

145145
self.api = api.NewApi(self.dpa, self.dns)
146146
// Manifests for Smart Hosting

0 commit comments

Comments
 (0)