Closed kawww closed 4 years ago
Now I know OP_UNKNOWN in the getrawtransaction is the namespace key value... I can use hex2bin to get key and value, but namespace is not words.
"vout": [
{
"value": 0.01000000,
"n": 0,
"scriptPubKey": {
"asm": "OP_UNKNOWN 3526305f5f2a99103a91694b96460c0d4ff506c601 50726f647563742057617272616e7479 50726f647563742057617272616e74793a20466f722077617272616e747920696e666f726d6174696f6e2061626f757420746869732070726f647563742c20706c6561736520636c69636b2068657265 OP_2DROP OP_DROP OP_HASH160 fd0a64716ea9776fdd6f27222c35a7fd3f8bc87f OP_EQUAL",
3526305f5f2a99103a91694b96460c0d4ff506c601
maybe namespace
50726f647563742057617272616e7479
key
50726f647563742057617272616e74793a20466f722077617272616e747920696e666f726d6174696f6e2061626f757420746869732070726f647563742c20706c6561736520636c69636b2068657265
value
You are almost right:
Namespace: 3526305f5f2a99103a91694b96460c0d4ff506c601 Key: 50726f647563742057617272616e7479 Value: 50726f647563742057617 ...
I guess you enable "txindex=1" in kevacoin.conf
.
We can make it much easier to read by properly parsing the script (so that there is no OP_UNKNOWN).
You are almost right:
Namespace: 3526305f5f2a99103a91694b96460c0d4ff506c601 Key: 50726f647563742057617272616e7479 Value: 50726f647563742057617 ...
I guess you enable "txindex=1" in
kevacoin.conf
. We can make it much easier to read by properly parsing the script (so that there is no OP_UNKNOWN).
Thanks, so how to decoded Namespace: 3526305f5f2a99103a91694b96460c0d4ff506c601?
Now I can use hex to ascii decoded key and value http://mcraigweaver.com/ascii.htm
but Namespace is strange and different with key and value.
Now I find another way to get namespace that I can add namespace in value and read value data. But If Namespace can be decodeded, I think it's better.
If you convert the hex string 3526305f5f2a99103a91694b96460c0d4ff506c601
into binary string, and do a Base58Check encoding on the binary string, you can get back the namespace.
What programming language are you using? This can be done very easily using Javascript. E.g. https://github.com/bitcoinjs/bs58check
var bs58check = require('bs58check')
var data = Buffer.from('3526305f5f2a99103a91694b96460c0d4ff506c601', 'hex');
console.log(bs58check.encode(data))
For PHP: https://github.com/furqansiddiqui/base58check-php
I haven't tried this ...
I have fixed the keva operation decoding in the master branch: https://github.com/kevacoin-project/kevacoin/commit/14b739051c1cd333dbcd00e6780272111fcf6954
If you convert the hex string
3526305f5f2a99103a91694b96460c0d4ff506c601
into binary string, and do a Base58Check encoding on the binary string, you can get back the namespace.What programming language are you using? This can be done very easily using Javascript. E.g. https://github.com/bitcoinjs/bs58check
Thanks very much, I use php and I will check how to use php to decoded. I think encoded this namespace is not necessary too..
For PHP: https://github.com/furqansiddiqui/base58check-php
I haven't tried this ...
ok got it~ 😄
var bs58check = require('bs58check') var data = Buffer.from('3526305f5f2a99103a91694b96460c0d4ff506c601', 'hex'); console.log(bs58check.encode(data))
I tried to use php to encode these hex, and finally success.
but...I think the namespace hex in tx is not enough.
for example
blog namespace is NgKBKkBAJMtzsuit85TpTpo5Xj6UQUg1wr
tx 08009579d3f34ff83d3650417b192915f3443d79d4beab188e796524ec1f4f64
so I get namespace hex
OP_KEVA_PUT 35dfc637022a506c2640445445e326c6c2f9fc4538
I use https://github.com/dcentrica/bitcoin-base58check to encode
$data2=hex2bin("35dfc637022a506c2640445445e326c6c2f9fc4538");
$base58Check = new Base58Check('bitcoin');
$data = $base58Check->encode($data2);
echo $data;
4K9GhJdTd6ZDbSBDN1JsJAkmARdYK
I use bitcoin-encoder http://lenschulwitz.com/base58 get 4K9GhJdTd6ZDbSBDN1JsJAkmARdYK too.
I use this bitcoin-encoder to decode NgKBKkBAJMtzsuit85TpTpo5Xj6UQUg1wr got
35dfc637022a506c2640445445e326c6c2f9fc45385ed8fdd5
so the real hex is longer than the hex in tx.
35dfc637022a506c2640445445e326c6c2f9fc4538
I use another https://www.better-converter.com/Encoders-Decoders/Base58Check-to-Hexadecimal-Decoder get full hex too.
So I think it is not possiable to encode the hex to get namespace address if hex is not enough.
35dfc637022a506c2640445445e326c6c2f9fc4538 5e d8 fd d5 35dfc637022a506c2640445445e326c6c2f9fc4538
maybe 5e d8 fd d5 is for checking, but how to get it?
I use full hex 35dfc637022a506c2640445445e326c6c2f9fc45385ed8fdd5 to get namespace name ok.
$data2=hex2bin("35dfc637022a506c2640445445e326c6c2f9fc45385ed8fdd5");
$base58Check = new Base58Check('bitcoin');
$data = $base58Check->encode($data2);
echo $data;
NgKBKkBAJMtzsuit85TpTpo5Xj6UQUg1wr
finnaly sovled https://stackoverflow.com/questions/58782314/how-to-generate-trx-wallet-without-using-api
this github include php base58check code and easy to use.
Base58Check::encode("35dfc637022a506c2640445445e326c6c2f9fc4538", false , 0 , false);
If I send someone a txid, how does he use the wallet to find the namespace name?
I can use gettransaction to get "details" if the tx is part of the wallet.
gettransaction cb1cb15cecf1956d3ef4b8bab356a1119b5cf3b92afb905f501c0054ab541c7b
But others only could use getrawtransaction, and no "details".
getrawtransaction cb1cb15cecf1956d3ef4b8bab356a1119b5cf3b92afb905f501c0054ab541c7b 1
Is there any other ways to get namespace name?
Now ravencoin support upload ipfx hash/txid to the blockchain, I think if everyone can check txid to visit namespace. It's both good for keva and rvn.
And send namespace to each other on the blochchain is possable.