bitmessage

package
v0.0.0-...-aa49119 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2013 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package bitmessage implements the BitMessage protocol.

Index

Constants

View Source
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
)
View Source
const (

	// This is a normal network node.
	ConnectionServiceNodeNetwork = 1
)

Variables

View Source
var (
	// PortNumber can be safely changed before the call to node.Run().
	PortNumber = 9090
)

Functions

func Bitmessage

func Bitmessage(msg []byte) ([]byte, error)

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

func ProofOfWork(data []byte, initialNonce []byte) (nonceByte [8]byte, err error)

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 NetworkAddress struct {
	Services uint64 // Same service(s) listed in version

	// IPv6 Address, or IPv6-mapped IPv4 address:
	//00 00 00 00 00 00 00 00 00 00 FF FF, followed by the IPv4 bytes.
	IP   [16]byte
	Port uint16 // portNumber.
}

type Node

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

func (*Node) Run

func (n *Node) Run()

type PubKey

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

A public key.

type UnencryptedMessageData

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

Jump to

Keyboard shortcuts

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