Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问在这段示例代码中,0xF23F9FD2 代表什么,如何设置输出的 gas #62

Open
E0001 opened this issue Sep 14, 2024 · 5 comments

Comments

@E0001
Copy link

E0001 commented Sep 14, 2024

// psbt
var inputs []*bitcoin.TxInput
inputs = append(inputs, &bitcoin.TxInput{
	TxId:              "46e3ce050474e6da80760a2a0b062836ff13e2a42962dc1c9b17b8f962444206",
	VOut:              uint32(0),
	Sequence:          1,
	Amount:            int64(546),
	Address:           "2NF33rckfiQTiE5Guk5ufUdwms8PgmtnEdc",
	PrivateKey:        "cPnvkvUYyHcSSS26iD1dkrJdV7k1RoUqJLhn3CYxpo398PdLVE22",
	MasterFingerprint: 0xF23F9FD2,
	DerivationPath:    "m/44'/0'/0'/0/0",
	PublicKey:         "0357bbb2d4a9cb8a2357633f201b9c518c2795ded682b7913c6beef3fe23bd6d2f",
})

var outputs []*bitcoin.TxOutput
outputs = append(outputs, &bitcoin.TxOutput{
	Address: "2NF33rckfiQTiE5Guk5ufUdwms8PgmtnEdc",
	Amount:  int64(100000),
})
psbtHex, err := bitcoin.GenerateUnsignedPSBTHex(inputs, outputs, network)
if err != nil {
	// todo
	fmt.Println(err)
}
fmt.Println(psbtHex)
@yanminmin
Copy link
Collaborator

This one doesn't support gas Settings, so you need to calculate inputs and outputs in advance.

@yanminmin
Copy link
Collaborator

MasterFingerprint is only supported by keystone.You can ignore this attribute

@E0001
Copy link
Author

E0001 commented Sep 29, 2024

MasterFingerprint 仅受 keystone 支持。您可以忽略此属性

Okay, thank you, big shot

@hoailinhle
Copy link

// psbt
var inputs []*bitcoin.TxInput
inputs = append(inputs, &bitcoin.TxInput{
	TxId:              "46e3ce050474e6da80760a2a0b062836ff13e2a42962dc1c9b17b8f962444206",
	VOut:              uint32(0),
	Sequence:          1,
	Amount:            int64(546),
	Address:           "2NF33rckfiQTiE5Guk5ufUdwms8PgmtnEdc",
	PrivateKey:        "cPnvkvUYyHcSSS26iD1dkrJdV7k1RoUqJLhn3CYxpo398PdLVE22",
	MasterFingerprint: 0xF23F9FD2,
	DerivationPath:    "m/44'/0'/0'/0/0",
	PublicKey:         "0357bbb2d4a9cb8a2357633f201b9c518c2795ded682b7913c6beef3fe23bd6d2f",
})

var outputs []*bitcoin.TxOutput
outputs = append(outputs, &bitcoin.TxOutput{
	Address: "2NF33rckfiQTiE5Guk5ufUdwms8PgmtnEdc",
	Amount:  int64(100000),
})
psbtHex, err := bitcoin.GenerateUnsignedPSBTHex(inputs, outputs, network)
if err != nil {
	// todo
	fmt.Println(err)
}
fmt.Println(psbtHex)

@luyishisi
Copy link
Collaborator

If you have questions about this SDK, please pay more attention to the readme document.
If the problem still cannot be solved, or you find a system problem, please add more effective information, such as problem description, relevant code, on-chain transactions, and other information that helps understand your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants