namespaceId, '_CLITOR_IS_', json_encode( [ 'version' => '1.0', 'model' => [ 'name' => 'kevacoin', 'software' => [ 'version' => $software->version, 'protocol' => $software->protocolversion ], 'namespace' => $ns->namespaceId ], 'pieces' => [ 'total' => $total, 'size' => $size, ], 'file' => [ 'name' => basename( $argv[2] ), 'mime' => mime_content_type( $argv[2] ), 'size' => filesize( $argv[2] ), 'md5' => $md5file ] ] ) ) ) ); // Begin pieces saving foreach ($pieces as $key => $value) { print_r( _exec( $argv[1], sprintf( "%s '%s' '%s' '%s'", 'keva_put', $ns->namespaceId, $key, $value ) ) ); // Apply delays to prevent too-long-mempool-chain reject $delay = isset($argv[4]) && $argv[4] > 0 ? (int) $argv[4] : 60; echo sprintf( '%s/%s sent, waiting %s seconds...' . PHP_EOL, $key + 1, $total, $delay ); sleep($delay); } // Print result echo sprintf( 'done! run to extract: php kevacoin/get.php %s %s' . PHP_EOL, $argv[1], $ns->namespaceId );