mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 14:16:44 +00:00
swarm/api: add default ENS tld registrar deployed on the toynet
This commit is contained in:
parent
14ac2cba72
commit
2ef669bcc4
3 changed files with 14 additions and 4 deletions
|
|
@ -8,17 +8,22 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"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/network"
|
||||||
"github.com/ethereum/go-ethereum/swarm/services/swap"
|
"github.com/ethereum/go-ethereum/swarm/services/swap"
|
||||||
"github.com/ethereum/go-ethereum/swarm/storage"
|
"github.com/ethereum/go-ethereum/swarm/storage"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
port = "8500"
|
port = "8500"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// by default ens root is north internal
|
||||||
|
var (
|
||||||
|
toyNetEnsRoot = common.HexToAddress("0xd422f059c2ea8e423a55b043ba427f43bf50a139")
|
||||||
|
)
|
||||||
|
|
||||||
// separate bzz directories
|
// separate bzz directories
|
||||||
// allow several bzz nodes running in parallel
|
// allow several bzz nodes running in parallel
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
|
@ -61,6 +66,7 @@ func NewConfig(path string, contract common.Address, prvKey *ecdsa.PrivateKey) (
|
||||||
Swap: swap.DefaultSwapParams(contract, prvKey),
|
Swap: swap.DefaultSwapParams(contract, prvKey),
|
||||||
PublicKey: pubkeyhex,
|
PublicKey: pubkeyhex,
|
||||||
BzzKey: keyhex,
|
BzzKey: keyhex,
|
||||||
|
EnsRoot: toyNetEnsRoot,
|
||||||
}
|
}
|
||||||
data, err = ioutil.ReadFile(confpath)
|
data, err = ioutil.ReadFile(confpath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -89,6 +95,10 @@ func NewConfig(path string, contract common.Address, prvKey *ecdsa.PrivateKey) (
|
||||||
}
|
}
|
||||||
self.Swap.SetKey(prvKey)
|
self.Swap.SetKey(prvKey)
|
||||||
|
|
||||||
|
if (self.EnsRoot == common.Address{}) {
|
||||||
|
self.EnsRoot = toyNetEnsRoot
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ var (
|
||||||
"Port": "8500",
|
"Port": "8500",
|
||||||
"PublicKey": "0x045f5cfd26692e48d0017d380349bcf50982488bc11b5145f3ddf88b24924299048450542d43527fbe29a5cb32f38d62755393ac002e6bfdd71b8d7ba725ecd7a3",
|
"PublicKey": "0x045f5cfd26692e48d0017d380349bcf50982488bc11b5145f3ddf88b24924299048450542d43527fbe29a5cb32f38d62755393ac002e6bfdd71b8d7ba725ecd7a3",
|
||||||
"BzzKey": "0xe861964402c0b78e2d44098329b8545726f215afa737d803714a4338552fcb81",
|
"BzzKey": "0xe861964402c0b78e2d44098329b8545726f215afa737d803714a4338552fcb81",
|
||||||
"EnsRoot": "0x0000000000000000000000000000000000000000"
|
"EnsRoot": "0xd422f059c2ea8e423a55b043ba427f43bf50a139"
|
||||||
}`
|
}`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ func NewSwarm(ctx *node.ServiceContext, config *api.Config, swapEnabled, syncEna
|
||||||
transactOpts := bind.NewKeyedTransactor(self.privateKey)
|
transactOpts := bind.NewKeyedTransactor(self.privateKey)
|
||||||
// backend := ethereum.ContractBackend()
|
// backend := ethereum.ContractBackend()
|
||||||
self.dns = ens.NewENS(transactOpts, config.EnsRoot, self.backend)
|
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)
|
self.api = api.NewApi(self.dpa, self.dns)
|
||||||
// Manifests for Smart Hosting
|
// Manifests for Smart Hosting
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue