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 ( //these arnt the right ones for gshift GlobalRegistrarAddr = "0x6c221ca53705f3497ec90ca7b84c59ae7382fc21" // frontier HashRegAddr = "0x10774b55f37302de0075fdc131f63d303ae5dd9e" // frontier UrlHintAddr = "0x8dad0847dedb1253b6dfe616c6d2841da291dc1f" // frontier )
Registrar implements the Shift name registrar services mapping - arbitrary strings to shift 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 xeth, 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