Skip to main content

PushProof

PushProof attempts to query the local universe for a proof specified by a UniverseKey. If found, a connection is made to a remote Universe server to attempt to upload the asset leaf.

Source: universerpc/universe.proto

gRPC

rpc PushProof (PushProofRequest) returns (PushProofResponse);

REST

HTTP MethodPath
POST /v1/taproot-assets/universe/proofs/push/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>,
server: <UniverseFederationServer>,
};
client.pushProof(request, function(err, response) {
console.log(response);
});
// Console output:
// {
// "key": <UniverseKey>,
// }

Messages

universerpc.PushProofRequest

Source: universerpc/universe.proto

FieldgRPC TypeREST TypeREST Placement
key
UniverseKeyobjectmixed
server
UniverseFederationServerobjectbody

universerpc.PushProofResponse

Source: universerpc/universe.proto

FieldgRPC TypeREST Type
key
UniverseKeyobject

Nested Messages

universerpc.AssetKey

FieldgRPC TypeREST Type
op_str
stringstring
op
Outpointobject
script_key_bytes
bytesstring
script_key_str
stringstring

universerpc.ID

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

universerpc.Outpoint

FieldgRPC TypeREST Type
hash_str
stringstring
index
int32integer

universerpc.UniverseFederationServer

FieldgRPC TypeREST Type
host
stringstring
id
int32integer

universerpc.UniverseKey

FieldgRPC TypeREST Type
id
IDobject
leaf_key
AssetKeyobject

Enums

universerpc.ProofType

NameNumber
PROOF_TYPE_UNSPECIFIED
0
PROOF_TYPE_ISSUANCE
1
PROOF_TYPE_TRANSFER
2