Skip to main content

InsertProof

InsertProof attempts to insert a new issuance or transfer proof into the Universe tree specified by the UniverseKey. If valid, then the proof is inserted into the database, with a new Universe root returned for the updated asset_id/group_key.

Source: universerpc/universe.proto

gRPC

rpc InsertProof (AssetProof) returns (AssetProofResponse);

REST

HTTP MethodPath
POST /v1/taproot-assets/universe/proofs/asset-id/{key.id.asset_id_str}/{key.leaf_key.op.hash_str}/{key.leaf_key.op.index}/{key.leaf_key.script_key_str}

Code Samples

const fs = require('fs');
const grpc = require('@grpc/grpc-js');
const protoLoader = require('@grpc/proto-loader');

const GRPC_HOST = 'localhost:10029'
const MACAROON_PATH = 'TAPROOT-ASSETS_DIR/regtest/taproot-assets.macaroon'
const TLS_PATH = 'TAPROOT-ASSETS_DIR/tls.cert'

const loaderOptions = {
keepCase: true,
longs: String,
enums: String,
defaults: true,
oneofs: true,
};
const packageDefinition = protoLoader.loadSync('universerpc/universe.proto', loaderOptions);
const universerpc = grpc.loadPackageDefinition(packageDefinition).universerpc;
process.env.GRPC_SSL_CIPHER_SUITES = 'HIGH+ECDSA';
const tlsCert = fs.readFileSync(TLS_PATH);
const sslCreds = grpc.credentials.createSsl(tlsCert);
const macaroon = fs.readFileSync(MACAROON_PATH).toString('hex');
const macaroonCreds = grpc.credentials.createFromMetadataGenerator(function(args, callback) {
let metadata = new grpc.Metadata();
metadata.add('macaroon', macaroon);
callback(null, metadata);
});
let creds = grpc.credentials.combineChannelCredentials(sslCreds, macaroonCreds);
let client = new universerpc.Universe(GRPC_HOST, creds);
let request = {
key: <UniverseKey>,
asset_leaf: <AssetLeaf>,
};
client.insertProof(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "req": <UniverseKey>,
// "universe_root": <UniverseRoot>,
// "universe_inclusion_proof": <bytes>,
// "asset_leaf": <AssetLeaf>,
// "multiverse_root": <MerkleSumNode>,
// "multiverse_inclusion_proof": <bytes>,
// }

Messages

universerpc.AssetProof

Source: universerpc/universe.proto

FieldgRPC TypeREST TypeREST Placement
key
UniverseKeyobjectmixed
asset_leaf
AssetLeafobjectbody

universerpc.AssetProofResponse

Source: universerpc/universe.proto

FieldgRPC TypeREST Type
req
UniverseKeyobject
universe_root
UniverseRootobject
universe_inclusion_proof
bytesstring
asset_leaf
AssetLeafobject
multiverse_root
MerkleSumNodeobject
multiverse_inclusion_proof
bytesstring

Nested Messages

taprpc.AnchorInfo

FieldgRPC TypeREST Type
anchor_tx
bytesstring
anchor_block_hash
stringstring
anchor_outpoint
stringstring
internal_key
bytesstring
merkle_root
bytesstring
tapscript_sibling
bytesstring
block_height
uint32integer

taprpc.Asset

FieldgRPC TypeREST Type
version
AssetVersionstring
asset_genesis
GenesisInfoobject
amount
uint64string
lock_time
int32integer
relative_lock_time
int32integer
script_version
int32integer
script_key
bytesstring
script_key_is_local
boolboolean
asset_group
AssetGroupobject
chain_anchor
AnchorInfoobject
prev_witnesses
PrevWitness[]array
is_spent
boolboolean
lease_owner
bytesstring
lease_expiry
int64string
is_burn
boolboolean
script_key_declared_known
boolboolean
script_key_has_script_path
boolboolean
decimal_display
DecimalDisplayobject

taprpc.AssetGroup

FieldgRPC TypeREST Type
raw_group_key
bytesstring
tweaked_group_key
bytesstring
asset_witness
bytesstring
tapscript_root
bytesstring

taprpc.DecimalDisplay

FieldgRPC TypeREST Type
decimal_display
uint32integer

taprpc.GenesisInfo

FieldgRPC TypeREST Type
genesis_point
stringstring
name
stringstring
meta_hash
bytesstring
asset_id
bytesstring
asset_type
AssetTypestring
output_index
uint32integer

taprpc.PrevInputAsset

FieldgRPC TypeREST Type
anchor_point
stringstring
asset_id
bytesstring
script_key
bytesstring
amount
uint64string

taprpc.PrevWitness

FieldgRPC TypeREST Type
prev_id
PrevInputAssetobject
tx_witness
bytes[]array
split_commitment
SplitCommitmentobject

taprpc.SplitCommitment

FieldgRPC TypeREST Type
root_asset
Assetobject

universerpc.AssetKey

FieldgRPC TypeREST Type
op_str
stringstring
op
Outpointobject
script_key_bytes
bytesstring
script_key_str
stringstring

universerpc.AssetLeaf

FieldgRPC TypeREST Type
asset
Assetobject
proof
bytesstring

universerpc.ID

FieldgRPC TypeREST Type
asset_id
bytesstring
asset_id_str
stringstring
group_key
bytesstring
group_key_str
stringstring
proof_type
ProofTypestring

universerpc.MerkleSumNode

FieldgRPC TypeREST Type
root_hash
bytesstring
root_sum
int64string

universerpc.Outpoint

FieldgRPC TypeREST Type
hash_str
stringstring
index
int32integer

universerpc.UniverseKey

FieldgRPC TypeREST Type
id
IDobject
leaf_key
AssetKeyobject

universerpc.UniverseRoot

FieldgRPC TypeREST Type
id
IDobject
mssmt_root
MerkleSumNodeobject
asset_name
stringstring
amounts_by_asset_id
AmountsByAssetIdEntry[]object

universerpc.UniverseRoot.AmountsByAssetIdEntry

FieldgRPC TypeREST Type
key
stringunknown
value
uint64unknown

Enums

taprpc.AssetType

NameNumber
NORMAL
0
COLLECTIBLE
1

taprpc.AssetVersion

NameNumber
ASSET_VERSION_V0
0
ASSET_VERSION_V1
1

universerpc.ProofType

NameNumber
PROOF_TYPE_UNSPECIFIED
0
PROOF_TYPE_ISSUANCE
1
PROOF_TYPE_TRANSFER
2