registrar

package
v3.0.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2016 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UrlHintCode = "" /* 412-byte string literal not displayed */

	UrlHintSrc = `` /* 276-byte string literal not displayed */

	HashRegCode = "" /* 330-byte string literal not displayed */

	HashRegSrc = `` /* 269-byte string literal not displayed */

	GlobalRegistrarSrc = `` /* 3672-byte string literal not displayed */

	GlobalRegistrarAbi = `` /* 2077-byte string literal not displayed */

	GlobalRegistrarCode = `` /* 5790-byte string literal not displayed */
)

Variables

View Source
var (
	// GlobalRegistrarAddr = "0xc6d9d2cd449a754c494264e1809c50e34d64562b" // olympic
	GlobalRegistrarAddr = "0x33990122638b9132ca29c723bdf037f1a891a70c" // frontier
	HashRegAddr         = "0x23bf622b5a65f6060d855fca401133ded3520620" // frontier
	UrlHintAddr         = "0x73ed5ef6c010727dfd2671dbb70faac19ec18626" // frontier

)

Registrar implements the Ethereum name registrar services mapping - arbitrary strings to ethereum addresses - hashes to hashes - hashes to arbitrary strings (likely will provide lookup service for all three)

The Registrar is used by * the roundtripper transport implementation of url schemes to resolve domain names and services that register these names * contract info retrieval (NatSpec).

The Registrar uses 3 contracts on the blockchain: * GlobalRegistrar: Name (string) -> Address (Owner) * HashReg : Key Hash (hash of domain name or contract code) -> Content Hash * UrlHint : Content Hash -> Url Hint

These contracts are (currently) not included in the genesis block. Each Set<X> needs to be called once on each blockchain/network once.

Contract addresses need to be set the first time any Registrar method is called in a client session. This is done for frontier by default, otherwise the caller needs to make sure the relevant environment initialised the desired contracts

View Source
var (
	HashRegName = "HashReg"
	UrlHintName = "UrlHint"
)

Functions

This section is empty.

Types

type Backend

type Backend interface {
	StorageAt(string, string) string
	Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceStr, codeStr string) (string, error)
	Call(fromStr, toStr, valueStr, gasStr, gasPriceStr, codeStr string) (string, string, error)
}

Registrar's backend is defined as an interface (implemented by xeth, but could be remote)

type Registrar

type Registrar struct {
	// contains filtered or unexported fields
}

func New

func New(b Backend) (res *Registrar)

func (*Registrar) HashToHash

func (self *Registrar) HashToHash(khash common.Hash) (chash common.Hash, err error)

HashToHash(key) resolves contenthash for key (a hash) using HashReg resolution is costless non-transactional implemented as direct retrieval from db

func (*Registrar) HashToUrl

func (self *Registrar) HashToUrl(chash common.Hash) (uri string, err error)

HashToUrl(contenthash) resolves the url for contenthash using UrlHint resolution is costless non-transactional implemented as direct retrieval from db if we use content addressed storage, this step is no longer necessary

func (*Registrar) NameToAddr

func (self *Registrar) NameToAddr(from common.Address, name string) (address common.Address, err error)

NameToAddr(from, name) queries the registrar for the address on name

func (*Registrar) ReserveName

func (self *Registrar) ReserveName(address common.Address, name string) (txh string, err error)

ReserveName(from, name) reserves name for the sender address in the globalRegistrar the tx needs to be mined to take effect

func (*Registrar) SetAddressToName

func (self *Registrar) SetAddressToName(from common.Address, name string, address common.Address) (txh string, err error)

SetAddressToName(from, name, addr) will set the Address to address for name in the globalRegistrar using from as the sender of the transaction the tx needs to be mined to take effect

func (*Registrar) SetGlobalRegistrar

func (self *Registrar) SetGlobalRegistrar(namereg string, addr common.Address) (txhash string, err error)

func (*Registrar) SetHashReg

func (self *Registrar) SetHashReg(hashreg string, addr common.Address) (txhash string, err error)

func (*Registrar) SetHashToHash

func (self *Registrar) SetHashToHash(address common.Address, codehash, dochash common.Hash) (txh string, err error)

registers some content hash to a key/code hash e.g., the contract Info combined Json Doc's ContentHash to CodeHash of a contract or hash of a domain

func (*Registrar) SetOwner

func (self *Registrar) SetOwner(address common.Address) (txh string, err error)

called as first step in the registration process on HashReg

func (*Registrar) SetUrlHint

func (self *Registrar) SetUrlHint(urlhint string, addr common.Address) (txhash string, err error)

func (*Registrar) SetUrlToHash

func (self *Registrar) SetUrlToHash(address common.Address, hash common.Hash, url string) (txh string, err error)

SetUrlToHash(from, hash, url) registers a url to a content hash so that the content can be fetched address is used as sender for the transaction and will be the owner of a new registry entry on first time use FIXME: silently doing nothing if sender is not the owner note that with content addressed storage, this step is no longer necessary

type VersionedRegistrar

type VersionedRegistrar interface {
	Resolver(*big.Int) *Registrar
	Registry() *Registrar
}

TODO Registrar should also just implement The Resolver and Registry interfaces Simplify for now.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL