func (e *G1) Unmarshal(m []byte) ([]byte, error) {
	const numBytes = 256 / 8
	if len(m) != 2*numBytes {
		return nil, errors.New("bn256: not enough data")
	}
	if e.p == nil {
		e.p = newCurvePoint(nil)
	}
	e.p.x.SetBytes(m[0*numBytes : 1*numBytes])
	if e.p.x.Cmp(P) >= 0 {
		return nil, errors.New("bn256: coordinate exceeds modulus")
	}
	e.p.y.SetBytes(m[1*numBytes : 2*numBytes])
	if e.p.y.Cmp(P) >= 0 {
		return nil, errors.New("bn256: coordinate exceeds modulus")
	}
	if e.p.x.Sign() == 0 && e.p.y.Sign() == 0 {
		e.p.y.SetInt64(1)
		e.p.z.SetInt64(0)
		e.p.t.SetInt64(0)
	} else {
		e.p.z.SetInt64(1)
		e.p.t.SetInt64(1)
		if !e.p.IsOnCurve() {
			return nil, errors.New("bn256: malformed point")
		}
	}
	return m[2*numBytes:], nil
}
Unmarshal sets e to the result of converting the output of Marshal back into
a group element and then returns e.
package bn256
import (
	"crypto/rand"
	"errors"
	"io"
	"math/big"
)
type G1 struct {
	p *curvePoint
}
func RandomG1(r io.Reader) (*big.Int, *G1, error) {
	var k *big.Int
	var err error
	for {
		k, err = rand.Int(r, Order)
		if err != nil {
			return nil, nil, err
		}
		if k.Sign() > 0 {
			break
		}
	}
	return k, new(G1).ScalarBaseMult(k), nil
}
func (e *G1) String() string {
	return "bn256.G1" + e.p.String()
}
func (e *G1) CurvePoints() (*big.Int, *big.Int, *big.Int, *big.Int) {
	return e.p.x, e.p.y, e.p.z, e.p.t
}
func (e *G1) ScalarBaseMult(k *big.Int) *G1 {
	if e.p == nil {
		e.p = newCurvePoint(nil)
	}
	e.p.Mul(curveGen, k, new(bnPool))
	return e
}
func (e *G1) ScalarMult(a *G1, k *big.Int) *G1 {
	if e.p == nil {
		e.p = newCurvePoint(nil)
	}
	e.p.Mul(a.p, k, new(bnPool))
	return e
}
func (e *G1) Add(a, b *G1) *G1 {
	if e.p == nil {
		e.p = newCurvePoint(nil)
	}
	e.p.Add(a.p, b.p, new(bnPool))
	return e
}
func (e *G1) Neg(a *G1) *G1 {
	if e.p == nil {
		e.p = newCurvePoint(nil)
	}
	e.p.Negative(a.p)
	return e
}
func (e *G1) Marshal() []byte {
	const numBytes = 256 / 8
	if e.p.IsInfinity() {
		return make([]byte, numBytes*2)
	}
	e.p.MakeAffine(nil)
	xBytes := new(big.Int).Mod(e.p.x, P).Bytes()
	yBytes := new(big.Int).Mod(e.p.y, P).Bytes()
	ret := make([]byte, numBytes*2)
	copy(ret[1*numBytes-len(xBytes):], xBytes)
	copy(ret[2*numBytes-len(yBytes):], yBytes)
	return ret
}