bxelab / runestone Goto Github PK
View Code? Open in Web Editor NEWBitcoin Ordinals Rune protocol golang implement
License: Apache License 2.0
Bitcoin Ordinals Rune protocol golang implement
License: Apache License 2.0
The encode code
func TestTransfer(t *testing.T) {
runeIdStr := "2609649:946"
runeId, _ := RuneIdFromString(runeIdStr)
var edicts []Edict
edicts = append(edicts, Edict{
ID: *runeId,
Amount: uint128.From64(20),
Output: 2,
})
r := Runestone{Edicts: edicts}
data, err := r.Encipher()
if err != nil {
fmt.Println(err)
}
fmt.Printf("Transfer Rune[%s] data: 0x%x\n", runeIdStr, data)
dataString, _ := txscript.DisasmString(data)
fmt.Printf("Transfer Script: %s\n", dataString)
}
get the result
OP_RETURN 13 00f1a39f01b2071402
Transfer Script: OP_RETURN 13 00f1a39f01b2071402
The decode is below
func TestDemo(t *testing.T) {
data, _ := hex.DecodeString("00f1a39f01b2071402") //Mint UNCOMMON•GOODS
fmt.Println(data)
var tx wire.MsgTx
builder := txscript.NewScriptBuilder()
// Push opcode OP_RETURN
builder.AddOp(txscript.OP_RETURN)
// Push MAGIC_NUMBER
builder.AddOp(txscript.OP_13)
// Push payload
builder.AddData(data)
pkScript, err := builder.Script()
txOut := wire.NewTxOut(0, pkScript)
tx.AddTxOut(txOut)
r := &Runestone{}
artifact, err := r.Decipher(&tx)
if err != nil {
fmt.Println(err)
return
}
a, _ := json.Marshal(artifact)
fmt.Printf("Artifact: %s\n", string(a))
}
However decode get
{"Cenotaph":{"Etching":null,"Flaw":0,"Mint":null},"Runestone":null}
How should I do this correct?
rust 实在是啃不动,等着你啊 大佬
Hi. I'm trying to use your library to etch a new rune, but seems like it returns error:
Error validating transaction: witness script detected in tx without witness data.
I think the error occurs because I'm using taproot address. can you write an example about create and sign a tx in rune? many thanks and appriciate.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.