Documentation ¶
Index ¶
- Constants
- Variables
- type Backend
- type Registrar
- func (self *Registrar) HashToHash(khash common.Hash) (chash common.Hash, err error)
- func (self *Registrar) HashToUrl(chash common.Hash) (uri string, err error)
- func (self *Registrar) NameToAddr(from common.Address, name string) (address common.Address, err error)
- func (self *Registrar) ReserveName(address common.Address, name string) (txh string, err error)
- func (self *Registrar) SetAddressToName(from common.Address, name string, address common.Address) (txh string, err error)
- func (self *Registrar) SetGlobalRegistrar(namereg string, addr common.Address) (txhash string, err error)
- func (self *Registrar) SetHashReg(hashreg string, addr common.Address) (txhash string, err error)
- func (self *Registrar) SetHashToHash(address common.Address, codehash, dochash common.Hash) (txh string, err error)
- func (self *Registrar) SetOwner(address common.Address) (txh string, err error)
- func (self *Registrar) SetUrlHint(urlhint string, addr common.Address) (txhash string, err error)
- func (self *Registrar) SetUrlToHash(address common.Address, hash common.Hash, url string) (txh string, err error)
- type VersionedRegistrar
Constants ¶
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 ¶
var ( // GlobalRegistrarAddr = "0xc6d9d2cd449a754c494264e1809c50e34d64562b" // olympic GlobalRegistrarAddr = "0x33990122638b9132ca29c723bdf037f1a891a70c" // frontier HashRegAddr = "0x23bf622b5a65f6060d855fca401133ded3520620" // frontier UrlHintAddr = "0x73ed5ef6c010727dfd2671dbb70faac19ec18626" // frontier )
Registrar implements the Elementrem name registrar services mapping - arbitrary strings to elementrem 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
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 xele, but could be remote)
type Registrar ¶
type Registrar struct {
// contains filtered or unexported fields
}
func (*Registrar) HashToHash ¶
HashToHash(key) resolves contenthash for key (a hash) using HashReg resolution is costless non-transactional implemented as direct retrieval from db
func (*Registrar) HashToUrl ¶
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 ¶
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 (*Registrar) SetHashReg ¶
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) SetUrlHint ¶
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