Documentation ¶
Overview ¶
Package bitmessage implements the BitMessage protocol.
Index ¶
Constants ¶
const ( // Any data with this number may be ignored. The sending node might simply // be sharing its public key with you. EncodingIgnore = iota // UTF-8. No 'Subject' or 'Body' sections. Useful for simple strings of // data, like URIs or magnet links. EncodingTrivial // UTF-8. Uses 'Subject' and 'Body' sections. No MIME is used. // messageToTransmit = 'Subject:' + subject + '\n' + 'Body:' + message EncodingSimple )
const (
// This is a normal network node.
ConnectionServiceNodeNetwork = 1
)
Variables ¶
var (
// PortNumber can be safely changed before the call to node.Run().
PortNumber = 9090
)
Functions ¶
func Bitmessage ¶
Bitmessage produces a hash for the provided message using a SHA-512 in the first round and a RIPEMD-160 in the second.
func ProofOfWork ¶
ProofOfWork goes through several iterations to find a nonce number that, when hashed with the payload data, produces a certain target result. The only way to find such a nonce is by bruteforce. The goal is to ensure that each participant of the network can only send a limited number of messages per hour, since they need computational power to do so. See the wikipedia article for Hashcash, that inspired Bitcoin's mechanism and Bitmessage's. The BitMessage implementation is documented at https://bitmessage.org/wiki/Proof_of_work. Note that the difficulty of the calculation is proportional to the size of the payload.
Types ¶
type Config ¶
type Config struct { sync.RWMutex Port int Nodes []ipPort // contains filtered or unexported fields }
Config is used to persist the node state on disk.
type GetPubKey ¶
type GetPubKey struct {
// contains filtered or unexported fields
}
When a node has the hash of a public key (from an address) but not the public key itself, it must send out a request for the public key.
type NetworkAddress ¶
type UnencryptedMessageData ¶
type UnencryptedMessageData struct {
// contains filtered or unexported fields
}